diff --git a/studio/frontend/src/features/hub/hub-page.tsx b/studio/frontend/src/features/hub/hub-page.tsx index ee310f6e62..bf20d68037 100644 --- a/studio/frontend/src/features/hub/hub-page.tsx +++ b/studio/frontend/src/features/hub/hub-page.tsx @@ -1446,6 +1446,14 @@ export function ModelsPage() { // can show the live launch config. A GGUF loaded from an inactive HF cache or // straight off disk loads by path but is reported by its clean public id, so the // row's path and its settings identity both have to be offered as aliases. + // A loose .gguf is one file, so its path already names the quant and its + // settings deliberately carry no variant. The loader still derives one from the + // filename and /status reports it, so requiring the two to agree would never + // hold and the page would withhold the live config from the resident file. + const settingsTargetIsStandaloneFile = + settingsTarget !== null && + settingsTarget.ggufVariant == null && + settingsTarget.id.toLowerCase().endsWith(".gguf"); const settingsTargetIsResident = settingsTarget !== null && residentModelIdMatches( @@ -1453,7 +1461,8 @@ export function ModelsPage() { settingsTarget.id, settingsTarget.configId, ) && - ggufVariantsMatch(activeGgufVariant, settingsTarget.ggufVariant); + (settingsTargetIsStandaloneFile || + ggufVariantsMatch(activeGgufVariant, settingsTarget.ggufVariant)); const handleSearchHub = useCallback( (next: string) => { const trimmed = next.trim(); diff --git a/tests/studio/test_model_picker_contracts.py b/tests/studio/test_model_picker_contracts.py index 13a722d3b1..69f42ea7dc 100644 --- a/tests/studio/test_model_picker_contracts.py +++ b/tests/studio/test_model_picker_contracts.py @@ -1047,3 +1047,24 @@ def test_a_standalone_gguf_has_one_settings_key(): # The rule this mirrors: a variant is derived only for a single scanned file. assert "extract_quant_label(gguf_files[0].name)" in common assert "if scan_path.is_file() and len(gguf_files) == 1" in common + + +def test_a_standalone_gguf_is_resident_despite_its_derived_quant(): + """A loose .gguf keys its settings by the bare path with no variant, but the + loader derives one from the filename (llama_cpp sets _hf_variant from + _extract_quant_label) and /status reports it, so an equality between the two + could never hold and the settings page withheld the live launch config from + the very file that was loaded.""" + hub = " ".join(_read("features/hub/hub-page.tsx").split()) + assert "const settingsTargetIsStandaloneFile =" in hub + assert 'settingsTarget.id.toLowerCase().endsWith(".gguf")' in hub + assert ( + "(settingsTargetIsStandaloneFile || ggufVariantsMatch(activeGgufVariant, settingsTarget.ggufVariant))" + in hub + ) + backend = ( + WORKDIR / "studio" / "backend" / "core" / "inference" / "llama_cpp.py" + ).read_text(encoding = "utf-8") + assert "self._hf_variant = _extract_quant_label(gguf_path)" in backend, ( + "the derived label this accounts for" + )