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

Deprecate default chat templates #30346

Merged
merged 4 commits into from
Apr 19, 2024
Merged

Conversation

Rocketknight1
Copy link
Member

@Rocketknight1 Rocketknight1 commented Apr 19, 2024

Before we had chat templates, models had class-specific chat handling hardcoded into their tokenization.py files. In order to preserve backward compatibility, this class-level code was replaced with "default" chat templates. However, this has been a source of problems, because the default chat templates are often invalid for a given model, and because the default chat templates are being applied even to base models that have not been finetuned for chat or instruction following.

The whole point of chat templates was to be explicit, and to avoid silent errors and failures caused by incorrect templates being invisibly applied. Therefore, now that chat templates are widely adopted, I think the best solution is to deprecate default chat templates and remove them in the near future.

Default chat templates already raised warnings to indicate that they were error-prone; this PR makes the warnings far more explicit and sets a clear deprecation timeline. It also updates the chat template documentation to indicate that default chat templates are going away.

Copy link
Collaborator

@amyeroberts amyeroberts left a comment

Choose a reason for hiding this comment

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

LGTM!

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

@Rocketknight1 Rocketknight1 merged commit 0927bfd into main Apr 19, 2024
21 checks passed
@Rocketknight1 Rocketknight1 deleted the deprecate_default_chat_templates branch April 19, 2024 14:41
ArthurZucker pushed a commit that referenced this pull request Apr 22, 2024
* initial commit, remove warnings on default chat templates

* stash commit

* Raise a much sterner warning for default chat templates, and prepare for depreciation

* Update the docs
ydshieh pushed a commit that referenced this pull request Apr 23, 2024
* initial commit, remove warnings on default chat templates

* stash commit

* Raise a much sterner warning for default chat templates, and prepare for depreciation

* Update the docs
itazap pushed a commit that referenced this pull request May 14, 2024
* initial commit, remove warnings on default chat templates

* stash commit

* Raise a much sterner warning for default chat templates, and prepare for depreciation

* Update the docs
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.

3 participants