Skip to content

💔 [SFT] Raise error when formatting_func is used with completion_only_loss #3385

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

Merged

Conversation

LeonEricsson
Copy link
Collaborator

@LeonEricsson LeonEricsson commented Apr 29, 2025

What does this PR do?

Succeeds #3381. Instead of extending formatting_func to support prompt-completion we update the documentation and raise an error whenever a formatting function is passed together with completion_only_loss=True

Fixes #3343

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? 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.

Comment on lines 344 to 345
"which is incompatible with completion-only loss. The completion_only_loss is True either because "
"you explicitly set it or because your dataset is in prompt-completion format."
Copy link
Member

Choose a reason for hiding this comment

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

Can you incorporate the following recommendation? I think it's more actionable:

apply your format function before passing your dataset, or alternatively, disable completion_only_loss in SFTConfig.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Have a look now and tell me what you think

Copy link
Member

@qgallouedec qgallouedec left a comment

Choose a reason for hiding this comment

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

nice, thanks!

@qgallouedec qgallouedec changed the title [SFT] Handle formatting_func + completion_only_loss [SFT] Raise error when formatting_func is used with completion_only_loss May 1, 2025
@qgallouedec qgallouedec changed the title [SFT] Raise error when formatting_func is used with completion_only_loss 💔 [SFT] Raise error when formatting_func is used with completion_only_loss May 1, 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 merged commit c163cf5 into huggingface:main May 1, 2025
9 checks passed
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.

[SFT] formatting_func ignored.. with completion only loss
3 participants