Skip to content
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 number of examples for iterable datasets in multiprocessing #18856

Merged
merged 2 commits into from
Sep 2, 2022

Conversation

sgugger
Copy link
Collaborator

@sgugger sgugger commented Sep 1, 2022

What does this PR do?

As pointed out in #18608, IterableDatasetShard.num_examples is not always update in multiprocessing environments. This PR addresses that by ignoring the value in those cases. It also adds a stronger check of trusting the observed number of examples when for the reason the length is 0.

Fixes #18608

@sgugger sgugger requested a review from LysandreJik September 1, 2022 15:14
@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Sep 1, 2022

The documentation is not available anymore as the PR was closed or merged.

Copy link
Member

@LysandreJik LysandreJik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch! LGTM

@sgugger sgugger merged commit 9e346f7 into main Sep 2, 2022
@sgugger sgugger deleted the eval_num_examples branch September 2, 2022 14:49
oneraghavan pushed a commit to oneraghavan/transformers that referenced this pull request Sep 26, 2022
…ingface#18856)

* Fix number of examples for iterable datasets in multiprocessing

* Add stronger check
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

IterableDatasets result in nan loss in eval with dataloader_num_workers>=1 and multi-gpu
3 participants