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: download all GGUF shards for split models (e.g. 7B Q8_0)
Roland Tannousc2dd0f4cf1d1
diff --git a/studio/backend/core/inference/llama_cpp.py b/studio/backend/core/inference/llama_cpp.pyindex 37a57e4c397..b394284532b 100644--- a/studio/backend/core/inference/llama_cpp.py+++ b/studio/backend/core/inference/llama_cpp.py@@ -249,17 +249,22 @@ class LlamaCppBackend:)# Determine the filename from the variant (e.g., "Q4_K_M" -> find matching file)+ # For split GGUFs (e.g., *-00001-of-00003.gguf) we must download ALL shards.gguf_filename = None+ gguf_extra_shards: list[str] = []if hf_variant:# Try common naming patternstry:from huggingface_hub import list_repo_filesfiles = list_repo_files(hf_repo, token=hf_token)variant_lower = hf_variant.lower()- for f in files:- if f.endswith(".gguf") and variant_lower in f.lower():- gguf_filename = f- break+ matching = sorted(+ f for f in files+ if f.endswith(".gguf") and variant_lower in f.lower()+ )+ if matching:+ gguf_filename = matching[0] # first shard (or single file)+ gguf_extra_shards = matching[1:] # remaining shards if splitexcept Exception as e:logger.warning(f"Could not list repo files: {e}")@@ -269,13 +274,23 @@ class LlamaCppBackend:repo_name = hf_repo.split("/")[-1].replace("-GGUF", "")gguf_filename = f"{repo_name}-{hf_variant}.gguf"- logger.info(f"Downloading GGUF: {hf_repo}/{gguf_filename}")+ logger.info(f"Downloading GGUF: {hf_repo}/{gguf_filename}"+ + (f" (+{len(gguf_extra_shards)} shards)" if gguf_extra_shards else ""))try:local_path = hf_hub_download(repo_id=hf_repo,filename=gguf_filename,token=hf_token,)+ # Download remaining shards for split GGUFs — llama-server+ # auto-discovers them when they are in the same directory.+ for shard in gguf_extra_shards:+ logger.info(f"Downloading GGUF shard: {shard}")+ hf_hub_download(+ repo_id=hf_repo,+ filename=shard,+ token=hf_token,+ )except Exception as e:raise RuntimeError(f"Failed to download GGUF file '{gguf_filename}' from {hf_repo}: {e}"diff --git a/studio/backend/utils/datasets/llm_assist.py b/studio/backend/utils/datasets/llm_assist.pyindex 7ac25272fcb..d72d57232de 100644--- a/studio/backend/utils/datasets/llm_assist.py+++ b/studio/backend/utils/datasets/llm_assist.py@@ -47,17 +47,19 @@ def precache_helper_gguf():files = api.list_repo_files(repo, repo_type="model")gguf_files = [f for f in files if f.endswith(".gguf")]- target = None+ # Find all GGUF files matching the variant (may be split into shards)variant_lower = variant.lower().replace("-", "_")- for f in gguf_files:- if variant_lower in f.lower().replace("-", "_"):- target = f- break-- if target:- logger.info(f"Pre-caching helper GGUF: {repo}/{target}")- hf_hub_download(repo_id=repo, filename=target)- logger.info(f"Helper GGUF cached: {target}")+ matching = sorted(+ f for f in gguf_files+ if variant_lower in f.lower().replace("-", "_")+ )++ if matching:+ logger.info(f"Pre-caching helper GGUF: {repo}/{matching[0]}"+ + (f" (+{len(matching) - 1} shards)" if len(matching) > 1 else ""))+ for target in matching:+ hf_hub_download(repo_id=repo, filename=target)+ logger.info(f"Helper GGUF cached: {len(matching)} file(s)")else:logger.warning(f"No GGUF matching variant '{variant}' in {repo}")except Exception as e: