Add default chat_template

#24
by itazap HF Staff - opened
Files changed (1) hide show
  1. chat_template.jinja +5 -0
chat_template.jinja CHANGED
@@ -2,13 +2,18 @@
2
  {%- if content is string -%}
3
  {{- content -}}
4
  {%- else -%}
 
5
  {%- for item in content -%}
6
  {%- if item.type == 'audio' or 'audio' in item or 'audio_url' in item -%}
7
  {{- '<|audio_start|><|audio_pad|><|audio_end|>\n' -}}
8
  {%- elif item.type == 'text' -%}
9
  {{- item.text -}}
 
10
  {%- endif -%}
11
  {%- endfor -%}
 
 
 
12
  {%- endif -%}
13
  {%- endmacro -%}
14
  {%- if tools %}
 
2
  {%- if content is string -%}
3
  {{- content -}}
4
  {%- else -%}
5
+ {%- set ns = namespace(has_text=false) -%}
6
  {%- for item in content -%}
7
  {%- if item.type == 'audio' or 'audio' in item or 'audio_url' in item -%}
8
  {{- '<|audio_start|><|audio_pad|><|audio_end|>\n' -}}
9
  {%- elif item.type == 'text' -%}
10
  {{- item.text -}}
11
+ {%- set ns.has_text = true -%}
12
  {%- endif -%}
13
  {%- endfor -%}
14
+ {%- if not ns.has_text -%}
15
+ {{- '请将音频转写为文本,每一段需以起始时间戳和说话人编号([S01]、[S02]、[S03]…)开头,正文为对应的语音内容,并在段末标注结束时间戳,以清晰标明该段语音范围。' -}}
16
+ {%- endif -%}
17
  {%- endif -%}
18
  {%- endmacro -%}
19
  {%- if tools %}