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
Fix pipeline denoiser downloads labeled as required assets (#16465)
Lee Jackson40bb5d6e547a
diff --git a/studio/backend/core/inference/diffusion.py b/studio/backend/core/inference/diffusion.pyindex dbaa3b5974b..45ee9e6d04a 100644--- a/studio/backend/core/inference/diffusion.py+++ b/studio/backend/core/inference/diffusion.py@@ -6958,6 +6958,7 @@ class DiffusionBackend:scoped_files: dict[str, list[str]] = {}scoped_gguf: dict[str, Optional[str]] = {}missing_checkpoints: set[str] = set()+ missing_denoisers: set[str] = set()def add_missing_entry(repo: str,@@ -6966,6 +6967,7 @@ class DiffusionBackend:*,gguf: Optional[str] = None,checkpoint: bool = False,+ hosted_denoiser: bool = False,) -> None:"""Adds only files neither cache root resolves, probed at the plan's revision; one entry per repo, else two jobs fight over progress and cancel."""@@ -7012,6 +7014,8 @@ class DiffusionBackend:)if checkpoint:missing_checkpoints.add(repo)+ if hosted_denoiser:+ missing_denoisers.add(repo)for entry in entries:if entry["repo_id"] != repo:continue@@ -7023,6 +7027,7 @@ class DiffusionBackend:)entry["gguf_filename"] = scoped_gguf[repo]entry["checkpoint"] = repo in missing_checkpoints+ entry["hosted_denoiser"] = repo in missing_denoisersreturnentries.append({@@ -7034,6 +7039,7 @@ class DiffusionBackend:),"gguf_filename": scoped_gguf[repo],"checkpoint": repo in missing_checkpoints,+ "hosted_denoiser": repo in missing_denoisers,})@@ -7073,7 +7079,14 @@ class DiffusionBackend:if dit_prequant is not None:# Staged, not just counted: leaving it out means a multi-GB inline pull under the load lock.prequant_repo, prequant_file, prequant_size = dit_prequant- add_missing_entry(prequant_repo, [prequant_file], {prequant_file: prequant_size})+ # Part of a pipeline pick, replacing its dense denoiser; a GGUF pick keeps it a required asset.+ add_missing_entry(+ prequant_repo,+ [prequant_file],+ {prequant_file: prequant_size},+ checkpoint = skip_transformer_weights,+ hosted_denoiser = skip_transformer_weights,+ )for ref in component_overrides.files.values() if component_overrides else ():if not ref.is_hub:continuediff --git a/studio/backend/models/inference.py b/studio/backend/models/inference.pyindex e10bb664172..b90f0b169cc 100644--- a/studio/backend/models/inference.py+++ b/studio/backend/models/inference.py@@ -5951,6 +5951,11 @@ class DiffusionDownloadPlanEntry(BaseModel):"planner has to say so: a gated base is staged from its ungated mirror, so the entry's ""repo id is not the id the caller picked and the role cannot be recovered downstream.",)+ hosted_denoiser: bool = Field(+ False,+ description = "This checkpoint entry holds a hosted denoiser replacing the pipeline's "+ "dense weights, which a pinned snapshot of that pipeline does not contain.",+ )class DiffusionDownloadPlanResponse(BaseModel):diff --git a/studio/backend/tests/test_diffusion_backend.py b/studio/backend/tests/test_diffusion_backend.pyindex 9c0ebee53c4..44326f15b68 100644--- a/studio/backend/tests/test_diffusion_backend.py+++ b/studio/backend/tests/test_diffusion_backend.py@@ -8814,6 +8814,11 @@ def test_download_plan_counts_the_hosted_prequant_in_the_required_footprint(monkassert plan["required_bytes"] - baseline["required_bytes"] == 6 * GBprequant = next(e for e in plan["entries"] if e["repo_id"] == "unsloth/Z-Image-Turbo-FP8")assert prequant["checkpoint"] is False+ assert prequant["hosted_denoiser"] is False+ selected = [entry for entry in plan["entries"] if entry["checkpoint"]]+ assert len(selected) == 1+ assert selected[0]["repo_id"] == "unsloth/Z-Image-GGUF"+ assert selected[0]["files"] == ["Z-Image-Turbo-Q4_K_M.gguf"]def test_download_plan_counts_a_cached_lower_auto_prequant(monkeypatch):diff --git a/studio/backend/tests/test_diffusion_pipeline_prequant.py b/studio/backend/tests/test_diffusion_pipeline_prequant.pyindex 5c98bc6d75d..bce11404af5 100644--- a/studio/backend/tests/test_diffusion_pipeline_prequant.py+++ b/studio/backend/tests/test_diffusion_pipeline_prequant.py@@ -22,6 +22,7 @@ from core.inference.diffusion_denoiser_prequant import PIPELINE_SEED_DECLINEDfrom core.inference.diffusion_device import DiffusionDeviceTargetfrom core.inference.diffusion_families import detect_family_for_pickfrom core.inference.diffusion_memory import DeviceMemory+from models.inference import DiffusionDownloadPlanResponseMIB = 1024 * 1024@@ -211,7 +212,7 @@ def test_the_plan_counts_and_stages_the_hosted_checkpoint(monkeypatch, hub):assert "transformer/config.json" in entries[Z_IMAGE_REPO]["files"]assert plan["required_bytes"] == ALL_BYTES - DENOISER_BYTES + PREQUANT_BYTESassert entries[Z_IMAGE_REPO]["checkpoint"] is True- assert entries[PREQUANT_REPO]["checkpoint"] is False+ assert entries[PREQUANT_REPO]["checkpoint"] is Truedef test_an_unplanned_pipeline_pick_plans_exactly_as_before(monkeypatch, hub):@@ -1958,3 +1959,28 @@ def test_a_large_variant_of_a_small_dit_family_quantises_under_auto(fake_runtime_load(backend, _pipeline_prequant_planned = None, _pipeline_prequant_skipped = ())assert Z_IMAGE_REPO in seen # the load hands the decider its resolved baseassert spy.quantised == ["auto"]++[email protected]("shared_repo", [False, True])+def test_denoiser_is_a_checkpoint_and_encoder_only_is_an_asset(monkeypatch, hub, shared_repo):+ backend = _plan_backend(monkeypatch, planned = "fp8")+ encoder_repo = PREQUANT_REPO if shared_repo else "test/shared-encoder"+ monkeypatch.setattr(+ DiffusionBackend,+ "_te_prequant_plan_files",+ lambda *_a, **_k: {+ "text_encoder": (encoder_repo, [("text_encoder/model.safetensors", 1234)])+ },+ )+ plan = backend.download_plan(Z_IMAGE_REPO, model_kind = "pipeline")+ entries = {entry["repo_id"]: entry for entry in plan["entries"]}+ assert entries[PREQUANT_REPO]["checkpoint"] is True+ assert entries[PREQUANT_REPO]["hosted_denoiser"] is True+ assert entries[Z_IMAGE_REPO]["hosted_denoiser"] is False+ # The route returns this model, which would drop an undeclared field.+ served = DiffusionDownloadPlanResponse(**plan).entries+ assert {e.repo_id for e in served if e.hosted_denoiser} == {PREQUANT_REPO}+ assert entries[encoder_repo]["checkpoint"] is shared_repo+ assert entries[encoder_repo]["hosted_denoiser"] is shared_repo+ assert "text_encoder/model.safetensors" in entries[encoder_repo]["files"]+ assert entries[PREQUANT_REPO]["bytes"] == PREQUANT_BYTES + (1234 if shared_repo else 0)diff --git a/studio/frontend/src/features/images/api.ts b/studio/frontend/src/features/images/api.tsindex ced87ea63ed..05bce080484 100644--- a/studio/frontend/src/features/images/api.ts+++ b/studio/frontend/src/features/images/api.ts@@ -448,6 +448,7 @@ export interface DiffusionDownloadPlan {gguf_filename: string | null;/** Only the planner knows: a gated pick is staged from an ungated mirror under another repo id. */checkpoint?: boolean;+ hosted_denoiser?: boolean;}[];total_bytes: number;required_bytes?: number;diff --git a/studio/frontend/src/lib/diffusion-pipeline-load-target.ts b/studio/frontend/src/lib/diffusion-pipeline-load-target.tsindex 3482e2b9438..d1bc9a71939 100644--- a/studio/frontend/src/lib/diffusion-pipeline-load-target.ts+++ b/studio/frontend/src/lib/diffusion-pipeline-load-target.ts@@ -14,7 +14,7 @@ export function diffusionPipelineLoadTarget(: { repoId: model, source: meta.source, onDevice: meta.source === "local" };}-/** A pinned snapshot is already on disk (and its revision may move), so only companions download. */+/** A pinned snapshot is already on disk (and its revision may move), so only companions and a hosted denoiser, which it lacks, download. */export function diffusionStagingEntries(entries: readonly {repo_id: string;@@ -22,6 +22,7 @@ export function diffusionStagingEntries(bytes: number;gguf_filename: string | null;checkpoint?: boolean;+ hosted_denoiser?: boolean;}[],repoId: string,opts: { filename?: string; displayRepoId?: string },@@ -36,6 +37,7 @@ export function diffusionStagingEntries(// `??`: false is an answer; the fallback is only for older backends.checkpoint:e.checkpoint ?? (opts.filename ? e.files.includes(opts.filename) : e.repo_id === planRepoId),+ hostedDenoiser: e.hosted_denoiser,}))- .filter((e) => planRepoId === repoId || !e.checkpoint);+ .filter((e) => planRepoId === repoId || !e.checkpoint || e.hostedDenoiser);}diff --git a/studio/frontend/tests/family-override.test.ts b/studio/frontend/tests/family-override.test.tsindex 888b49d778f..8e3af4f3b7e 100644--- a/studio/frontend/tests/family-override.test.ts+++ b/studio/frontend/tests/family-override.test.ts@@ -102,6 +102,15 @@ test("a pinned cache snapshot loads by path, plans by its Hub id, and stages onldiffusionStagingEntries(plan, "MiniMaxAI/MiniMax-H3", {}).map((e) => [e.repoId, e.checkpoint]),[["MiniMaxAI/MiniMax-H3", true], ["external/quant", false]],);++ const withDenoiser = [+ { ...entry("MiniMaxAI/MiniMax-H3", true), hosted_denoiser: false },+ { ...entry("unsloth/fp8", true), hosted_denoiser: true },+ ];+ assert.deepEqual(+ diffusionStagingEntries(withDenoiser, pinned.repoId, { displayRepoId: pinned.displayRepoId }).map((e) => [e.repoId, e.checkpoint]),+ [["unsloth/fp8", true]],+ );});for (const page of ["features/images/images-page.tsx", "features/video/video-page.tsx"]) {