Skip to content

Commit e9ce060

Browse files
xiaoyu-workjustinchuby
authored andcommitted
Recognize Qwen2.5 VL text configs
1 parent 181be0e commit e9ce060

2 files changed

Lines changed: 44 additions & 0 deletions

File tree

‎src/mobius/integrations/ort_genai/auto_export.py‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,8 @@ def _revision_kwargs(revision: str | None) -> dict[str, str]:
115115
"plamo2": "decoder",
116116
# Qwen VL model families have separate ORT GenAI model types.
117117
"qwen2_vl": "qwen2_5_vl",
118+
"qwen2_vl_text": "qwen2_5_vl",
119+
"qwen2_5_vl_text": "qwen2_5_vl",
118120
"qwen3_vl": "qwen3_vl",
119121
"qwen3_vl_text": "qwen3_vl",
120122
# Preserve Qwen3.5 / Qwen3.6 source architecture identities here so package
@@ -217,7 +219,9 @@ class _DecoderAbi:
217219
"muse_glimmer",
218220
"muse_glimmer_text",
219221
"qwen2_vl",
222+
"qwen2_vl_text",
220223
"qwen2_5_vl",
224+
"qwen2_5_vl_text",
221225
"qwen3_vl",
222226
"mage_vl",
223227
"glm_ocr",

‎src/mobius/integrations/ort_genai/auto_export_test.py‎

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,9 @@ def test_qwen3_moe_maps_to_supported_decoder_type(self):
170170
# fallback still supplies the Qwen3 reasoning-token IDs.
171171
assert _resolve_ort_genai_model_type("qwen3_moe") == "qwen3"
172172

173+
def test_qwen25_text_subconfig_maps_to_multimodal_runtime(self):
174+
assert _resolve_ort_genai_model_type("qwen2_5_vl_text") == "qwen2_5_vl"
175+
173176
def test_gemma4_unified_model_types(self):
174177
# The gemma-4-12B unified checkpoint (model_type "gemma4_unified")
175178
# reuses the multimodal "gemma4" ORT GenAI pipeline; its standalone
@@ -329,6 +332,43 @@ def test_writes_transform_pipeline(self, tmp_path):
329332
assert len(norm_attrs["mean"]) == 3
330333
assert len(norm_attrs["std"]) == 3
331334

335+
def test_qwen25_text_config_writes_packed_patch_processor(self, tmp_path):
336+
vision = types.SimpleNamespace(
337+
image_size=448,
338+
patch_size=14,
339+
spatial_merge_size=2,
340+
model_type="qwen2_5_vl",
341+
)
342+
config = types.SimpleNamespace(
343+
vision=vision,
344+
model_type="qwen2_5_vl_text",
345+
spatial_merge_size=2,
346+
temporal_patch_size=2,
347+
)
348+
349+
path = _write_vision_processor_config(config, str(tmp_path))
350+
351+
assert path is not None
352+
with open(path) as f:
353+
data = json.load(f)
354+
assert data["processor"]["name"] == "qwen2_5_image_processor"
355+
transforms = data["processor"]["transforms"]
356+
assert transforms[-1]["operation"] == {
357+
"name": "patch_image",
358+
"type": "PatchImage",
359+
"attrs": {
360+
"patch_size": 14,
361+
"temporal_patch_size": 2,
362+
"merge_size": 2,
363+
},
364+
}
365+
normalize = next(
366+
transform["operation"]
367+
for transform in transforms
368+
if transform["operation"]["type"] == "Normalize"
369+
)
370+
assert normalize["attrs"]["qwen2_5_vl"] == 1
371+
332372
def test_mage_vl_writes_packed_patch_processor(self, tmp_path):
333373
vision = types.SimpleNamespace(
334374
image_size=448,

0 commit comments

Comments
 (0)