Repository navigation
Conversation
GatedDeltaNet.forward received attention_mask and did not use it. A causal conv and the delta-rule update both carry state forward, so left-padding tokens change the real tokens that follow them. The loss mask removes those positions from the loss and does not clear the state. Padding keys are the positions masked for every query, the same reduction gpt_model uses (attention_mask.all(dim=(1, 2))). Those hidden states are multiplied by zero before the projection. A mask whose shape is not [batch, seq] is left unchanged. Packed sequences keep using cu_seqlens and are not masked here. Checked with python3 -m pytest tests/test_gdn_padding_keep.py. A [1, 1, 3, 3] mask with the first key padded produces keep [0, 1, 1]. A mask of the wrong length returns None.
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.
GatedDeltaNet.forwardreceivedattention_maskand did not use it. A causal conv and the delta-rule update both carry state forward, so left-padding tokens change the real tokens that follow them. The loss mask removes those positions from the loss and does not clear the state.Padding keys are the positions masked for every query, the same reduction
gpt_modeluses (attention_mask.all(dim=(1, 2))). Those hidden states are multiplied by zero before the projection. A mask whose shape is not[batch, seq]is left unchanged. Packed sequences keep usingcu_seqlensand are not masked here.Checked with
python3 -m pytest tests/test_gdn_padding_keep.py. A[1, 1, 3, 3]mask with the first key padded produces keep[0, 1, 1]. A mask of the wrong length returns None.flake8is clean.