Write list-valued parameter types as JSON and add a response template

#54
by Rocketknight1 HF Staff - opened

Writes a tool parameter's type as JSON when it's a list (["string", "null"] was printed as Python's ['string', 'null']), as the template already does for other schema values, and removes the duplicate copy of the template from tokenizer_config.json. It should work in Transformers, llama.cpp and vLLM. Also adds a response template, so Transformers' parse_response turns the model's output back into a message (content and tool calls), matching vLLM's own Qwen parser. The chat template also marks the assistant's output with {% generation %} tags, so return_assistant_tokens_mask (TRL's assistant_only_loss) trains on just that; the tags don't change the rendered text.

Ready to merge
This branch is ready to get merged automatically.

Sign up or log in to comment