fix: handle PreservingDataset in dataset concatenation#2213
Open
RudimentaryChef wants to merge 1 commit intoNVIDIA-NeMo:mainfrom
Open
fix: handle PreservingDataset in dataset concatenation#2213RudimentaryChef wants to merge 1 commit intoNVIDIA-NeMo:mainfrom
RudimentaryChef wants to merge 1 commit intoNVIDIA-NeMo:mainfrom
Conversation
806fe33 to
8a5e5b2
Compare
) `concatenate_datasets` from HuggingFace only accepts HF Dataset objects, causing a ValueError when `use_preserving_dataset=True`. Added a `merge_datasets` helper that detects PreservingDataset instances and merges their data lists directly instead. Closes NVIDIA-NeMo#2116 Signed-off-by: Adi Krish <143638558+RudimentaryChef@users.noreply.github.com>
8a5e5b2 to
cca50d1
Compare
yuki-97
reviewed
Apr 8, 2026
Contributor
yuki-97
left a comment
There was a problem hiding this comment.
Hi @RudimentaryChef , thanks for helping fix this!
We have two PRs addressing the same issue right now. After reviewing both, we've decided to move forward with #2218 as it also supports merging PreservingDataset with other datasets.
I'm going to close this one to avoid redundancy. We really appreciate your effort and hope to see more from you!
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.
Summary
ValueErrorwhen usinguse_preserving_dataset=Truewith SFT training (Training dataload fails when using preserving dataset #2116)concatenate_datasetsfrom HuggingFace only accepts HFDatasetobjects, butPreservingDatasetis a custom class — causing a crash during data setupmerge_datasets()helper innemo_rl/data/utils.pythat detectsPreservingDatasetinstances and merges their.datalists directly, falling back toconcatenate_datasetsfor standard HF datasetsexamples/run_sft.py(train + val) andnemo_rl/data/utils.py(train + val)Closes #2116
Test plan
merge_datasetscovering: multiple PreservingDatasets, multiple HF Datasets, single dataset, and heterogeneous structure preservationuse_preserving_dataset=Trueand a tool-call dataset completes without error