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

Standardize Chat Prompt Templates to Use Jinja Format #1525

Open
calycekr opened this issue Oct 16, 2024 · 8 comments
Open

Standardize Chat Prompt Templates to Use Jinja Format #1525

calycekr opened this issue Oct 16, 2024 · 8 comments
Labels
enhancement New feature or request

Comments

@calycekr
Copy link

Describe your feature request

Currently, the chatPromptTemplate for each model that can be set in env uses Handlebars format. However, the chat_prompt in the actual model's tokenizer_config.json uses Jinja format. This inconsistency is causing significant inconvenience. Since Jinja is widely used and preferred, it would be beneficial to standardize on Jinja format for both chatPromptTemplate and chat_prompt. This will improve consistency and ease of use for developers.

Screenshots (if relevant)

Implementation idea

To implement this change, the following steps can be taken:

  1. Update Codebase: Update the codebase to handle Jinja templates for chatPromptTemplate.

  2. Documentation: Update the documentation to reflect this change and provide examples of how to use Jinja templates.

  3. Testing: Thoroughly test the changes to ensure compatibility and that all existing templates work correctly with the new format.

@calycekr calycekr added the enhancement New feature or request label Oct 16, 2024
@nsarrazin
Copy link
Collaborator

This is a good idea! It would be a breaking change though so we could keep handlebars as a fallback if the jinja evaluator fails, wdyt?

@calycekr
Copy link
Author

@nsarrazin Sure, I agree with your suggestion. Keeping Handlebars as a fallback in case the Jinja evaluator fails is a good approach to ensure backward compatibility and smooth transition.

@julien-c
Copy link
Member

yep, seems like the field has standardized on Jinja in the past year 😁 cc @Rocketknight1 😮

@Rocketknight1
Copy link
Member

Rocketknight1 commented Oct 16, 2024

Please don't fire me, I know you liked Handlebars! 😰

(but yes transitioning to Jinja is definitely the right decision)

@julien-c
Copy link
Member

cements that we're a Python-first company (and community) i guess 😁

@varad0309
Copy link

hey guys, did you add this feature?

@nsarrazin
Copy link
Collaborator

@varad0309 the recommended way for now would be to set "tokenizer": to point to the model's repo on the hub so it can pick up the chat template (using Jinja) there.

@varad0309
Copy link

varad0309 commented Nov 20, 2024

@nsarrazin , thanks for the fast reply. Is there a way to do the same if we have a local model?
also, just tried "tokenizer" : Qwen/Qwen2.5-Coder-14B-Instruct. It is not working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants