Divide FLOPs by two due to causal masks#1988
Merged
copybara-service[bot] merged 1 commit intomainfrom Jul 22, 2025
Merged
Conversation
77be52c to
3f17fed
Compare
gobbleturk
reviewed
Jul 18, 2025
7e3706e to
30e11f2
Compare
RissyRan
approved these changes
Jul 21, 2025
Collaborator
RissyRan
left a comment
There was a problem hiding this comment.
LGTM! @hengtaoguo @aireenmei @gagika you will need to add a config to opt out this calculation for bi-directional mask in Llama4
MaxText/maxtext_utils.py
Outdated
Collaborator
There was a problem hiding this comment.
Shall we keep this as one line for easy copy/paste?
Collaborator
Author
There was a problem hiding this comment.
I tried but it won't pass linter test. Maybe using short-URL? Does google have this function?
Collaborator
There was a problem hiding this comment.
ya I'd keep as one line, just add
pylint: disable=line-too-long
to the previous line
30e11f2 to
a4c0172
Compare
This was referenced Aug 1, 2025
Closed
4 tasks
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
As pointed out by this issue, the current FLOPs calculation does not consider the impact from causal masks. This PR fixes this issue.
FIXES: b/431892390
Tests
Checklist
Before submitting this PR, please make sure (put X in square brackets):