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

fix add_special_tokens issue for data with template #1509

Merged
merged 1 commit into from
Apr 22, 2024

Conversation

edixiong
Copy link
Contributor

@edixiong edixiong commented Apr 6, 2024

Fix the add_special_tokens issue as is mentioned in this issue: #1400

Fixes #1400

Copy link
Contributor

@younesbelkada younesbelkada left a comment

Choose a reason for hiding this comment

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

Thanks for the fix ! Can you slightly elaborate on why this should be the right fix? 🙏
cc @philschmid FYI

@edixiong
Copy link
Contributor Author

edixiong commented Apr 9, 2024

Hi @younesbelkada , in line 267, we check if there is a template. If true, dataset_formatting.py will call apply_chat_template and the special token will be added there. In sft_trainer.py, the input will be tokenized and the special token will be added again if we do not explicitly set that add_special_tokens to False. Another workaround is to warn the user to manually set add_special_tokens to False (similar to @philschmid did).

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

Copy link
Contributor

@younesbelkada younesbelkada left a comment

Choose a reason for hiding this comment

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

Thanks !

@younesbelkada younesbelkada merged commit abc0584 into huggingface:main Apr 22, 2024
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.

conversational data for SFTTrainer
3 participants