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

Fix token counting to use attention mask instead of ids #802

Merged
merged 3 commits into from
Dec 14, 2023

Conversation

dakinggg
Copy link
Collaborator

@dakinggg dakinggg commented Dec 13, 2023

This fixes off by one errors when pad token and eos token are the same thing.

Manual test compare to before, there are 1440 more tokens counted for a run of length 30 batches * 48 samples per batch, as expected, because there is one eos token per sample.
Screenshot 2023-12-13 at 4 24 13 PM

@dakinggg dakinggg marked this pull request as ready for review December 14, 2023 00:29
Copy link
Contributor

@alextrott16 alextrott16 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for doing this. Definitely makes a lot more sense to be counting based on attention mask. Approve.

Copy link
Contributor

@irenedea irenedea left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Just had a couple questions.

tests/data/test_dataloader.py Show resolved Hide resolved
tests/data/test_dataloader.py Show resolved Hide resolved
@dakinggg dakinggg merged commit 5388dc0 into mosaicml:main Dec 14, 2023
8 checks passed
@dakinggg dakinggg deleted the fix-eot-token-counting branch February 10, 2024 07:30
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.

3 participants