-
Notifications
You must be signed in to change notification settings - Fork 647
Sample packing for ConcatDataset #2278
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
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/torchtune/2278
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit 50b72a1 with merge base b68cddd ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
@@ -90,3 +90,33 @@ def test_packed_dataset(self, torch_datasets): | |||
|
|||
with pytest.raises(ValueError): | |||
concated_dataset = ConcatDataset(torch_datasets) | |||
|
|||
def test_all_packed_datasets(self, torch_datasets): |
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.
should also test error is caught when some datasets are unpacked?
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.
Oh yeah it already exists in the previous unit test
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2278 +/- ##
===========================================
- Coverage 64.30% 23.94% -40.37%
===========================================
Files 352 357 +5
Lines 20566 21151 +585
===========================================
- Hits 13225 5064 -8161
- Misses 7341 16087 +8746 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Currently we error when any individual datasets in
ConcatDataset
havepacked=True
. This goes back to #1708: because packed and unpacked datasets require different collators and packing is done on the individual datasets rather than theConcatDataset
, we can't really guarantee a single collator forConcatDataset
is well-defined in all cases.Fortunately, it seems pretty likely that someone who is enabling packing on one dataset would want to do so on all of them. And it's actually trivial to support this case. So this PR relaxes the check in
ConcatDataset
to also allow the case that every dataset is packed.A couple things that can be revisited here:
ConcatDataset
is either all or nothing, it's probably more natural to define thepacked
attribute there instead. However, then we get into questions of whether we pack before or after merging. Relatedly,Test plan:
Added a unit test:
Also ran one of the updated recipes with the following config updates:
(Per HF datasets page, Alpaca dataset has 52k samples, Alpaca cleaned has 51.8k samples)
Printing the length of different dataset properties at different points: