Commit 970cd41
Add HunYuan VL-MoT (hunyuan_vl_mot) VLM model support (#291)
## Summary
Add support for **HunYuan VL-MoT** (HY-Embodied-0.5-X) vision-language
model.
**Model**: tencent/HY-Embodied-0.5-X (3.8B params BF16, ~7.5GB)
**Registry key**: hunyuan_vl_mot
**Task**: Custom HunYuanVLMoTTask (3-model VLM split: decoder +
vision_encoder + embedding)
## Architecture
**Decoder** (32 layers, 2048 hidden, 16Q/4KV heads, head_dim=128):
- MoT dual-pathway: separate Q/K/V/O for text vs vision tokens, merged
before attention
- Shared QK norms, YaRN RoPE with alpha/beta scaling, input_ids for
modality mask
**Vision Encoder** (27-block ViT, 1152 hidden, 16 heads):
- Fused QKV + bias, LayerNorm + bias, patch_size=16, spatial merger (2x2
-> MLP)
- 16384 position embeddings (128x128 grid)
**Embedding**: Token lookup + CumSum-based image feature scatter
(mask_init_id=12)
## Config Extraction
HF config.json has no vision_config sub-object (flat config). Vision
params hardcoded in _configs.py (like phi4mm).
## Test Results
### L1 - Graph builds: PASS
```
4 passed (decoder prefill, decoder decode, vision_encoder, embedding)
```
### L2 - YAML test case: PASS
```
testdata/cases/vision-language/hy-embodied-0_5-x.yaml
222 schema tests passed
```
### CLI build with real weights: PASS
```
mobius build --model tencent/HY-Embodied-0.5-X /tmp/out
Saved decoder to decoder/model.onnx
Saved vision_encoder to vision_encoder/model.onnx
Saved embedding to embedding/model.onnx
```
### Multi-dtype: PASS
```
float32: 3 models built
float16: 3 models built
bfloat16: 3 models built
```
### Weight loading: PASS
All weights loaded. Only 1 unmatched: decoder.model.embed_tokens.weight
(expected - tie_word_embeddings=true).
### L4/L5 Golden tests: SKIPPED
**Reason**: HF repo auto_map references configuration_hunyuan_vl_mot.py
/ modeling_hunyuan_vl_mot.py but those files do not exist in the repo.
The hunyuan_vl_mot model type is not in transformers 5.7.0.
AutoModelForImageTextToText cannot load the model for HF reference
inference. YAML test case has skip_reason documenting this.
## Files Changed
| File | Change |
|------|--------|
| src/mobius/models/hunyuan_vl_mot.py | New model (~550 lines) |
| src/mobius/tasks/_hunyuan_vl_mot.py | Custom task (adds input_ids for
MoT routing) |
| src/mobius/models/__init__.py | Export HunYuanVLMoTModel |
| src/mobius/_registry.py | Register hunyuan_vl_mot |
| src/mobius/_configs.py | Hardcoded vision config + QKV bias fallback |
| tests/_test_configs.py | Tiny config for L1 tests |
| testdata/cases/vision-language/hy-embodied-0_5-x.yaml | L4/L5 test
case (skipped) |
---------
Signed-off-by: Justin Chu <justinchu@microsoft.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent 03f524f commit 970cd41
8 files changed
Lines changed: 808 additions & 0 deletions
File tree
- src/mobius
- models
- tasks
- testdata/cases/vision-language
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
602 | 602 | | |
603 | 603 | | |
604 | 604 | | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
605 | 620 | | |
606 | 621 | | |
607 | 622 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
| 56 | + | |
56 | 57 | | |
57 | 58 | | |
58 | 59 | | |
| |||
473 | 474 | | |
474 | 475 | | |
475 | 476 | | |
| 477 | + | |
476 | 478 | | |
477 | 479 | | |
478 | 480 | | |
| |||
835 | 837 | | |
836 | 838 | | |
837 | 839 | | |
| 840 | + | |
838 | 841 | | |
839 | 842 | | |
840 | 843 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| 58 | + | |
58 | 59 | | |
59 | 60 | | |
60 | 61 | | |
| |||
172 | 173 | | |
173 | 174 | | |
174 | 175 | | |
| 176 | + | |
175 | 177 | | |
176 | 178 | | |
177 | 179 | | |
| |||
0 commit comments