Skip to content

Refactor inner training loop#43985

Open
winglian wants to merge 5 commits intohuggingface:mainfrom
winglian:refactor-inner-training-loop
Open

Refactor inner training loop#43985
winglian wants to merge 5 commits intohuggingface:mainfrom
winglian:refactor-inner-training-loop

Conversation

@winglian
Copy link
Collaborator

What does this PR do?

The _inner_training_loop method has a lot going on which makes it hard to extend for downstream developers/libraries. This PR breaks it up into smaller well described methods that are chained in the training loop.

Additionally, this adds the concept of a DataProducer that can wrap the dataset/sampler/dataloader which allows for better handling of Iterable data and Async data for use cases like async RL downstream (e.g. trl)

Fixes # (issue)

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Did you read the contributor guideline,
    Pull Request section?
  • Was this discussed/approved via a Github issue or the forum? Please add a link
    to it if that's the case.
  • Did you make sure to update the documentation with your changes? Here are the
    documentation guidelines, and
    here are tips on formatting docstrings.
  • Did you write any new necessary tests?

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.

@winglian winglian force-pushed the refactor-inner-training-loop branch from 8b671ec to a2bfec7 Compare February 13, 2026 18:23
@HuggingFaceDocBuilderDev

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.

@github-actions
Copy link
Contributor

[For maintainers] Suggested jobs to run (before merge)

run-slow: metaclip_2

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