Skip to content

fix(studio): reject standalone GGUF adapters before model teardown - #15421

Merged
oobabooga merged 5 commits into
unslothai:mainfrom
Aafimalek:fix/issue-15412-gguf-adapter-preflight
Oct 28, 2026
Merged

oobabooga merged 5 commits into
unslothai:mainfrom
Aafimalek:fix/issue-15412-gguf-adapter-preflight

Conversation

@Aafimalek

@Aafimalek Aafimalek commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

A GGUF LoRA adapter can declare a chat architecture while containing only weight deltas. Studio's existing non-chat preflight currently accepts it, so a standalone load can download the adapter and tear down the resident model before llama-server reports missing model metadata.

Record general.type in the existing header read and reject adapters through the existing preflight. The error explains that a matching base model is required. Reset the type between reads, and keep complete merged LoRA models loadable regardless of their filenames. No new networking, dependency or filename heuristic is introduced.

Related to #15412, specifically the DeepSeek-V4.1-Flash-1017-Uncensored-LoRA.gguf failure in Error 1. The publisher identifies this file as an adapter. This PR does not claim to resolve every error in that report. Approach coordinated before implementation.

Validation on Windows, Python 3.12.5:

  • Reproduced using the actual public file's 256 KiB header through Studio's real parser/preflight: general.type=adapter, no context length, and no refusal before the fix. The same header now receives the base-model explanation.
  • Three new assertions failed before the fix; ordinary merged-model controls passed. All 109 local/remote preflight tests now pass, including actual load_model coverage proving neither teardown nor weight download occurs for a rejected adapter.
  • Wider metadata/cache/load selection: 599 passed, 2 failed, 2 skipped. The /usr/bin/true load test fails identically on the exact unchanged base because that executable is unavailable on Windows. The other failure was a 0.55-second timing bound under parallel load; serial replay passes on both base and branch. Each replay gives 1 passed and the same executable-related failure. Skips concern optional diffusers and unavailable filesystem permission behavior.
  • Python Ruff, the pinned repository formatter and diff whitespace checks pass.

The parser, guard and load method are real; tests isolate existing network/process boundaries. No GPU inference, applying the adapter to its base model or large-model hardware compatibility is claimed.

@oobabooga

Copy link
Copy Markdown
Member

Reached Codex review convergence at oobabooga#423.

@oobabooga

Copy link
Copy Markdown
Member

Thanks @Aafimalek. This fixes the adapter failure behind Error 1 in #15412. Studio offers lora/DeepSeek-V4.1-Flash-1017-Uncensored-LoRA.gguf as a regular variant (460 MB, the smallest), and because it declares a chat architecture with general.type = adapter, the preflight passed it and the load could unload the resident model before llama-server failed. _non_chat_gguf_refusal now refuses adapters from the header instead.

I ran the first 30 MB of 234 GGUFs from 229 Hugging Face repos through the preflight on main and on this branch. All 96 adapters (15 architectures) are now refused, where main refused none, and none of the 137 full models are, including 112 with "lora" or "adapter" in the name. One adapter, mgonzs13/adapter-phi-3-mini-mental-health-GGUF, has metadata larger than the 256 KiB remote probe, so I pushed 8112185d45 to check the type before the incomplete-header gate. I also pushed 55858fdba4 to fix the audio refusal test the first commit broke. The audio and preflight tests pass (269).

CI is clear at oobabooga#423 at 2abb3031e6; the last commit only moves the adapter check.

Errors 2 and 3 in #15412 are separate, and hiding adapters from the variant list can be a follow-up.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants