Skip to content

Studio: fix loading split GGUFs from the local HF cache - #7273

Merged
danielhanchen merged 2 commits into
unslothai:mainfrom
oobabooga:worktree-split-gguf-symlink-load
Jul 21, 2026
Merged

danielhanchen merged 2 commits into
unslothai:mainfrom
oobabooga:worktree-split-gguf-symlink-load

Conversation

@oobabooga

Copy link
Copy Markdown
Member

Loading a split (multi-part) GGUF through the local path branch fails with a 500:

llama_model_load: error loading model: invalid split file name: .../models--unsloth--Qwen3.6-27B-MTP-GGUF/blobs/6a7509cf1119...

The easiest way to hit it is the OpenAI API auto-switch reload of a split variant, e.g. the BF16 of unsloth/Qwen3.6-27B-MTP-GGUF. Loading the same model by repo id works.

Root cause

_find_local_gguf_by_variant and detect_gguf_model return str(path.resolve()). HF cache snapshot files are symlinks into blobs/<sha256>, so resolve() swaps the shard name for a hash. llama.cpp derives the sibling shards of a split GGUF from the -00001-of-000NN suffix, so the load is rejected before it starts.

Fix

Return str(path.absolute()) instead, keeping the symlink name. The direct-file case in detect_gguf_model already does this, and path comparisons elsewhere resolve both sides, so nothing relied on getting the blob path.

Verification

  • Reproduced live with a two-shard GGUF laid out HF-cache style (blobs plus snapshot symlinks): /api/inference/load returned 500 before the fix with llama-server receiving the blob path, and 200 after, with /v1/chat/completions replying normally.
  • Two new regression tests build the same layout and assert the shard name survives resolution. Both fail before the fix.
  • tests/test_offline_gguf_cache_fallback.py, tests/test_gguf_routing.py, tests/test_mtp_drafter_companion.py all pass.

@oobabooga
oobabooga requested a review from danielhanchen as a code owner July 20, 2026 22:56

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates detect_gguf_model and _find_local_gguf_by_variant to use .absolute() instead of .resolve() to preserve symlink names, ensuring llama.cpp can find sibling split-GGUF shards. It also adds corresponding tests. The feedback suggests wrapping the symlink_to calls in the new tests with try-except blocks to gracefully skip them on platforms like Windows where symlink creation might fail due to restricted privileges.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread studio/backend/tests/test_offline_gguf_cache_fallback.py Outdated
Comment thread studio/backend/tests/test_offline_gguf_cache_fallback.py Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 45f687e0fb

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread studio/backend/utils/models/model_config.py Outdated
Comment thread studio/backend/utils/models/model_config.py Outdated
@oobabooga

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

Reviewed commit: aba292b15b

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants