From d7bd3da35ed6c10b6ebcd7fd913f1e39221c7650 Mon Sep 17 00:00:00 2001 From: Guanghua Lu <102669562+Touch-Night@users.noreply.github.com> Date: Mon, 20 May 2024 07:17:26 +0800 Subject: [PATCH] Add Llama 3 instruction template (#5891) --- instruction-templates/Llama-v3.yaml | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 instruction-templates/Llama-v3.yaml diff --git a/instruction-templates/Llama-v3.yaml b/instruction-templates/Llama-v3.yaml new file mode 100644 index 00000000..ba96c7e2 --- /dev/null +++ b/instruction-templates/Llama-v3.yaml @@ -0,0 +1,13 @@ +instruction_template: |- + {%- set ns = namespace(found=false) -%} + {%- for message in messages -%} + {%- if message['role'] == 'system' -%} + {%- set ns.found = true -%} + {%- endif -%} + {%- endfor -%} + {%- for message in messages -%} + {{- '<|start_header_id|>' + message['role'] + '<|end_header_id|>\n\n' + message['content'].rstrip() + '<|eot_id|>' -}} + {%- endfor -%} + {%- if add_generation_prompt -%} + {{-'<|start_header_id|>assistant<|end_header_id|>\n\n'-}} + {%- endif -%}