Skip to content

Commit 2db9d33

Browse files
justinchubyCopilot
andauthored
Promote evidence-backed multimodal GGUF bundles (#632)
## Summary - promote Gemma 3, Qwen2-VL, and Qwen2.5-VL text + mmproj graph import - preserve canonical `decoder`, `vision_encoder`, and `embedding` package roles and #625-#630 package/runtime invariants - add exact pinned llama.cpp tensor closures, projector override resolution, Qwen QKV/temporal patch transforms, Gemma projector mapping, and supported quantization paths - bind real pinned Hugging Face processor contracts to float32 graph boundaries, independent image/video streams, batch-major media ordering, and empty-media behavior - keep all downstream multimodal runtime verdicts deferred rather than inferring runtime support from graph construction ## Evidence - real Gemma 3, Qwen2-VL, and Qwen2.5-VL mmproj artifact revisions, sizes, SHA-256 values, qtype inventories, and paired text targets are recorded in the registry and docs - value-based tensor/projector mapping tests cover Gemma 3 and both Qwen variants - synthetic execution covers two-row mixed image/video ordering, text-only and empty-media embedding, Qwen vision execution, decoder prefill, and cached decode - Gemma 3 tests cover the processor-native 256 `<image_soft_token>` placeholders, safe out-of-vocabulary lookup handling, flattened batch offsets, and projector parity - generated generic decoder metadata remains graph-derived ## Runtime waivers Graph import is supported; downstream runtime support remains deferred. Gemma 3 parent processor assets are gated and no ORT GenAI media orchestrator was proven. Qwen runtime still needs proven video alias/timing plumbing and 3D M-RoPE position construction. No audio/codec bundle was promoted without a complete expressible processor/state/runtime contract. ## Residual multimodal blockers - Qwen3-VL: DeepStack decoder-layer injection - Gemma3n: complete MobileNetV5 vision and Conformer audio bundle - Gemma4 audio: remaining `a.pre_encode.*` and Conformer parity - generated-audio sidecars: stateful codec/generation contracts ## Validation - focused GGUF/mmproj/multimodal/package/runtime: `3215 passed` - broad non-integration: `7849 passed, 56 skipped, 1 subtest passed` - initialized repository lint: clean - GPT-5.6 Sol medium architecture review: fixed Gemma 3 boundary-vs-soft-token blocker; no remaining high-confidence findings - GPT-5.6 Sol medium regression review: fixed Qwen evidence references, added vision/prefill/decode execution, and closed the docs artifact census Base: `6ff5f78dafb90609372de023a5ab9d27098dca6d` Head: `ed370d8cecf7adc985d5b372ee050b661f069607` --------- Signed-off-by: Justin Chu <[email protected]> Co-authored-by: Copilot App <[email protected]>
1 parent 6ff5f78 commit 2db9d33

19 files changed

Lines changed: 1988 additions & 92 deletions

‎docs/api/build_from_gguf.md‎

Lines changed: 36 additions & 15 deletions
Large diffs are not rendered by default.

‎src/mobius/_registry.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ def _detect_fallback_registration(hf_config) -> ModelRegistration | None:
475475
),
476476
"gemma": ModelRegistration(GemmaCausalLMModel),
477477
"gemma2": ModelRegistration(Gemma2CausalLMModel),
478-
"gemma3": ModelRegistration(Gemma3MultiModalModel, task="vision-language"),
478+
"gemma3": ModelRegistration(Gemma3MultiModalModel, task="gemma3-vision-language"),
479479
"gemma3_text": ModelRegistration(Gemma3CausalLMModel),
480480
"gemma3n_text": ModelRegistration(Gemma3nCausalLMModel),
481481
"gemma4_text": ModelRegistration(Gemma4CausalLMModel, config_class=Gemma4Config),

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
# import route, runtime version, and pinned tokenizer evidence record.
2323
2424
:func:`build_from_gguf` is the single entry point; passing ``mmproj`` delegates
25-
to :func:`build_gemma4_vlm_from_gguf` for the multimodal assembly.
25+
to the matching architecture-specific multimodal builder.
2626
"""
2727

2828
from __future__ import annotations
@@ -35,7 +35,11 @@
3535
GgufArchResolutionError,
3636
resolve_model_type,
3737
)
38-
from mobius.integrations.gguf._mmproj import build_gemma4_vlm_from_gguf
38+
from mobius.integrations.gguf._mmproj import (
39+
build_gemma3_vlm_from_gguf,
40+
build_gemma4_vlm_from_gguf,
41+
build_qwen_vlm_from_gguf,
42+
)
3943
from mobius.integrations.gguf._preflight import (
4044
GgufPreflightReport,
4145
GgufTypeStat,
@@ -61,7 +65,9 @@
6165

6266
__all__ = [
6367
"build_from_gguf",
68+
"build_gemma3_vlm_from_gguf",
6469
"build_gemma4_vlm_from_gguf",
70+
"build_qwen_vlm_from_gguf",
6571
"GGUFTokenizerAsset",
6672
"GGUFTokenizerSource",
6773
"materialize_gguf_tokenizer",

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

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -921,6 +921,7 @@
921921
# `+1` baked into every *norm.weight must be removed on import.
922922
tensor_processor="unoffset_norm",
923923
config_postprocessor="gemma3",
924+
vlm_builder="gemma3",
924925
runtime=Support.DEFERRED,
925926
reason=_RUNTIME_VALIDATION_PENDING,
926927
),
@@ -1582,11 +1583,19 @@
15821583
),
15831584
GGUFArchitectureSpec(
15841585
gguf_arch="qwen2vl",
1585-
config=Support.DEFERRED,
1586-
tensor_map=Support.DEFERRED,
1587-
graph=Support.DEFERRED,
1586+
model_type="qwen2_vl_text",
1587+
tensor_map_recipe=("llama",),
1588+
required_metadata=(
1589+
"attention.layer_norm_rms_epsilon",
1590+
"rope.dimension_sections",
1591+
),
1592+
vlm_builder="qwen_vl",
15881593
runtime=Support.DEFERRED,
1589-
reason=_QWEN2VL_GGUF_GRAPH_REASON,
1594+
reason=(
1595+
"Text and paired Qwen2/Qwen2.5-VL projector graph import are supported "
1596+
"for the exact split-QKV llama.cpp artifacts, but downstream multimodal "
1597+
"runtime execution has not been evidenced."
1598+
),
15901599
),
15911600
GGUFArchitectureSpec(
15921601
gguf_arch="qwen3vl",

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

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
#: Number of importable architectures. Pinned so that adding support is a
5858
#: deliberate act that also updates the documented support matrix, and so that
5959
#: accidentally losing an architecture is a failure rather than a silence.
60-
_EXPECTED_SUPPORTED_COUNT = 58
60+
_EXPECTED_SUPPORTED_COUNT = 59
6161
_FINAL_CENSUS_CLOSURE = frozenset(
6262
{
6363
"afmoe",
@@ -180,6 +180,7 @@
180180
"phimoe",
181181
"plamo2",
182182
"qwen2",
183+
"qwen2vl",
183184
"qwen2moe",
184185
"qwen3",
185186
"qwen35",
@@ -1195,7 +1196,6 @@ class TestPinnedRemainingVLMTextCohort:
11951196
"llama4",
11961197
"mistral3",
11971198
"paddleocr",
1198-
"qwen2vl",
11991199
"qwen3vl",
12001200
"qwen3vlmoe",
12011201
)
@@ -1457,7 +1457,6 @@ def test_no_false_alias_config_tensor_or_runtime_claim_is_reachable(
14571457
("llama4", ("routed experts", "llama4 clip", "text-backbone")),
14581458
("mistral3", ("dense or routed-expert", "temperature", "Pixtral")),
14591459
("paddleocr", ("optional bias", "image-token", "ordinary Qwen2")),
1460-
("qwen2vl", ("Qwen2.5-Omni", "projector strings", "target identity")),
14611460
("qwen3vl", ("multimodal position IDs", "deep-stack", "text-only")),
14621461
("qwen3vlmoe", ("routed experts", "effective tied head", "cache ABI")),
14631462
],
@@ -1492,7 +1491,6 @@ def test_valid_hugging_face_registrations_are_not_reused_as_gguf_aliases(self) -
14921491
"gemma3n_text",
14931492
"llama4_text",
14941493
"mistral3",
1495-
"qwen2_vl_text",
14961494
"qwen3_vl_text",
14971495
"qwen3_vl_moe",
14981496
} <= set(_REGISTRATIONS)
@@ -1505,7 +1503,12 @@ def test_existing_exact_paired_builders_remain_the_only_supported_pairs(self) ->
15051503
for spec in iter_arch_specs()
15061504
if spec.vlm_builder is not None
15071505
}
1508-
assert exact == {"gemma4": "gemma4", "muse-glimmer": "muse_glimmer"}
1506+
assert exact == {
1507+
"gemma3": "gemma3",
1508+
"gemma4": "gemma4",
1509+
"muse-glimmer": "muse_glimmer",
1510+
"qwen2vl": "qwen_vl",
1511+
}
15091512

15101513

15111514
class TestRejectionsAreActionable:

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7209,7 +7209,6 @@ def test_invalid_decay_fails_before_graph(self, tmp_path: Path, monkeypatch) ->
72097209
"llama4",
72107210
"mistral3",
72117211
"paddleocr",
7212-
"qwen2vl",
72137212
"qwen3vl",
72147213
"qwen3vlmoe",
72157214
],

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -875,13 +875,17 @@ def gguf_to_config(
875875
"beta_slow": metadata.get(f"{gguf_arch}.rope.scaling.yarn_beta_slow", 1.0),
876876
}
877877

878-
if canonical_arch in {"qwen35", "qwen35moe"}:
878+
if canonical_arch in {"qwen2vl", "qwen35", "qwen35moe"}:
879879
mrope_section = metadata[f"{gguf_arch}.rope.dimension_sections"]
880880
if not isinstance(mrope_section, (list, tuple, np.ndarray)) or len(mrope_section) != 4:
881881
raise ValueError(
882882
f"{gguf_arch}.rope.dimension_sections must contain exactly four entries"
883883
)
884884
mrope_section = [int(value) for value in mrope_section]
885+
if canonical_arch == "qwen2vl":
886+
if mrope_section[-1] != 0:
887+
raise ValueError("qwen2vl.rope.dimension_sections reserved entry must be zero")
888+
mrope_section = mrope_section[:3]
885889
else:
886890
mrope_section = None
887891

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,15 @@ def test_document_is_exact_generator_output() -> None:
2525
assert check_document()
2626

2727

28+
def test_manual_real_artifact_table_covers_every_registry_pin() -> None:
29+
document = Path("docs/api/build_from_gguf.md").read_text(encoding="utf-8")
30+
for pin in MMPROJ_ARTIFACT_PINS:
31+
assert f"`{pin.repository}@{pin.revision}`" in document
32+
assert f"`{pin.filename}`" in document
33+
assert f"`{pin.lfs_sha256}`" in document
34+
assert f"{pin.size:,}" in document
35+
36+
2837
def test_stale_at_style_pin_is_rejected(tmp_path: Path) -> None:
2938
document = tmp_path / "build_from_gguf.md"
3039
document.write_text(

0 commit comments

Comments
 (0)