From 30b4d8c8b2103f89bf60a777ba5c750f5ebaf95a Mon Sep 17 00:00:00 2001 From: oobabooga <112222186+oobabooga@users.noreply.github.com> Date: Mon, 29 Jul 2024 11:51:40 -0700 Subject: [PATCH] Fix Llama 3.1 template including lengthy "tools" headers --- modules/chat.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/modules/chat.py b/modules/chat.py index 18fee9fa..00c4ffa9 100644 --- a/modules/chat.py +++ b/modules/chat.py @@ -92,8 +92,16 @@ def generate_chat_prompt(user_input, state, **kwargs): chat_template_str = replace_character_names(chat_template_str, state['name1'], state['name2']) instruction_template = jinja_env.from_string(state['instruction_template_str']) - instruct_renderer = partial(instruction_template.render, add_generation_prompt=False) chat_template = jinja_env.from_string(chat_template_str) + + instruct_renderer = partial( + instruction_template.render, + builtin_tools=None, + tools=None, + tools_in_user_message=False, + add_generation_prompt=False + ) + chat_renderer = partial( chat_template.render, add_generation_prompt=False,