[GGUF] Add config fallback and Gemma4/Qwen3.5 mappings - #44905
Closed
lesj0610 wants to merge 13 commits into
Closed
Conversation
lesj0610
marked this pull request as ready for review
June 8, 2026 17:10
lesj0610
requested review from
22quinn,
AndreasKaratzas,
DarkLight1337,
ProExpertProg,
WoosukKwon,
hmellor,
houseroad,
mgoin,
njhill,
robertgshaw2-redhat,
sighingnow,
tlrmchlsmth,
vadiklyutiy,
yewentao256,
youkaichao and
ywang96
as code owners
June 8, 2026 17:10
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 839977c464
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
lesj0610
force-pushed
the
lesj/gguf-generic-support-20260608
branch
from
June 8, 2026 18:58
7f13259 to
7eacc4b
Compare
DarkLight1337
requested review from
Isotr0py
and removed request for
22quinn and
ProExpertProg
June 9, 2026 02:20
Signed-off-by: lesj0610 <lesj0610@users.noreply.github.com>
Signed-off-by: lesj0610 <lesj0610@users.noreply.github.com>
Signed-off-by: lesj0610 <lesj0610@users.noreply.github.com>
Signed-off-by: lesj0610 <lesj0610@users.noreply.github.com>
Signed-off-by: lesj0610 <lesj0610@users.noreply.github.com>
Signed-off-by: lesj0610 <lesj0610@users.noreply.github.com>
lesj0610
force-pushed
the
lesj/gguf-generic-support-20260608
branch
from
June 9, 2026 03:24
7eacc4b to
d353f94
Compare
Signed-off-by: lesj0610 <lesj0610@users.noreply.github.com>
Signed-off-by: lesj0610 <lesj0610@users.noreply.github.com>
Signed-off-by: lesj0610 <lesj0610@users.noreply.github.com>
Signed-off-by: lesj0610 <lesj0610@users.noreply.github.com>
Signed-off-by: lesj0610 <lesj0610@users.noreply.github.com>
Signed-off-by: lesj0610 <lesj0610@users.noreply.github.com>
Member
|
We're migrating the GGUF support to OOT plugin (https://github.com/vllm-project/vllm-gguf-plugin), can you open a PR there instead? |
Signed-off-by: lesj0610 <lesj0610@users.noreply.github.com>
Contributor
Author
|
@Isotr0py I moved GGUF-specific parts to plugin repo as suggested. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
This PR adds generic GGUF config resolution and architecture-specific tensor mappings for Gemma4 and Qwen3.5, so that GGUF quantizations of these models can be loaded without manual
--hf-config-pathworkarounds.Most GGUF repos (e.g., Unsloth quantizations) ship only quantized weights — no
config.json, no sidecar tokenizer files. Previously, remote GGUF repos withoutconfig.jsonhit a hardValueError. This PR resolves that by falling back to the original HF base model referenced in the GGUF repo's model card or local GGUF metadata for config loading, while keeping the default tokenizer on the GGUF file so Transformers can read the embedded GGUF tokenizer/vocab.This PR has three logical sections that can be reviewed independently.
Section 1: Generic GGUF config resolver and embedded tokenizer handling
Files:
gguf_utils.py,config.py,model.py,arg_utils.py,registry.pyAdds
resolve_gguf_config_source()which resolves where a GGUF model should load its HF config from. The fallback chain is:config.json)base_model(remote) or GGUF metadatageneral.base_model.*.repo_url(local)Both
get_config()andmaybe_override_with_speculators()now use the same fallback chain for local and remote GGUF. The previous hardValueErrorfor remote GGUF withoutconfig.jsonis removed.For tokenizer loading, the default tokenizer remains the GGUF model path/repo. This preserves the existing Transformers
gguf_filepath and lets Transformers read the embedded GGUF tokenizer/vocab. Users can still pass an explicit--tokenizerwhen they intentionally want a sidecar or base-model tokenizer.MTP / speculative decoding models that ship as separate GGUF files (e.g., Qwen3.6-35B-A3B-MTP) also go through
maybe_override_with_speculators()for config detection. Thehf_config_pathis now forwarded to that function so that explicit user overrides are respected, and the same base model fallback applies when the MTP GGUF repo lacksconfig.json.When the resolver falls back to a base model, the GGUF repo's
revisionis not forwarded to the base model lookup, since GGUF repo revisions have no meaning for the original HF model.Implicit GGUF metadata redirects also do not inherit
trust_remote_code. A warning is logged when the fallback is used; users who intentionally trust remote code from the base repository can pass an explicit--hf-config-path.Section 2: Gemma4 GGUF architecture adapter
Files:
gguf_loader.py,gemma4.py,gemma4_mm.pyAdds Gemma4-specific GGUF tensor name mappings that
gguf-py'sget_tensor_name_map()does not yet cover:v.blk.N.*→model.vision_tower.encoder.layers.N.*(13 tensor types per layer)v.std_bias,v.std_scale,v.patch_embd.weight,v.position_embd.weightmm.input_projection.weight→model.embed_vision.embedding_projection.weightffn_gate_up_exps.weight,ffn_down_exps.weight→ fused expert loader targetsffn_gate_inp.scale,ffn_down_exps.scale,layer_output_scale.weightGemma4 patch embedder weight (GGUF 4D Conv2D → vLLM 2D Linear) is handled via a model-level
weight_loaderattribute onvision_tower.patch_embedder.input_proj.weight, following the same pattern as Qwen3 VL's patch embed loader. No loader-level model-specific transforms.Gemma4 fused MoE
qweight_typefor GGUF is routed to the correct expert parameter ingemma4.py.Section 3: Qwen3.5 GGUF adapter
Files:
gguf_loader.py,qwen3_5.py,qwen3_vl.pyqwen3_5_moeto the GGUF architecture alias map (qwen3_5_moe→qwen35moe).model.language_model.layersinstead ofmodel.layers.ssm_dt.bias→linear_attn.dt_biasmapping for Qwen3.5 GDN linear attention layers.mm.0/2.weight/bias).qwen3_5.pyforMergedColumnParallelLinearlayers (e.g.,in_proj_qkvz) that receive fused GGUF tensors with tupleshard_id. The splitter respectspacked_factorand falls back to the existingweight_loaderif conditions are not met.weight_loaderfor Qwen3 VL that handles GGUF 4D Conv2D → HF 5D Conv3D with temporal dimension expansion.Test Plan
Test Result
Local GGUF config resolution verified for:
Notes:
gguf-pyadds native Gemma4 support. They are isolated in_add_gemma4_gguf_mappings()for easy removal.AI assistance: Codex, Claude, and Gemini.
Essential Elements of an Effective PR Description Checklist
supported_models.mdandexamplesfor a new model.