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

Loss gen tokens #3677

Merged
merged 12 commits into from
Oct 23, 2024
Merged

Loss gen tokens #3677

merged 12 commits into from
Oct 23, 2024

Conversation

dakinggg
Copy link
Contributor

@dakinggg dakinggg commented Oct 22, 2024

What does this PR do?

This PR allows differentiation between loss generating tokens and total tokens, by allowing get_num_tokens_in_batch to return a dict with total and loss_generating keys. This will only have an impact if you are using the accumulate_batch_on_tokens flag. This does not break or change any existing functionality, as by default, if you are just returning a single number from get_num_tokens_in_batch, we will accumulate using that value. Things will only change if the user adjusts their get_num_tokens_in_batch to be a dictionary.

Related PR in LLM Foundry: mosaicml/llm-foundry#1610

Manual testing (using Foundry draft PR):

Before with all tokens loss generating, microbatching is deterministic:
Screenshot 2024-10-22 at 8 15 40 PM

Before with not all tokens loss generating, microbatching is not deterministic:
Screenshot 2024-10-22 at 8 15 56 PM

After with not all tokens loss generating, microbatching is deterministic:
Screenshot 2024-10-22 at 8 16 13 PM

@dakinggg dakinggg marked this pull request as ready for review October 23, 2024 03:37
Copy link
Contributor

@mvpatel2000 mvpatel2000 left a comment

Choose a reason for hiding this comment

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

Some concern on warning spam, otherwise fine

composer/core/data_spec.py Outdated Show resolved Hide resolved
composer/core/data_spec.py Outdated Show resolved Hide resolved
@dakinggg dakinggg merged commit 5aaa8c9 into mosaicml:main Oct 23, 2024
14 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