Skip to content
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

⛔ Add EOS token to processed input in SFT #3091

Merged
merged 3 commits into from
Mar 15, 2025
Merged

⛔ Add EOS token to processed input in SFT #3091

merged 3 commits into from
Mar 15, 2025

Conversation

qgallouedec
Copy link
Member

Learn to generate EOS.

@qgallouedec qgallouedec changed the title Add EOS token to processed input in SFT ⛔ Add EOS token to processed input in SFT Mar 14, 2025
Copy link
Collaborator

@kashif kashif left a comment

Choose a reason for hiding this comment

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

for the gemma3 generation issue?

@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
Copy link
Member Author

qgallouedec commented Mar 14, 2025

No, actually there have been recurrent reports that SFT can't learn to generate EOS. I'm pretty sure #2405 re-introduced the bug reported in #1623

@qgallouedec qgallouedec merged commit 5cb390c into main Mar 15, 2025
14 checks passed
@qgallouedec qgallouedec deleted the fix-eos-sft branch March 15, 2025 01:06
@skandermoalla
Copy link
Contributor

skandermoalla commented Mar 15, 2025

@qgallouedec I've faced this multiple times. I think it's just because of the (not so good) practice in the examples everywhere setting the pad token to the eos token. Then the SFT preprocessing masks everything that's a pad token (=eos token), including the real eos token in the chat template.

@skandermoalla
Copy link
Contributor

Personally, I don't think these forced patches are a good design. I understand that you want the Trainers to work out of the box, but users should still make sure they have a chat template that adds an eos properly. In case someone doesn't want an eos they can't do that anymore now.
(Same for the DPOTrainer btw, I think it adds an extra eos token somewhere.)

@HwangYej1
Copy link

i got this TypeError: 'Qwen2TokenizerFast' object is not subscriptabl, after change this code

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.

5 participants