Jinja templates for Instruct and Chat (#4874)

This commit is contained in:
oobabooga 2023-12-12 17:23:14 -03:00 committed by GitHub
parent aab0dd962d
commit 39d2fe1ed9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
71 changed files with 1774 additions and 518 deletions

View file

@ -1,5 +1,25 @@
user: ""
bot: ""
turn_template: "[INST] <|user|><|user-message|> [/INST]<|bot|><|bot-message|></s> "
context: ""
system_message: ""
instruction_template: |-
{%- set found_item = false -%}
{%- for message in messages -%}
{%- if message['role'] == 'system' -%}
{%- set found_item = true -%}
{%- endif -%}
{%- endfor -%}
{%- if not found_item -%}
{{- '' + '' + '' -}}
{%- endif %}
{%- for message in messages %}
{%- if message['role'] == 'system' -%}
{{- '' + message['content'] + '' -}}
{%- else -%}
{%- if message['role'] == 'user' -%}
{{-'[INST] ' + message['content'] + ' [/INST]'-}}
{%- else -%}
{{-'' + message['content'] + '</s> ' -}}
{%- endif -%}
{%- endif -%}
{%- endfor -%}
{%- if add_generation_prompt -%}
{{-''-}}
{%- endif -%}