Commit 7cf8bde
committed
Fix BF16 vision encoder: keep OneHot values as float32
ONNX OneHot op doesn't support bfloat16 for the values tensor.
Keep OneHot values as float32 and cast the output to model dtype
afterward for the subsequent MatMul.
Previously, CastLike cast the values to bf16 before OneHot, causing
the entire vision encoder to fail at model load time.
Tested: bf16 build succeeds for google/gemma-4-e2b-it (all 4 models).
Signed-off-by: Justin Chu <justinchu@microsoft.com>1 parent 0d8a635 commit 7cf8bde
1 file changed
Lines changed: 5 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
445 | 445 | | |
446 | 446 | | |
447 | 447 | | |
| 448 | + | |
448 | 449 | | |
449 | | - | |
450 | | - | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
451 | 454 | | |
452 | 455 | | |
453 | 456 | | |
| |||
0 commit comments