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: keep a cached quant On Device when only its companion is missing (#11236)
oobaboogab1b664e52ea4
diff --git a/studio/backend/hub/services/models/gguf_variants.py b/studio/backend/hub/services/models/gguf_variants.pyindex 6524c1b7e56..7fc3f754f46 100644--- a/studio/backend/hub/services/models/gguf_variants.py+++ b/studio/backend/hub/services/models/gguf_variants.py@@ -1728,6 +1728,29 @@ async def get_gguf_variants_answer(),)+ # A complete main with an unstarted companion has no partial signal. Keep it visible+ # unless the existing readiness check says it can load.+ for variant in partial_scan_variants:+ if variant.quant in partial_quants:+ continue+ requirement = requirements_by_quant.get(variant.quant.lower())+ if requirement is None or _is_fully_downloaded(variant):+ continue+ if not (+ _filenames_cached(requirement.main_filenames, requirement.main_size_bytes)+ or _quant_and_companions_ready(variant.quant.lower(), variant.size_bytes, ())+ ):+ continue+ partial_quants.add(variant.quant)+ partial_quant_transports.setdefault(+ variant.quant,+ _partial_transport_for_variant(+ repo_id,+ variant.quant,+ repo_cache_dir,+ ),+ )+local_blobs_by_quant = (_local_main_gguf_blobs_by_quant(repo_id, repo_cache_dir)if cache_reads_authorizeddiff --git a/studio/backend/hub/tests/test_model_services.py b/studio/backend/hub/tests/test_model_services.pyindex 19fe3ed327a..6be4399eff5 100644--- a/studio/backend/hub/tests/test_model_services.py+++ b/studio/backend/hub/tests/test_model_services.py@@ -4466,7 +4466,8 @@ def test_cached_flash_next_quant_needs_managed_mtp_before_it_is_downloaded(assert before.dependencies_resolved is Trueassert before.variants[0].downloaded is Falseassert before.variants[0].download_size_bytes == (130 if "projector" in cache_case else 120)- assert before.variants[0].partial is (cache_case == "partial-mtp")+ # Every case has complete weights but lacks its planned drafter.+ assert before.variants[0].partial is Trueif cache_case in {"alternate-projector", "stale-main"}:assert before.variants[0].pending_drafter_filename is Noneassert before.variants[0].pending_drafter_size_bytes == 0@@ -4488,6 +4489,86 @@ def test_cached_flash_next_quant_needs_managed_mtp_before_it_is_downloaded(assert after.variants[0].pending_drafter_size_bytes == 0+def test_a_cached_quant_missing_only_its_projector_stays_listed(monkeypatch, tmp_path):+ """Keep cached weights visible when their required projector is missing."""+ with gguf_variants._VARIANT_HASH_LOCK:+ gguf_variants._VARIANT_REQUIREMENT_CACHE.clear()++ async def _run_inline(fn, *args, **kwargs):+ return fn(*args, **kwargs)++ repo_id = "Org/Vision-GGUF"+ repo_dir = tmp_path / "cache" / "models--Org--Vision-GGUF"+ snapshot = repo_dir / "snapshots" / "rev0"+ snapshot.mkdir(parents = True)+ (snapshot / "Model-UD-Q4_K_XL.gguf").write_bytes(b"m" * 100)+ # Mirror the blob store so pricing credits the cached weights.+ (repo_dir / "blobs").mkdir()+ (repo_dir / "blobs" / "q4").write_bytes(b"m" * 100)+ siblings = [+ _sibling("Model-UD-Q4_K_XL.gguf", 100, "q4"),+ _sibling("Model-Q8_0.gguf", 200, "q8"),+ _sibling("mmproj-F16.gguf", 10, "projector"),+ ]++ monkeypatch.setattr(state_dir, "cache_root", lambda: tmp_path / "state")+ monkeypatch.setattr(gguf_variants.asyncio, "to_thread", _run_inline)+ monkeypatch.setattr(gguf_variants, "_local_main_gguf_blobs_by_quant", lambda *_args: {})+ monkeypatch.setattr(+ gguf_variants,+ "list_gguf_variants",+ lambda *_args, **_kwargs: (+ [+ SimpleNamespace(+ filename = "Model-UD-Q4_K_XL.gguf",+ quant = "UD-Q4_K_XL",+ display_label = None,+ size_bytes = 100,+ ),+ SimpleNamespace(+ filename = "Model-Q8_0.gguf",+ quant = "Q8_0",+ display_label = None,+ size_bytes = 200,+ ),+ ],+ True,+ siblings,+ ),+ )+ monkeypatch.setattr(+ gguf_variants.download_registry,+ "incomplete_blob_hashes",+ lambda *_args, **_kwargs: set(),+ )++ # The picker pins cached Hub rows to a snapshot.+ listed = asyncio.run(+ gguf_variants.get_gguf_variants_response(repo_id, local_path = str(snapshot))+ )+ before = {v.quant: v for v in listed.variants}++ assert before["UD-Q4_K_XL"].downloaded is False+ assert before["UD-Q4_K_XL"].partial is True+ assert before["UD-Q4_K_XL"].download_size_bytes == 110+ assert before["UD-Q4_K_XL"].download_remaining_bytes == 10+ assert before["Q8_0"].downloaded is False+ assert before["Q8_0"].partial is False+ # Match the picker's On Device filter.+ assert [q for q, v in before.items() if v.downloaded or v.partial] == ["UD-Q4_K_XL"]++ (snapshot / "mmproj-F16.gguf").write_bytes(b"p" * 10)+ (repo_dir / "blobs" / "projector").write_bytes(b"p" * 10)+ relisted = asyncio.run(+ gguf_variants.get_gguf_variants_response(repo_id, local_path = str(snapshot))+ )+ after = {v.quant: v for v in relisted.variants}++ assert after["UD-Q4_K_XL"].downloaded is True+ assert after["UD-Q4_K_XL"].partial is False+ assert after["Q8_0"].partial is False++def test_download_registry_repo_keys_are_case_insensitive():registry = download_registry.DownloadRegistry()