Text Generation
Transformers
Safetensors
Portuguese
Biatron
conversational
Fazzioni commited on
Commit
13b89a3
·
verified ·
1 Parent(s): 3eb18d0

Update chat_template.jinja

Browse files
Files changed (1) hide show
  1. chat_template.jinja +32 -12
chat_template.jinja CHANGED
@@ -1,4 +1,3 @@
1
- {{ bos_token }}
2
  {%- if messages[0]['role'] == 'system' -%}
3
  {%- if messages[0]['content'] is string -%}
4
  {%- set first_user_prefix = messages[0]['content'] + '
@@ -25,19 +24,40 @@
25
  {%- endif -%}
26
  {{ '<start_of_turn>' + role + '
27
  ' + (first_user_prefix if loop.first else "") }}
28
- {%- if message['content'] is string -%}
29
- {{ message['content'] | trim }}
30
- {%- elif message['content'] is iterable -%}
31
- {%- for item in message['content'] -%}
32
- {%- if item['type'] == 'text' -%}
33
- {{ item['text'] | trim }}
34
- {%- endif -%}
35
- {%- endfor -%}
 
 
 
 
 
 
 
 
 
 
36
  {%- else -%}
37
- {{ raise_exception("Invalid content type") }}
 
 
 
 
 
 
 
 
 
 
 
 
 
38
  {%- endif -%}
39
- {{ '<end_of_turn>
40
- ' }}
41
  {%- endfor -%}
42
  {%- if add_generation_prompt -%}
43
  {{'<start_of_turn>model
 
 
1
  {%- if messages[0]['role'] == 'system' -%}
2
  {%- if messages[0]['content'] is string -%}
3
  {%- set first_user_prefix = messages[0]['content'] + '
 
24
  {%- endif -%}
25
  {{ '<start_of_turn>' + role + '
26
  ' + (first_user_prefix if loop.first else "") }}
27
+
28
+ {%- if (message['role'] == 'assistant') -%}
29
+ {% generation %}
30
+ {%- if message['content'] is string -%}
31
+ {{ message['content'] | trim }}
32
+ {%- elif message['content'] is iterable -%}
33
+ {%- for item in message['content'] -%}
34
+ {%- if item['type'] == 'image' -%}
35
+ {{ '<start_of_image>' }}
36
+ {%- elif item['type'] == 'text' -%}
37
+ {{ item['text'] | trim }}
38
+ {%- endif -%}
39
+ {%- endfor -%}
40
+ {%- else -%}
41
+ {{ raise_exception("Invalid content type") }}
42
+ {%- endif -%}
43
+ {{ '<end_of_turn>' }}
44
+ {% endgeneration %}
45
  {%- else -%}
46
+ {%- if message['content'] is string -%}
47
+ {{ message['content'] | trim }}
48
+ {%- elif message['content'] is iterable -%}
49
+ {%- for item in message['content'] -%}
50
+ {%- if item['type'] == 'image' -%}
51
+ {{ '<start_of_image>' }}
52
+ {%- elif item['type'] == 'text' -%}
53
+ {{ item['text'] | trim }}
54
+ {%- endif -%}
55
+ {%- endfor -%}
56
+ {%- else -%}
57
+ {{ raise_exception("Invalid content type") }}
58
+ {%- endif -%}
59
+ {{ '<end_of_turn>' }}
60
  {%- endif -%}
 
 
61
  {%- endfor -%}
62
  {%- if add_generation_prompt -%}
63
  {{'<start_of_turn>model