Skip to content

Commit

Permalink
Fix Llama 3.1 template including lengthy "tools" headers
Browse files Browse the repository at this point in the history
  • Loading branch information
oobabooga committed Jul 29, 2024
1 parent f4d95f3 commit 30b4d8c
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion modules/chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 30b4d8c

Please sign in to comment.