Skip to content

Initial implementation for chat template parameters #904

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

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

Conversation

LysandreJik
Copy link
Member

Enables passing chat template parameters as follows:

lighteval accelerate \
    model_name=Qwen/Qwen2.5-0.5B-Instruct,generation_parameters={temperature:1,top_p:1},chat_template_parameters={reasoning_effort:low} \
    leaderboard|truthfulqa:mc|0|0

It can probably be simplified and needs tests.

@HuggingFaceDocBuilderDev
Copy link
Collaborator

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
Member

@clefourrier clefourrier left a comment

Choose a reason for hiding this comment

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

Looking good - will also need to be added to the logger, most likely GeneralConfigLogger

matches = pattern.findall(args)
for key, value in matches:
key = key.strip()
if key == "generation_parameters":
gen_params = re.sub(r"(\w+):", r'"\1":', value)
generation_parameters_dict = json.loads(gen_params)
if key == "chat_template_parameters":
# Chat template parameters have strings as values that also need to be quoted
Copy link
Member

Choose a reason for hiding this comment

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

would be relevant to have tests for parsing edge cases

@LysandreJik LysandreJik force-pushed the chat_template_parameters branch from ad43991 to 20461a6 Compare August 7, 2025 14:29
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