transformers
1da9d1d4 - Fix CANINE fp16 dtype mismatch in attention mask causing ONNX export failure (#47083)

Commit
63 days ago
Fix CANINE fp16 dtype mismatch in attention mask causing ONNX export failure (#47083) fix(canine): cast attention mask to attention_scores dtype in fp16 forward _create_3d_attention_mask_from_input_mask() always constructs the mask in float32 via hardcoded .float() calls, regardless of model dtype. When the model runs in float16, adding this float32 mask to float16 attention_scores promotes them to float32. After softmax, attention_probs stays float32 while value_layer remains float16, causing: RuntimeError: expected scalar type Float but found Half Fix: cast attention_mask to attention_scores.dtype before the addition. Only affects the shallow character encoders (ndim==3 mask path). Fixes #47050
Author
Parents
Loading