You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 6b27a3f
Browse filesBrowse the repository at this point in the historyBrowse files
authored
ort_genai: native processor configs for gemma-4-12B unified (#391)
## Problem
For the encoder-free **gemma-4-12B "unified"** model, mobius
deliberately did **not** emit `image_processor.json` or
`audio_feature_extraction.json`, and its `genai_config.json` mapped
`model.type` to `gemma4`. The unified model's inputs (48px merged pixel
patches / raw 640-sample waveform frames) had no native ORT GenAI
preprocessing, so the only way to run it was HuggingFace `AutoProcessor`
+ `Generator.set_inputs`. The emitted `genai_config` referenced
processor files that were never written (a dangling reference; harmless
for `set_inputs` but broken for `MultiModalProcessor`).
## Change
With native ORT GenAI support now available (companion PRs below), emit
the correct processor configs:
- **`model.type`**: `gemma4_unified` → dedicated `gemma4_unified` ORT
GenAI type (was `gemma4`).
- **`image_processor.json`**: `DecodeImage → Gemma4ImageTransform` at
`patch_size=48, pooling_kernel_size=1` (patch_dim 6912). HF produces the
merged patches via *16px patchify + 3×3 `patches_merge`*, which is
**provably identical** to a direct 48px patchify, so the existing op is
reused with merged geometry.
- **`audio_feature_extraction.json`**: `AudioDecoder →
Gemma4UnifiedAudioFrames` (raw 640-sample framing) instead of the
128-dim log-mel op.
The text-only unified backbone (`gemma4_unified_text`) still resolves to
`gemma4_text` (unchanged).
## Dependencies
- onnxruntime-extensions: microsoft/onnxruntime-extensions#1091
(`Gemma4UnifiedAudioFrames`; image reuse)
- onnxruntime-genai: microsoft/onnxruntime-genai#2286 (`gemma4_unified`
processor + model type)
## Testing
`auto_export_test.py` + `genai_config_test.py`: **115 passed**. Updated
the three unified tests to assert the emitted configs (48/1 image
transform, raw-frame audio op, `gemma4_unified` type). `ruff`, `ruff
format`, and `mypy` clean on the changed source.
---------
Signed-off-by: Justin Chu <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: rui-ren <[email protected]>
Co-authored-by: Ti-Tai Wang <[email protected]>
Copilot-Session: 6e64e522-b07f-4c1c-abf1-3985268beb7e
0 commit comments