Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restored masked scaled dot attention #2542

Merged

Conversation

l-k-11235
Copy link
Contributor

Revert changes inserted by #2538 and adapt to #2539.

@vince62s
Copy link
Member

For the sake of clarity:
when using left-padding at inference with LM models, we need a mask even for step > 0 in order to mask the padded positions on the left hand side of the batch. However pytorch SDPA does not accept a mask for non causal, hence we need to use this mask only for the "regular" scaled dot product attention manual calculation.
merging.

@vince62s vince62s merged commit 05cd7cd into OpenNMT:master Dec 29, 2023
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants