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

Add repeat method to datasets #7198

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

alex-hh
Copy link
Contributor

@alex-hh alex-hh commented Oct 4, 2024

Following up on discussion in #6623 and #7198 I thought this would be pretty useful for my case so had a go at implementing.

My main motivation is to be able to call iterable_dataset.repeat(None).take(samples_per_epoch) to safely avoid timeout issues in a distributed training setting. This would provide a straightforward workaround for several open issues related to this situation: #6437, #6594, #6623, #6719.

@lhoestq let me know if this looks on the right track!

@alex-hh
Copy link
Contributor Author

alex-hh commented Jan 28, 2025

@lhoestq does this look reasonable?

Copy link
Member

@lhoestq lhoestq left a comment

Choose a reason for hiding this comment

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

Great ! It looks good overall, I added minor suggestions :)

Feel free to add a test for the map-style and iterable case and we can merge imo

src/datasets/arrow_dataset.py Outdated Show resolved Hide resolved
src/datasets/iterable_dataset.py Outdated Show resolved Hide resolved
src/datasets/iterable_dataset.py Outdated Show resolved Hide resolved
@alex-hh
Copy link
Contributor Author

alex-hh commented Jan 29, 2025

updated and added test cases!

@alex-hh alex-hh requested a review from lhoestq January 29, 2025 22:14
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.

2 participants