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

use tokenizer.chat_template by default for instruction type tasks #301

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

TK-21st
Copy link

@TK-21st TK-21st commented Jan 25, 2025

Changes

Use tokenizer.chat_template (if exists) for instruction type tasks by default.

Issue Addressed

This address the issue for models such as google/gemma-2-2b-it, where the instruction tokens are

--instruction_tokens "<start_of_turn>user\n","<end_of_turn>\n","<start_of_turn>model\n"

However, in the current implementation, because of string escaping, the prompt template escapes \n to \\n, which makes the final template different from the model's actual template. Additionally the current implementation doesn't add <bos> for tokenizers that use them by default.

Notes

Only tested on instruct-humaneval for google/gemma-2-2b-it and meta-llama/Llama-3.2-1B-Instruct for now.

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.

1 participant