Commit d9cc5e6
OpenVINOEncapsulation: map float16/bfloat16/bool (char) OV dtypes (microsoft#2559)
## Problem
`OpenVINOEncapsulation` builds the `EPContext` ONNX by mapping each
OpenVINO model input/output element type to an ONNX `TensorProto` dtype
via `openvino_to_onnx_dtype[str(element_type)...]`. The map was missing
the OpenVINO string spellings for several common types:
- fp16 stringifies as `float16` (only `f16` was mapped)
- bf16 as `bfloat16` (only `bf16`)
- ONNX `BOOL` round-trips through OpenVINO as `char`
As a result, encapsulating an **fp16 model** (e.g. an LLM decoder) or
any model with a **boolean mask** input crashes:
```
File ".../openvino/encapsulation.py", line 181, in _run_single_target
inputs.append(helper.make_tensor_value_info(name, onnx_dtype, shape_list))
TypeError: 'NoneType' object cannot be interpreted as an integer
```
(`onnx_dtype` is `None` because the lookup missed.)
## Fix
Add the missing aliases: `float16` → `FLOAT16`, `bfloat16` → `BFLOAT16`,
`char` → `BOOL`.
## Validation
With this fix, `OpenVINOConversion` → `OpenVINOEncapsulation`
successfully produces `EPContext` ONNX models for all four components of
a multimodal fp16 INT4 decoder+encoders package (Gemma 4 E2B, built via
`MobiusBuilder` → `OnnxKQuantQuantization` → `MatMulNBitsToQDQ` →
OpenVINO 2026.3), including the audio encoder's boolean
`input_features_mask`. Before the fix, fp16 inputs failed immediately
and the boolean-mask encoder failed with the same `NoneType` error.
Signed-off-by: Justin Chu <11205048+justinchuby@users.noreply.github.com>
Co-authored-by: Justin Chu <11205048+justinchuby@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent 46d38c7 commit d9cc5e6
1 file changed
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
32 | 33 | | |
| 34 | + | |
33 | 35 | | |
34 | 36 | | |
35 | 37 | | |
| |||
48 | 50 | | |
49 | 51 | | |
50 | 52 | | |
| 53 | + | |
51 | 54 | | |
52 | 55 | | |
53 | 56 | | |
| |||
0 commit comments