Skip to content

Commit 43896fa

Browse files
authored
Add deferred multimodal GGUF architecture cohort (#598)
## Summary - audit the 11 remaining VLM-specific text architectures from llama.cpp SHA `8d9af256337d1a501250f9bbf4c0859a654bddd6` - register explicit pre-config deferrals for unsupported text-only and paired text+mmproj paths without changing projector support verdicts - pin suffix-exact loader unions, custom quant-sidecar ownership, converter provenance, and exact companion target identities - add fail-closed registry, tensor-closure, pairing, header/preflight, builder, and generated documentation coverage ## Validation - `python -m pytest src/mobius/integrations/gguf tests/gguf_test.py -q --tb=short` — 2046 passed - `python -m pytest tests/build_graph_test.py tests/cli_test.py src/ -q -k "not phi4mm and not apply_weights_unknown and not glm_moe_dsa" --tb=short -n auto` — 6474 passed, 52 skipped - `lintrunner f --output oneline --all-files` - `lintrunner --output oneline --all-files` - two independent full-diff reviews — clean ## Stack Targets `justinchuby-add-remaining-moe-gguf` / PR #597. Signed-off-by: Justin Chu <[email protected]> Copilot-Session: 3360a853-8f08-4350-ae5e-cec390516475
1 parent c546d50 commit 43896fa

9 files changed

Lines changed: 673 additions & 25 deletions

File tree

‎docs/api/build_from_gguf.md‎

Lines changed: 82 additions & 14 deletions
Large diffs are not rendered by default.

‎src/mobius/integrations/gguf/_arch_registry.py‎

Lines changed: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,84 @@
150150
"the FFN norm with softmax/SwiGLU experts and has no matching per-layer RoPE schedule."
151151
)
152152

153+
_CHAMELEON_GGUF_GRAPH_REASON = (
154+
"The pinned Chameleon converter deliberately omits the VQ image tokenizer while the "
155+
"text graph still requires bias-bearing Q/K norms, an additional swin_norm, and "
156+
"image-vocabulary logit suppression. Mobius's similarly named Hugging Face VLM graph "
157+
"does not prove that text-only GGUF contract, and full multimodal generation cannot be "
158+
"reconstructed from the serialized file."
159+
)
160+
161+
_COGVLM_GGUF_GRAPH_REASON = (
162+
"The pinned CogVLM text graph has modality-routed visual-expert Q/K/V/output and FFN "
163+
"banks in addition to the language projections. Its required cogvlm clip sidecar and "
164+
"feature-selection contract are also deferred, so aliasing a generic LLaVA or Llama "
165+
"graph would drop model-owned tensors and build the wrong package."
166+
)
167+
168+
_DEEPSEEK2_OCR_GGUF_GRAPH_REASON = (
169+
"DeepSeek-OCR2 is a paired text-plus-vision package, not a generic DeepSeek text model. "
170+
"The text loader, deepseekocr/deepseekocr2 clip sidecars, SAM/projector stages, special "
171+
"token mixing, and cache contract have no single suffix-exact Mobius ownership map. "
172+
"Existing Hugging Face components therefore cannot justify partial GGUF construction."
173+
)
174+
175+
_GEMMA3N_GGUF_GRAPH_REASON = (
176+
"Gemma3n GGUF is the text member of a vision-and-audio package whose gemma3nv and "
177+
"gemma3na clip companions carry distinct encoders and projectors. The text graph's "
178+
"per-layer embeddings, multimodal token replacement, processor assumptions, and package "
179+
"roles have not been validated against those pinned sidecar ABIs."
180+
)
181+
182+
_HUNYUAN_VL_GGUF_GRAPH_REASON = (
183+
"The pinned Hunyuan-VL decoder uses its own M-RoPE and Q/K-normalized text contract and "
184+
"pairs with a hunyuanvl clip sidecar. Mobius's Hunyuan-VL-MoT registration is a different "
185+
"dual-path architecture, so neither it nor the dense Hunyuan text model is a valid alias."
186+
)
187+
188+
_LLAMA4_GGUF_GRAPH_REASON = (
189+
"Llama4 GGUF is the text member of a paired multimodal package and may contain routed "
190+
"experts and architecture-specific cross-modal layer scheduling. The llama4 clip vision "
191+
"tower, token mixing, position IDs, and package ABI remain deferred; text-backbone "
192+
"similarity is not evidence that the complete GGUF tensor closure is owned."
193+
)
194+
195+
_MISTRAL3_GGUF_GRAPH_REASON = (
196+
"The pinned Mistral3 loader selects dense or routed-expert text blocks from metadata and "
197+
"applies architecture-specific output temperature scaling. A VLM package additionally "
198+
"requires the deferred Pixtral clip sidecar and exact patch/merge/token contract. The "
199+
"existing Hugging Face Mistral3 graph does not cover that conditional GGUF closure."
200+
)
201+
202+
_PADDLEOCR_GGUF_GRAPH_REASON = (
203+
"PaddleOCR-VL uses an ERNIE-derived GGUF loader with an optional bias on attention output "
204+
"closure and a required paddleocr clip vision/projector sidecar. Its processor ranks, "
205+
"image-token counts, offsets, and package identity have no pinned Mobius GGUF parity "
206+
"evidence, so it cannot be accepted as an ordinary Qwen2 text file."
207+
)
208+
209+
_QWEN2VL_GGUF_GRAPH_REASON = (
210+
"The qwen2vl architecture is shared by Qwen2-VL, Qwen2.5-VL, and Qwen2.5-Omni converter "
211+
"paths whose clip companions use different projector strings and modalities. Exact "
212+
"M-RoPE sections, special tokens, merger dimensions, processor ordering, and target "
213+
"identity must select one complete package; a generic Qwen2 alias would erase those "
214+
"distinctions."
215+
)
216+
217+
_QWEN3VL_GGUF_GRAPH_REASON = (
218+
"Qwen3-VL text GGUF requires multimodal position IDs and an exact qwen3vl_merger clip "
219+
"companion, including deep-stack vision features and architecture-specific token "
220+
"placement. The existing Hugging Face text graph alone does not establish sidecar tensor "
221+
"closure, processor parity, or a safe text-only fallback."
222+
)
223+
224+
_QWEN3VLMOE_GGUF_GRAPH_REASON = (
225+
"Qwen3-VL-MoE combines the Qwen3-VL multimodal position/token contract and merger "
226+
"sidecar with routed experts in the text backbone. Generic Qwen3-MoE tensor similarity "
227+
"does not cover the paired vision package, expert sidecars, effective tied head "
228+
"ownership, or multimodal cache ABI."
229+
)
230+
153231
_MINICPM3_GRAPH_REASON = (
154232
"The pinned MiniCPM3 graph uses MLA Q/KV LoRA projections, separate NoPE/RoPE "
155233
"query and key channels, and embedding, residual, and LM-head scales. The current "
@@ -961,6 +1039,95 @@
9611039
runtime=Support.DEFERRED,
9621040
reason=_SMALLTHINKER_GGUF_GRAPH_REASON,
9631041
),
1042+
# ------------------------------ Remaining multimodal text backbones (audited/deferred)
1043+
GGUFArchitectureSpec(
1044+
gguf_arch="chameleon",
1045+
config=Support.DEFERRED,
1046+
tensor_map=Support.DEFERRED,
1047+
graph=Support.DEFERRED,
1048+
runtime=Support.DEFERRED,
1049+
reason=_CHAMELEON_GGUF_GRAPH_REASON,
1050+
),
1051+
GGUFArchitectureSpec(
1052+
gguf_arch="cogvlm",
1053+
config=Support.DEFERRED,
1054+
tensor_map=Support.DEFERRED,
1055+
graph=Support.DEFERRED,
1056+
runtime=Support.DEFERRED,
1057+
reason=_COGVLM_GGUF_GRAPH_REASON,
1058+
),
1059+
GGUFArchitectureSpec(
1060+
gguf_arch="deepseek2-ocr",
1061+
config=Support.DEFERRED,
1062+
tensor_map=Support.DEFERRED,
1063+
graph=Support.DEFERRED,
1064+
runtime=Support.DEFERRED,
1065+
reason=_DEEPSEEK2_OCR_GGUF_GRAPH_REASON,
1066+
),
1067+
GGUFArchitectureSpec(
1068+
gguf_arch="gemma3n",
1069+
config=Support.DEFERRED,
1070+
tensor_map=Support.DEFERRED,
1071+
graph=Support.DEFERRED,
1072+
runtime=Support.DEFERRED,
1073+
reason=_GEMMA3N_GGUF_GRAPH_REASON,
1074+
),
1075+
GGUFArchitectureSpec(
1076+
gguf_arch="hunyuan_vl",
1077+
config=Support.DEFERRED,
1078+
tensor_map=Support.DEFERRED,
1079+
graph=Support.DEFERRED,
1080+
runtime=Support.DEFERRED,
1081+
reason=_HUNYUAN_VL_GGUF_GRAPH_REASON,
1082+
),
1083+
GGUFArchitectureSpec(
1084+
gguf_arch="llama4",
1085+
config=Support.DEFERRED,
1086+
tensor_map=Support.DEFERRED,
1087+
graph=Support.DEFERRED,
1088+
runtime=Support.DEFERRED,
1089+
reason=_LLAMA4_GGUF_GRAPH_REASON,
1090+
),
1091+
GGUFArchitectureSpec(
1092+
gguf_arch="mistral3",
1093+
config=Support.DEFERRED,
1094+
tensor_map=Support.DEFERRED,
1095+
graph=Support.DEFERRED,
1096+
runtime=Support.DEFERRED,
1097+
reason=_MISTRAL3_GGUF_GRAPH_REASON,
1098+
),
1099+
GGUFArchitectureSpec(
1100+
gguf_arch="paddleocr",
1101+
config=Support.DEFERRED,
1102+
tensor_map=Support.DEFERRED,
1103+
graph=Support.DEFERRED,
1104+
runtime=Support.DEFERRED,
1105+
reason=_PADDLEOCR_GGUF_GRAPH_REASON,
1106+
),
1107+
GGUFArchitectureSpec(
1108+
gguf_arch="qwen2vl",
1109+
config=Support.DEFERRED,
1110+
tensor_map=Support.DEFERRED,
1111+
graph=Support.DEFERRED,
1112+
runtime=Support.DEFERRED,
1113+
reason=_QWEN2VL_GGUF_GRAPH_REASON,
1114+
),
1115+
GGUFArchitectureSpec(
1116+
gguf_arch="qwen3vl",
1117+
config=Support.DEFERRED,
1118+
tensor_map=Support.DEFERRED,
1119+
graph=Support.DEFERRED,
1120+
runtime=Support.DEFERRED,
1121+
reason=_QWEN3VL_GGUF_GRAPH_REASON,
1122+
),
1123+
GGUFArchitectureSpec(
1124+
gguf_arch="qwen3vlmoe",
1125+
config=Support.DEFERRED,
1126+
tensor_map=Support.DEFERRED,
1127+
graph=Support.DEFERRED,
1128+
runtime=Support.DEFERRED,
1129+
reason=_QWEN3VLMOE_GGUF_GRAPH_REASON,
1130+
),
9641131
GGUFArchitectureSpec(
9651132
gguf_arch="cohere2",
9661133
model_type="cohere2",

0 commit comments

Comments
 (0)