Repository navigation
Conversation
transformers 5.15 stopped setting causal_conv1d_fn and chunk_gated_delta_rule on the GatedDeltaNet instance (they are now module-level functions wrapped by use_kernelized_func), so the bridge's hooked forward raised AttributeError for Qwen3Next / Qwen3.5 / Qwen3.5-MoE linear-attention layers. Look the attributes up with getattr and fall back to the torch conv path and the module-level torch_chunk_gated_delta_rule when they are absent.
jlarson4
reviewed
Sep 23, 2026
…rs range on failure
Collaborator
|
Looks great, thanks for the quick resolution @YHC66 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
GatedDeltaNetBridge._hooked_forwardreadshf.causal_conv1d_fnandhf.chunk_gated_delta_rulefrom the wrapped HF module. transformers 5.15 stopped setting those as instance attributes onQwen3NextGatedDeltaNet/Qwen3_5GatedDeltaNet/Qwen3_5MoeGatedDeltaNet; they are now module-level functions (causal_conv1d_fn,torch_chunk_gated_delta_rule) wrapped by@use_kernelized_func. (5.14.0 still sets them; 5.15.0 is the first release without them.)pyproject.tomlallowstransformers>=5.9.0and CI is locked to 5.13.0, so this doesn't show up in CI, but with the current PyPI release (5.17.0) any non-generation forward through a Qwen3.5 / Qwen3Next / Qwen3.5-MoE bridge fails:Running the existing unit tests against transformers 5.17.0 reproduces it (10 failures + 7 errors under
tests/unit/model_bridgeintest_qwen3_5_adapter.py,test_qwen3_5_moe_adapter.pyandtest_ssm_hooked_forward_parity.py::test_gated_delta_net_hooked_forward_is_bit_exact).Fix: look both attributes up with
getattr. Whencausal_conv1d_fnis absent the existing torch conv path is used (it matches HF's torch implementation bit-for-bit). Whenchunk_gated_delta_ruleis absent, the module-leveltorch_chunk_gated_delta_rulefrom the HF module's own modeling file is used. Behavior on older transformers versions is unchanged.The new test in
test_ssm_hooked_forward_parity.pyremoves the two instance attributes from the HF module before wiring it into the bridge and checks bit-exact parity against HF's native forward, so the 5.15+ code path is covered on the transformers version CI is locked to.Type of change
Checklist:
Tested locally (macOS arm64, Python 3.12):
tests/unitpasses (6559 passed, 54 skipped, 6 xfailed); the new test fails without the fix.