Skip to content

Train sampler unification#43138

Merged
SunMarc merged 11 commits into
huggingface:mainfrom
jiosephlee:train-sampler-unification
Feb 11, 2026
Merged

Train sampler unification#43138
SunMarc merged 11 commits into
huggingface:mainfrom
jiosephlee:train-sampler-unification

Conversation

@jiosephlee

Copy link
Copy Markdown
Contributor

What does this PR do?

Adds ability to control the sampling strategy of data during training, unifying group_by_length with the default random sampling, and additionally adds sequential sampling. Following up on previous PR #42265

@SunMarc

@jiosephlee jiosephlee mentioned this pull request Jan 6, 2026
5 tasks
@jiosephlee

Copy link
Copy Markdown
Contributor Author

This is my first PR, so I'm not too familiar with this process, but there's a natural consequence that this would outdate a lot of documentation. Should I go ahead and update all previous mentions of group_by_length?

@jiosephlee
jiosephlee force-pushed the train-sampler-unification branch from 29e5f0b to be3a2c2 Compare January 7, 2026 00:57

@SunMarc SunMarc left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks, this looks good ! Please go ahead and update the docs

@HuggingFaceDocBuilderDev

Copy link
Copy Markdown

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.

@romitjain

Copy link
Copy Markdown
Contributor

@jiosephlee @SunMarc
Should we instead make the argument to accept a sampler function in addition to a strategy? That will enable users integrate their own samplers. WDYT?

@jiosephlee

jiosephlee commented Jan 21, 2026

Copy link
Copy Markdown
Contributor Author

@romitjain I agree that this will make the Trainer more flexible. There are, however, general hesitations to adding arguments and bloating Trainer even further.

Thoughts on adding an additional argument called train_sampler_fn that overrides the strategy when provided? @SunMarc? Also, all the docs that referenced group_by_length have been updated to use the new arg

@github-actions

Copy link
Copy Markdown
Contributor

@ArthurZucker

Copy link
Copy Markdown
Collaborator

@SunMarc should I merge?

@romitjain

Copy link
Copy Markdown
Contributor

@ArthurZucker I would appreciate your opinion on this
#43138 (comment)

@SunMarc

SunMarc commented Jan 27, 2026

Copy link
Copy Markdown
Member

Pls merge @ArthurZucker

@romitjain I agree that this will make the Trainer more flexible. There are, however, general hesitations to adding arguments and bloating Trainer even further.

Thoughts on adding an additional argument called train_sampler_fn that overrides the strategy when provided? @SunMarc? Also, all the docs that referenced group_by_length have been updated to use the new arg

Maybe in the future when users request this ! They can also overwrite the _get_train_sampler directly !

@SunMarc

SunMarc commented Jan 28, 2026

Copy link
Copy Markdown
Member

plz merge @ArthurZucker

@SunMarc
SunMarc enabled auto-merge (squash) February 4, 2026 12:54
jiosephlee and others added 2 commits February 10, 2026 19:01
Resolve conflicts keeping train_sampling_strategy in place of
group_by_length, adapting to upstream's reorganized docstrings.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
Remove 13 duplicate field definitions in TrainingArguments that existed
in both our old layout and upstream's reorganized sections. Fix
exaone_moe model card date per utils/add_dates.py.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
auto-merge was automatically disabled February 11, 2026 00:50

Head branch was pushed to by a user without write access

@jiosephlee
jiosephlee force-pushed the train-sampler-unification branch from b5a3002 to 391b4d3 Compare February 11, 2026 00:56
@jiosephlee

Copy link
Copy Markdown
Contributor Author

@ArthurZucker should be ready to merge again

@SunMarc
SunMarc enabled auto-merge (squash) February 11, 2026 10:30
@SunMarc
SunMarc merged commit 372c27e into huggingface:main Feb 11, 2026
25 checks passed
@winglian

Copy link
Copy Markdown
Collaborator

@SunMarc Did we not want a deprecation period/notice on removing this from TraningArgs?

@SunMarc

SunMarc commented Feb 13, 2026

Copy link
Copy Markdown
Member

Do you think this is a widely used args ? Happy to add it back otherwise. This PR was supposed to be merged before v5 but it got forgotten.

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.

6 participants