Update README: add OpenVINO IR variant (OV 2026.3), path now works
Browse files
README.md
CHANGED
|
@@ -10,60 +10,52 @@ tags:
|
|
| 10 |
- multimodal
|
| 11 |
---
|
| 12 |
|
| 13 |
-
# gemma-4-E2B-it — ONNX
|
| 14 |
-
|
| 15 |
-
ONNX export of [google/gemma-4-E2B-it](https://huggingface.co/google/gemma-4-E2B-it),
|
| 16 |
-
built with [mobius](https://github.com/onnxruntime/mobius) and INT4-quantized
|
| 17 |
-
(K-Quant Q4_K_M) with [Olive](https://github.com/microsoft/Olive), packaged for
|
| 18 |
-
[ONNX Runtime GenAI](https://github.com/microsoft/onnxruntime-genai) with the
|
| 19 |
-
**OpenVINO execution provider**.
|
| 20 |
|
|
|
|
|
|
|
|
|
|
| 21 |
Gemma 4 E2B is an any-to-any multimodal model, so this is a multi-component
|
| 22 |
-
package
|
| 23 |
-
shared `genai_config.json`, tokenizer, and processor configs.
|
| 24 |
|
| 25 |
-
##
|
| 26 |
|
| 27 |
-
| Folder |
|
| 28 |
|---|---|---|
|
| 29 |
-
| `openvino/
|
|
|
|
| 30 |
|
| 31 |
-
|
| 32 |
-
on every component. To target a different OpenVINO device, edit `device_type`
|
| 33 |
-
to `GPU` or `CPU` — the ONNX graph is device-independent, no rebuild needed.
|
| 34 |
|
| 35 |
-
|
|
|
|
|
|
|
| 36 |
|
| 37 |
-
`
|
| 38 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
|
| 40 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
|
| 42 |
-
|
| 43 |
-
(plus `RMSNormalization`, `RotaryEmbedding`). As of `onnxruntime-openvino`
|
| 44 |
-
**1.24** (OpenVINO 2024/2025 ONNX frontend), the OpenVINO EP **does not yet
|
| 45 |
-
support the opset-24 `Attention` op** and **fails at session initialization**
|
| 46 |
-
(it does not fall back to CPU):
|
| 47 |
|
| 48 |
-
```
|
| 49 |
-
|
| 50 |
-
OpenVINO does not support the following ONNX operations: Attention
|
| 51 |
-
```
|
| 52 |
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
into OpenVINO-supported primitives.
|
| 58 |
|
| 59 |
-
|
| 60 |
-
supported there), which can be used to sanity-check correctness while the
|
| 61 |
-
OpenVINO opset gap is resolved.
|
| 62 |
|
| 63 |
-
##
|
| 64 |
|
| 65 |
-
|
| 66 |
-
import onnxruntime_genai as og
|
| 67 |
-
model = og.Model("openvino/npu")
|
| 68 |
-
# ... standard ORT GenAI generation loop ...
|
| 69 |
-
```
|
|
|
|
| 10 |
- multimodal
|
| 11 |
---
|
| 12 |
|
| 13 |
+
# gemma-4-E2B-it — ONNX / OpenVINO (INT4)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
+
INT4 export of [google/gemma-4-E2B-it](https://huggingface.co/google/gemma-4-E2B-it),
|
| 16 |
+
built with [mobius](https://github.com/onnxruntime/mobius) and quantized with
|
| 17 |
+
[Olive](https://github.com/microsoft/Olive) (K-Quant Q4_K_M + `MatMulNBitsToQDQ`).
|
| 18 |
Gemma 4 E2B is an any-to-any multimodal model, so this is a multi-component
|
| 19 |
+
package: `decoder`, `embedding`, `vision_encoder`, `audio_encoder`.
|
|
|
|
| 20 |
|
| 21 |
+
## Variants
|
| 22 |
|
| 23 |
+
| Folder | Format | Notes |
|
| 24 |
|---|---|---|
|
| 25 |
+
| `openvino-ir/` | **OpenVINO IR** (`.xml` + `.bin`) | INT4, per-component. **Recommended for OpenVINO.** Converts + compiles with OpenVINO **≥ 2026.3**. |
|
| 26 |
+
| `openvino/npu/` | ONNX (opset 24) | INT4, for ORT GenAI + OpenVINO EP. |
|
| 27 |
|
| 28 |
+
## `openvino-ir/` — the OpenVINO compilation artifact
|
|
|
|
|
|
|
| 29 |
|
| 30 |
+
Produced by converting the mobius ONNX with OpenVINO 2026.3
|
| 31 |
+
(`openvino.convert_model` → `openvino.save_model`). Verified: all four
|
| 32 |
+
components convert, and the decoder **compiles** (`Core().compile_model(...)`).
|
| 33 |
|
| 34 |
+
```python
|
| 35 |
+
import openvino as ov
|
| 36 |
+
core = ov.Core()
|
| 37 |
+
decoder = core.compile_model("openvino-ir/decoder/openvino_model.xml", "NPU") # or "GPU" / "CPU"
|
| 38 |
+
# embedding / vision_encoder / audio_encoder load the same way
|
| 39 |
+
```
|
| 40 |
|
| 41 |
+
Requires **OpenVINO ≥ 2026.3** — earlier releases (≤ 2026.2) lack the ONNX
|
| 42 |
+
frontend translators for opset-24 `RMSNormalization` / `RotaryEmbedding`
|
| 43 |
+
(added by [openvinotoolkit/openvino#35545](https://github.com/openvinotoolkit/openvino/pull/35545)),
|
| 44 |
+
so conversion fails on them. The tokenizer / processor / `genai_config.json`
|
| 45 |
+
files are included for reference.
|
| 46 |
|
| 47 |
+
## Build pipeline
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
|
| 49 |
+
`MobiusBuilder(fp16, openvino EP)` → `OnnxKQuantQuantization(bits=4, block=32)`
|
| 50 |
+
→ `MatMulNBitsToQDQ` → (OpenVINO) `convert_model`.
|
|
|
|
|
|
|
| 51 |
|
| 52 |
+
The mobius `openvino` EP disables `SkipSimplifiedLayerNormalization` fusion and
|
| 53 |
+
`MatMulNBitsToQDQ` lowers INT4 weights to standard QDQ, so the exported graph
|
| 54 |
+
uses only ops the OpenVINO ONNX frontend supports (once opset-24 `RMSNormalization`
|
| 55 |
+
/ `RotaryEmbedding` are available, i.e. OpenVINO ≥ 2026.3).
|
|
|
|
| 56 |
|
| 57 |
+
Recipe: [microsoft/olive-recipes `google-gemma-4-E2B-it`](https://github.com/microsoft/olive-recipes/tree/main/google-gemma-4-E2B-it).
|
|
|
|
|
|
|
| 58 |
|
| 59 |
+
## License
|
| 60 |
|
| 61 |
+
Inherits the [Gemma license](https://ai.google.dev/gemma/terms).
|
|
|
|
|
|
|
|
|
|
|
|