Repository navigation
Fix integration test: remove dropped cache_position kwarg from Qwen3_5GatedDeltaNet.forward() - #229
Conversation
… has_previous_state flag The Qwen3_5GatedDeltaNet.forward() in newer transformers (5.x) no longer accepts cache_position. The decode-mode flag has_previous_state must also now be set explicitly when directly assigning cache layer states. Fixes: test_qwen35_deltanet_single_layer_parity TypeError Agent-Logs-Url: https://github.com/onnxruntime/mobius/sessions/7a0ec434-f0af-41ab-a0d3-b41282eaef17 Co-authored-by: justinchuby <[email protected]>
cache_position kwarg from Qwen3_5GatedDeltaNet.forward()
Performance Comparison
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
@copilot FAILED tests/integration_test.py::test_qwen35_deltanet_single_layer_parity - AttributeError: 'LinearAttentionLayer' object has no attribute 'dtype' |
There was a problem hiding this comment.
Pull request overview
Fixes a failing integration parity test against HuggingFace transformers 5.x by aligning the test’s HF Qwen3_5GatedDeltaNet.forward() invocation and cache semantics with the updated upstream API.
Changes:
- Remove the dropped
cache_positionkeyword argument from the HF forward call. - Explicitly set
cache.layers[0].has_previous_state = Trueso HF takes the decode-mode path when the test pre-fills cache tensors via direct assignment.
…ect assignment Direct assignment of cache.layers[0].conv_states bypassed lazy_initialization, leaving 'dtype' unset on LinearAttentionLayer. When the forward called update_recurrent_state, it triggered lazy_initialization which accessed self.dtype -> AttributeError. Use cache.update_conv_state/update_recurrent_state API instead, which properly initializes dtype/device/initialized flags and sets has_previous_state=True automatically. Agent-Logs-Url: https://github.com/onnxruntime/mobius/sessions/b064a982-b980-41f9-b630-622c7a7b65c0 Co-authored-by: justinchuby <[email protected]>
Fixed in 2d1fed0. The Replaced the direct assignments with |
test_qwen35_deltanet_single_layer_parityfails on transformers 5.x becauseQwen3_5GatedDeltaNet.forward()no longer acceptscache_position, andhas_previous_stateis no longer implicitly set when assigning cache states directly.Changes
cache_positionkwarg — dropped from the HF forward signature in transformers 5.x; decode vs. prefill mode is now determined solely viacache_params.has_previous_state(layer_idx).cache.layers[0].has_previous_state = True— in the old API this flag was implicitly set whenconv_stateswas assigned directly on the layer; in 5.x it is a plainbooldefaulting toFalseand only set viaupdate_conv_state(). The test bypasses that method, so the flag must be set manually to put the forward into decode mode and consume the pre-filled states.