Skip to content

Conversation

qgallouedec
Copy link
Member

@qgallouedec qgallouedec commented Jun 18, 2025

No description provided.

# What does this PR do?

<!--
Congratulations! You've made it this far! You're not quite done yet though.

Once merged, your PR is going to appear in the release notes with the title you set, so make sure it's a great title that fully reflects the extent of your awesome contribution.

Then, please replace this with a description of the change and which issue is fixed (if applicable). Please also include relevant motivation and context. List any dependencies (if any) that are required for this change.

Once you're done, someone will review your PR shortly. They may suggest changes to make the code even better.
-->

<!-- Remove if not applicable -->

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](https://github.com/huggingface/trl/blob/main/CONTRIBUTING.md#create-a-pull-request),
      Pull Request section?
- [ ] Was this discussed/approved via a GitHub issue? Please add a link
      to it if that's the case.
- [ ] Did you make sure to update the documentation with your changes?
- [ ] 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.
@qgallouedec qgallouedec changed the title [WIP] [SFT] SFT doc rewrite (#3606) [WIP] [SFT] SFT doc rewrite Jun 18, 2025
@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.

@qgallouedec qgallouedec changed the title [WIP] [SFT] SFT doc rewrite [SFT] SFT doc rewrite Jul 26, 2025
@qgallouedec qgallouedec changed the title [SFT] SFT doc rewrite 📘 SFT doc rewrite Jul 26, 2025
qgallouedec and others added 5 commits July 27, 2025 06:05
Co-authored-by: Kashif Rasul <kashif.rasul@gmail.com>
Co-authored-by: Kashif Rasul <kashif.rasul@gmail.com>
Co-authored-by: Kashif Rasul <kashif.rasul@gmail.com>
Co-authored-by: Kashif Rasul <kashif.rasul@gmail.com>
Co-authored-by: Kashif Rasul <kashif.rasul@gmail.com>
Copy link
Member

@lewtun lewtun left a comment

Choose a reason for hiding this comment

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

LGTM with some nits

Unsloth library that is fully compatible with [`SFTTrainer`]. Some benchmarks on 1x A100 listed below:

| 1 A100 40GB | Dataset | 🤗 | 🤗 + Flash Attention 2 | 🦥 Unsloth | 🦥 VRAM saved |
Copy link
Member

Choose a reason for hiding this comment

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

Is the VRAM saved relative to the 🤗 + FA2 combination or the vanilla 🤗 one? Might be good to specify for clarity

@qgallouedec qgallouedec merged commit 303d3b1 into main Jul 28, 2025
2 checks passed
@qgallouedec qgallouedec deleted the sft-doc-refactor branch July 28, 2025 23:06
marcandrelarochelle pushed a commit to marcandrelarochelle/trl that referenced this pull request Jul 29, 2025
Co-authored-by: Kashif Rasul <kashif.rasul@gmail.com>
Co-authored-by: lewtun <lewis.c.tunstall@gmail.com>
)

trainer.train()
```

> [!WARNING]

Choose a reason for hiding this comment

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

Hi @qgallouedec

I am just wondering why this warning was removed? Is this something that has been resolved?

Copy link
Member Author

@qgallouedec qgallouedec Aug 12, 2025

Choose a reason for hiding this comment

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

Now it's handled automatically if you use clone_chat_template (or chat_template_path from SFTConfig)

Choose a reason for hiding this comment

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

Thanks for the quick reply @qgallouedec but based on my reading of the documentation, it does not handle the modules_to_save issue that was described in this warning.

The user still needs to explicitly add modules_to_save in case new tokens are being added.

Is this the correct interpretation or am I missing something?

Choose a reason for hiding this comment

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

@qgallouedec Sorry for pinging again - But hoping I could understand this. Can you please point me to the correct implementation?

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