Commit 905498f
committed
Add multimodal support to the portable driver (Metal/CPU)
Bring the portable ggml driver to multimodal parity with the CUDA driver,
validated on Metal and CPU:
- Qwen3-VL vision: ViT encoder (full attention, blocked 2D RoPE, learned
pos-embed interpolation, 2x2 patch merger, deepstack mergers), single and
multiple images per forward, and video.
- Qwen3-VL language-model M-RoPE: true per-token [t,h,w] positions via
ggml_rope_multi, merging the 1-D positions with the wire's
image_mrope_positions (mirrors the CUDA merge). Text tokens reduce to plain
RoPE, so text-only generation is unchanged.
- Gemma-4 vision (SigLIP-style ViT) and audio input (Conformer encoder),
single and multiple clips.
- CSM-1B TTS: backbone + fused single-graph depth RVQ decoder + Mimi vocoder.
CSM loads in f32 (the sequential depth decode is precision-critical); codes
are bit-exact vs the HF reference.
- No silent CPU fallback: the driver announces its backend and flags a CPU
landing; PIE_PORTABLE_STRICT_METAL hard-errors on CPU-offloaded ops. A load
warning fires when a multimodal model runs on an unvalidated GPU backend.
- SDK: Context::append_images / append_audios for N-per-forward packing.
- Weight-loader fixes: strip leading singleton dims on shape compare; group
tensors by pointer to dodge the ggml 64-char name cap.
Docs in driver/portable/MULTIMODAL.md. New e2e test inferlets multi-image-test
and multi-audio-test.1 parent 8824d3e commit 905498f
36 files changed
Lines changed: 4046 additions & 24 deletions
File tree
- driver
- portable
- src
- executor
- service
- weight_loader/src
- inferlets
- multi-audio-test
- src
- multi-image-test
- src
- sdk/rust/inferlet/src
- server
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
96 | 101 | | |
97 | 102 | | |
98 | 103 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
10 | 13 | | |
11 | 14 | | |
12 | 15 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
101 | 104 | | |
102 | 105 | | |
103 | 106 | | |
| |||
0 commit comments