Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.
Python agentaichatgptdeepseekfine-tuninggemmaimage-generationllamallmllmsopenaipythonqwenreinforcement-learningself-hostedstable-diffusiontext-to-speechttsuiunsloth
Studio training: describe public mirror access separately from model licensing (#15475)
Daniel Han0c9ac8089b36
diff --git a/studio/backend/core/training/diffusion_train_common.py b/studio/backend/core/training/diffusion_train_common.pyindex cec1cc36241..b7156c14ec3 100644--- a/studio/backend/core/training/diffusion_train_common.py+++ b/studio/backend/core/training/diffusion_train_common.py@@ -527,11 +527,12 @@ _BASE_TRAIN_SPECS: dict[str, dict[str, Any]] = {_GATED_NOTE = "Gated: needs its license and your HF token."-def _family_vram_note(name: str) -> str:+def _family_vram_note(name: str, overrides: Optional[dict[str, Any]] = None) -> str:"""The one-line note, rebuilt from the spec for clients that predate the chip fields."""spec = _FAMILY_TRAIN_SPECS.get(name)if not spec:return ""+ spec = {**spec, **(overrides or {})}gb = spec["qlora_vram_gb"]head = f"{spec['params']}, QLoRA by default (~{gb} GB+)." if spec["params"] else f"~{gb} GB+."tail = [t for t in (_GATED_NOTE if spec["gated"] else "", spec["note"]) if t]@@ -950,6 +951,33 @@ def training_precision_preflight_error(resolved_family: str, base_precision: strreturn None+def _training_mirror_access_specs(repo: str, note: str = "") -> dict[str, dict[str, Any]]:+ """Access facts for a gated vendor base and its mirror, using the trainer's fetch policy."""+ from core.inference.diffusion_families import (+ mirror_repo,+ prefer_ungated_mirror,+ upstream_is_gated,+ )++ mirror = mirror_repo(repo)+ if not mirror or not upstream_is_gated(repo):+ return {}+ facts = {}+ for shown in (repo, mirror):+ fetched = prefer_ungated_mirror(shown)+ gated = upstream_is_gated(fetched)+ explanation = (+ f"Downloads from {fetched}. The original model license still applies."+ if not gated+ else ""+ )+ facts[shown] = {+ "gated": gated,+ "note": " ".join(part for part in (note, explanation) if part),+ }+ return facts++def family_train_infos() -> list[dict[str, Any]]:"""Lists both registries; drops a family whose pipeline class is missing, since start refuses it."""from core.inference.diffusion_families import family_pipeline_available, mirror_repo@@ -988,6 +1016,12 @@ def family_train_infos() -> list[dict[str, Any]]:repo_mirror = mirror_repo(repo)if repo_mirror:base_specs[repo_mirror] = dict(base_spec)+ for repo in repos:+ for shown, access in _training_mirror_access_specs(+ repo, str(spec.get("note", ""))+ ).items():+ base_specs[shown] = {**base_specs.get(shown, {}), **access}+ default_facts = base_specs.get(repos[0], {})for training_repo, inference_repo in getattr(fam, "deploy_base_repos", ()):deploy_bases[training_repo] = inference_repo# Mirror-id bases pair like vendor ids; return the inference mirror so Deploy stays ungated.@@ -1001,12 +1035,14 @@ def family_train_infos() -> list[dict[str, Any]]:"default_base": repos[0],"base_repos": repos,"defaults": train_defaults(name),- "vram_note": dit_block or _family_vram_note(name),+ "vram_note": dit_block or _family_vram_note(name, default_facts),# Dropped on a dit_block, since vram_note then carries the reason."params": "" if dit_block else spec.get("params", ""),"qlora_vram_gb": None if dit_block else spec.get("qlora_vram_gb"),- "gated": False if dit_block else bool(spec.get("gated", False)),- "note": "" if dit_block else spec.get("note", ""),+ "gated": False+ if dit_block+ else bool(default_facts.get("gated", spec.get("gated", False))),+ "note": "" if dit_block else default_facts.get("note", spec.get("note", "")),"precision_modes": fam_modes,"recommended_precision": "nf4" if (not is_dit or dit_block) else dit_recommended,# Compile: SDXL and DiT trainers, except where the GPU lacks bf16 or the trainer cannot compile.diff --git a/studio/backend/tests/test_diffusion_dit_trainer.py b/studio/backend/tests/test_diffusion_dit_trainer.pyindex 5f40f67d347..ca70c34ef00 100644--- a/studio/backend/tests/test_diffusion_dit_trainer.py+++ b/studio/backend/tests/test_diffusion_dit_trainer.py@@ -253,7 +253,8 @@ def test_the_gate_reads_the_repo_the_run_will_fetch(monkeypatch, tmp_path):assert seen == ["black-forest-labs/FLUX.1-dev"]-def test_family_train_infos_lists_dit_families(dit_train_host):+def test_family_train_infos_lists_dit_families(dit_train_host, monkeypatch):+ monkeypatch.delenv("UNSLOTH_DIFFUSION_NO_MIRROR", raising = False)infos = {i["name"]: i for i in family_train_infos()}for fam in ("sdxl", "flux.1", "qwen-image", "z-image", "flux.2-klein", "flux.2-dev"):assert fam in infos, f"{fam} missing from family_train_infos"@@ -261,9 +262,11 @@ def test_family_train_infos_lists_dit_families(dit_train_host):assert infos[fam]["base_repos"]assert "resolution" in infos[fam]["defaults"]assert infos["flux.1"]["default_base"] == "black-forest-labs/FLUX.1-dev"- assert "gated" in infos["flux.1"]["vram_note"].lower()+ assert infos["flux.1"]["gated"] is False+ assert "Downloads from unsloth/FLUX.1-dev" in infos["flux.1"]["vram_note"]assert infos["flux.2-dev"]["default_base"] == "black-forest-labs/FLUX.2-dev"- assert "gated" in infos["flux.2-dev"]["vram_note"].lower()+ assert infos["flux.2-dev"]["gated"] is False+ assert "Downloads from unsloth/FLUX.2-dev" in infos["flux.2-dev"]["vram_note"]klein = infos["flux.2-klein"]assert klein["default_base"] == "black-forest-labs/FLUX.2-klein-base-4B"assert klein["base_repos"] == [@@ -277,14 +280,12 @@ def test_family_train_infos_lists_dit_families(dit_train_host):"black-forest-labs/FLUX.2-klein-9B")assert klein["deploy_bases"]["unsloth/FLUX.2-klein-base-9B"] == ("unsloth/FLUX.2-klein-9B")- assert klein["base_specs"]["black-forest-labs/FLUX.2-klein-base-9B"] == {- "params": "9B",- "qlora_vram_gb": 18,- }- assert klein["base_specs"]["unsloth/FLUX.2-klein-base-9B"] == {- "params": "9B",- "qlora_vram_gb": 18,- }+ for repo in ("black-forest-labs/FLUX.2-klein-base-9B", "unsloth/FLUX.2-klein-base-9B"):+ facts = klein["base_specs"][repo]+ assert facts["params"] == "9B"+ assert facts["qlora_vram_gb"] == 18+ assert facts["gated"] is False+ assert "Downloads from unsloth/FLUX.2-klein-base-9B" in facts["note"]assert "black-forest-labs/FLUX.2-klein-base-4B" not in klein["base_specs"]assert "gated" not in infos["flux.2-klein"]["vram_note"].lower()assert "4bit" in infos["z-image"]["default_base"].lower()@@ -575,3 +576,41 @@ def test_compile_engagement_reads_real_dynamo_counters():assert out.tolist() == [5.0, 5.0]assert "fell back to eager" in _compile_engagement_warning(before, _dynamo_compile_counters())torch._dynamo.reset()+++ "family, vendor",+ [+ ("flux.1", "black-forest-labs/FLUX.1-dev"),+ ("flux.2-dev", "black-forest-labs/FLUX.2-dev"),+ ("flux.2-klein", "black-forest-labs/FLUX.2-klein-base-9B"),+ ],+)+def test_training_mirror_access_names_the_download_without_a_token_requirement(+ dit_train_host, monkeypatch, family, vendor+):+ monkeypatch.delenv("UNSLOTH_DIFFUSION_NO_MIRROR", raising = False)+ info = next(row for row in family_train_infos() if row["name"] == family)+ mirror = f"unsloth/{vendor.split('/')[-1]}"+ for repo in (vendor, mirror):+ facts = info["base_specs"][repo]+ assert facts["gated"] is False+ assert f"Downloads from {mirror}." in facts["note"]+ assert "original model license still applies" in facts["note"]+ assert "HF token" not in facts["note"]+ assert "HF token" not in info["vram_note"]+++def test_training_access_keeps_the_gate_when_mirrors_are_disabled(dit_train_host, monkeypatch):+ monkeypatch.setenv("UNSLOTH_DIFFUSION_NO_MIRROR", "1")+ info = next(row for row in family_train_infos() if row["name"] == "flux.1")+ assert info["gated"] is True+ assert "HF token" in info["vram_note"]+ assert info["base_specs"]["black-forest-labs/FLUX.1-dev"]["gated"] is True+ assert info["base_specs"]["unsloth/FLUX.1-dev"]["gated"] is True+++def test_ungated_training_bases_do_not_inherit_a_gated_family(monkeypatch):+ from core.training.diffusion_train_common import _training_mirror_access_specs+ assert _training_mirror_access_specs("Tongyi-MAI/Z-Image-Turbo") == {}+ assert _training_mirror_access_specs("custom/private-model") == {}diff --git a/studio/frontend/tests/diffusion-train-family-facts.test.ts b/studio/frontend/tests/diffusion-train-family-facts.test.tsindex a895d4f3608..b37c38c8a11 100644--- a/studio/frontend/tests/diffusion-train-family-facts.test.ts+++ b/studio/frontend/tests/diffusion-train-family-facts.test.ts@@ -50,3 +50,17 @@ test("keeps the family facts for Klein 4B and unknown custom bases", () => {"4B",);});+++test("mirror access overrides a gated family without losing its license note", () => {+ const note = "Downloads from unsloth/FLUX.1-dev. The original model license still applies.";+ const family = {+ params: "12B", qlora_vram_gb: 16, gated: true,+ base_specs: { "black-forest-labs/FLUX.1-dev": { gated: false, note } },+ };+ const facts = resolveDiffusionTrainingFacts(family, "black-forest-labs/FLUX.1-dev");+ assert.equal(facts.gated, false);+ assert.equal(facts.note, note);+ assert.equal(facts.params, "12B");+ assert.equal(facts.qlora_vram_gb, 16);+});