Repository navigation
feat: Allow to conditionally skip malformed jsonl lines when loading dataset - #1694
Merged
Merged
Conversation
titu1994
requested review from
a team,
HuiyingLi,
adil-a,
akoumpa,
hemildesai,
jgerh and
pthombre
as code owners
April 6, 2026 17:41
This commit introduces the `skip_invalid_samples` parameter to the `_load_openai_messages` function and the `ChatDataset` class. When set to `True`, it allows the loading process to skip malformed JSONL lines and invalid chat samples, enhancing robustness in data handling. Additionally, corresponding tests have been added to verify the new functionality. Signed-off-by: Somshubra Majumdar <titu1994@gmail.com>
This commit updates the `dataset-overview.md` to include the `skip_invalid_samples` parameter, detailing its functionality for handling malformed JSONL lines. Additionally, the docstring in `ChatDataset` has been expanded to clarify the usage of `skip_invalid_samples`, improving the overall documentation for better user understanding. Signed-off-by: Somshubra Majumdar <titu1994@gmail.com>
This commit updates the `dataset-overview.md` and the `ChatDataset` class docstring to refine the explanation of the `skip_invalid_samples` parameter. The documentation now specifies that it only skips malformed JSONL lines during loading, while invalid structured rows will still raise errors after loading. Additionally, the test for `skip_invalid_samples` has been renamed to reflect its updated behavior. Signed-off-by: Somshubra Majumdar <titu1994@gmail.com>
Contributor
|
/ok to test 492717b |
Contributor
|
/claude review |
|
|
||
| rows = tcd._load_openai_messages(str(jsonl), skip_invalid_samples=True) | ||
| assert len(rows) == 2 | ||
| assert rows[0]["messages"][0]["content"] == "ok-1" |
Contributor
There was a problem hiding this comment.
Nit: Consider asserting that the warning is actually emitted when lines are skipped (e.g., using caplog). Right now the test verifies the rows are correct but doesn't confirm the logging path works, which is the main observability mechanism for users debugging data issues.
linnanwang
pushed a commit
that referenced
this pull request
Apr 24, 2026
…dataset (#1694) * feat: add skip_invalid_samples parameter to chat dataset loading This commit introduces the `skip_invalid_samples` parameter to the `_load_openai_messages` function and the `ChatDataset` class. When set to `True`, it allows the loading process to skip malformed JSONL lines and invalid chat samples, enhancing robustness in data handling. Additionally, corresponding tests have been added to verify the new functionality. Signed-off-by: Somshubra Majumdar <titu1994@gmail.com> * docs: enhance dataset overview and chat dataset loading documentation This commit updates the `dataset-overview.md` to include the `skip_invalid_samples` parameter, detailing its functionality for handling malformed JSONL lines. Additionally, the docstring in `ChatDataset` has been expanded to clarify the usage of `skip_invalid_samples`, improving the overall documentation for better user understanding. Signed-off-by: Somshubra Majumdar <titu1994@gmail.com> * docs: clarify skip_invalid_samples behavior in dataset documentation This commit updates the `dataset-overview.md` and the `ChatDataset` class docstring to refine the explanation of the `skip_invalid_samples` parameter. The documentation now specifies that it only skips malformed JSONL lines during loading, while invalid structured rows will still raise errors after loading. Additionally, the test for `skip_invalid_samples` has been renamed to reflect its updated behavior. Signed-off-by: Somshubra Majumdar <titu1994@gmail.com> --------- Signed-off-by: Somshubra Majumdar <titu1994@gmail.com>
kashif
pushed a commit
to kashif/Automodel
that referenced
this pull request
May 25, 2026
…dataset (NVIDIA-NeMo#1694) * feat: add skip_invalid_samples parameter to chat dataset loading This commit introduces the `skip_invalid_samples` parameter to the `_load_openai_messages` function and the `ChatDataset` class. When set to `True`, it allows the loading process to skip malformed JSONL lines and invalid chat samples, enhancing robustness in data handling. Additionally, corresponding tests have been added to verify the new functionality. Signed-off-by: Somshubra Majumdar <titu1994@gmail.com> * docs: enhance dataset overview and chat dataset loading documentation This commit updates the `dataset-overview.md` to include the `skip_invalid_samples` parameter, detailing its functionality for handling malformed JSONL lines. Additionally, the docstring in `ChatDataset` has been expanded to clarify the usage of `skip_invalid_samples`, improving the overall documentation for better user understanding. Signed-off-by: Somshubra Majumdar <titu1994@gmail.com> * docs: clarify skip_invalid_samples behavior in dataset documentation This commit updates the `dataset-overview.md` and the `ChatDataset` class docstring to refine the explanation of the `skip_invalid_samples` parameter. The documentation now specifies that it only skips malformed JSONL lines during loading, while invalid structured rows will still raise errors after loading. Additionally, the test for `skip_invalid_samples` has been renamed to reflect its updated behavior. Signed-off-by: Somshubra Majumdar <titu1994@gmail.com> --------- Signed-off-by: Somshubra Majumdar <titu1994@gmail.com>
This branch was previously deployed
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.
What does this PR do ?
Adds a config flag to allow skipping lines in jsonl dataset that are malformed and cant be loaded so that it doesnt crash and instead just skips the sample.
Changelog
skip_invalid_samplesflag added (defaults to false for backward compat)Before your PR is "Ready for review"
Pre checks:
If you haven't finished some of the above items you can still open "Draft" PR.
Additional Information