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
Fix eager attention selection during model loading (#1375)
## Summary
- select the configured Transformers attention implementation before
`from_pretrained` constructs attention modules
- thread export compatibility through both build and direct export paths
- cover loader and build propagation while keeping export test doubles
compatible
## Motivation
DistilBERT exports could instantiate `DistilBertSdpaAttention` and only
switch the config to eager immediately before ONNX export. This left the
module implementation and config inconsistent, causing integer attention
masks to reach SDPA and fail with:
```
Expected attn_mask dtype to be bool or float or to match query dtype
```
## Validation
- `uv run pytest tests/unit/loader/test_load_hf_model.py
tests/unit/build/test_hf.py
tests/unit/export/test_htp_exporter_attention_compat.py
tests/unit/commands/test_config_value_priority.py
tests/unit/commands/test_export.py -q --tb=short`
- 175 tests passed
- retried all 6 affected QNN GPU models: the attention-mask dtype error
was eliminated in all 6; 5 completed perf and accuracy successfully,
while one progressed to a separate duplicate `metadata_props` ONNX
validation failure
0 commit comments