-
Notifications
You must be signed in to change notification settings - Fork 3k
Sample without replacement option when interleaving datasets #7786
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
base: main
Are you sure you want to change the base?
Sample without replacement option when interleaving datasets #7786
Conversation
Great ! this is a cool additions :) IMO sample_with_replacement as a new argument doesn't make sense if the strategy is "first_exhausted", which is the default, and since disabling replacement affects the stopping strategy, I would be in favor of having it as a new strategy instead |
Makes sense, here's a revised implementation with that argument removed and adding a new stopping strategy. |
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
@lhoestq Let me know if there's anything on my side that I can do! |
Hi @radulescupetru, I'm commenting here after @lhoestq mentioned this PR in #7792. I'm facing a similar problem and I was wondering if there was a common a solution. Let me know if we share the same problem. As described in the issue, my problem is that I want to mix unbalanced datasets, distribute the samples on multiple workers and ranks, without repeating samples and while retrieving most samples as I can (i.e. without discarding samples whenever they could actually be used). I also noticed that the current approaches |
I pushed a small update @radulescupetru related to @LTMeyer 's issue, I hope you don't mind. The logic looks all good to me now :) could you also update |
@lhoestq Thanks for that fix. I've pushed updates to support the new stopping strategy for map style datasets as well. |
Right now,
interleave_datasets
function with probabilities will sample with replacement. The PR adds the ability to sample without replacement.In this example,
sample_with_replacement=True
and it prints:Note that sample with value:10 source: B is sampled twice (Sample:0 and Sample:7)
Re-running with
sample_with_replacement=False
in prints:Note that we don't see any repeated items.