[feature] Add debug_dataloader_samples utility to preview decoded dataloader samples (#184) #364
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?
This PR adds a utility function
debug_dataloader_samples()
underutils/debug_utils.py
.It allows users to preview a few decoded examples from the first batch of the training
DataLoader
, which can help ensure that tokenization is working correctly before launching a long training run.This debug utility addresses #184.
Although another contributor expressed interest in the issue, no progress or maintainer feedback has occurred in the last 3 weeks.
As this feature is simple but useful, I decided to implement and contribute it directly.
How to use
This utility can be optionally called from
run_train.py
or any other training script to inspect tokenized input samples before training.Here is an example snippet:
Notes
To avoid a circular import issue between
utils.py
anddistributed.py
,this function is placed in a new module
debug_utils.py
instead of the mainutils.py
.Logging is used instead of
print()
to remain consistent with Nanotron’s logging system.Fixes #184
Before submitting
Who can review?
Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.