-
Notifications
You must be signed in to change notification settings - Fork 513
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 packing + streaming + resumption #1277
Merged
Merged
Conversation
This file contains 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
dakinggg
commented
Jun 14, 2024
snarayan21
approved these changes
Jun 14, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for addressing this! minor nit but otherwise lgtm
mvpatel2000
approved these changes
Jun 14, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for hunting this down!
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.
There was a long standing bug when resuming a streaming, finetuning dataset with packing enabled. The issue would only occur if you resumed not on an epoch boundary. The issue would be fairly significant, in that resumption would resume at an earlier sample than it should have, so data would be unexpectedly repeated. The root cause of the issue is that, when packing, the num samples recorded for streaming resumption needed to be multiplied by the packing ratio.
Manual test, with PR, resumption is deterministic:
![Screenshot 2024-06-14 at 2 42 55 AM](https://private-user-images.githubusercontent.com/43149077/339720202-9bcd724a-3ea1-41e1-9c5b-dc81b177fbe7.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMwNzc4OTgsIm5iZiI6MTcyMzA3NzU5OCwicGF0aCI6Ii80MzE0OTA3Ny8zMzk3MjAyMDItOWJjZDcyNGEtM2VhMS00MWUxLTljNWItZGM4MWIxNzdmYmU3LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODA4VDAwMzk1OFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWFmNzRjZmQ2ZjgwZGZkZjE1ZjE1OTM1ZmNjZjdlMjA0Njg4YThkMzAxMmUyMGU4OWI2ODFkNzljZWFjZDc5ZDcmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.Tptcuk0YtDnbr2Okdh6wv48B7KdTbPWiUMDz74TxHbg)
Before this PR (note, loss is lower upon resumption because its repeating samples, and then it reverts to the same general loss curve once its through the repeats):
![Screenshot 2024-06-14 at 11 24 59 AM](https://private-user-images.githubusercontent.com/43149077/339867391-06f2d440-c023-4849-8761-d44710e96bf7.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMwNzc4OTgsIm5iZiI6MTcyMzA3NzU5OCwicGF0aCI6Ii80MzE0OTA3Ny8zMzk4NjczOTEtMDZmMmQ0NDAtYzAyMy00ODQ5LTg3NjEtZDQ0NzEwZTk2YmY3LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODA4VDAwMzk1OFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTFlOTgxNWVlNzE4ZjRmMzJlZGVkNDA4MjljYmM5ZWVlYThiYWE0MTIwYThiZDk0MDNmNWYxNjUzNjdiNjI5NmQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.YbHV-TDyZE2FmWgjGzg9I4GiyUfubeD2aVFB5hiAIZM)
The above plots were with
num_workers=0
, when settingnum_workers=8
, we discovered a second deterministic resumption bug, where the wrong batch size was passed to streaming. This has now also been fixed, and here is a manual test withnum_workers=8
.Note: There will still be some non determinism if
max_leftover_bins_to_keep
is not set to zero, because we don't save the reservoir. This will just be slight non determinism, as opposed to the current bug which would repeat samples.