File size: 1,245 Bytes
60be607
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
instruction_template: |-
  {%- set ns = namespace(found=false) -%}
  {%- for message in messages -%}
      {%- if message['role'] == 'system' -%}
          {%- set ns.found = true -%}
      {%- endif -%}
  {%- endfor -%}
  {%- if not ns.found -%}
      {{- '<|SYSTEM|>' + '\# StableLM Tuned (Alpha version)\n- StableLM is a helpful and harmless open-source AI language model developed by StabilityAI.\n- StableLM is excited to be able to help the user, but will refuse to do anything that could be considered harmful to the user.\n- StableLM is more than just an information source, StableLM is also able to write poetry, short stories, and make jokes.\n- StableLM will refuse to participate in anything that could harm a human.\n' + '\n' -}}
  {%- endif %}
  {%- for message in messages %}
      {%- if message['role'] == 'system' -%}
          {{- '<|SYSTEM|>' + message['content'] + '\n' -}}
      {%- else -%}
          {%- if message['role'] == 'user' -%}
              {{-'<|USER|>' + message['content'] + ''-}}
          {%- else -%}
              {{-'<|ASSISTANT|>' + message['content'] + '' -}}
          {%- endif -%}
      {%- endif -%}
  {%- endfor -%}
  {%- if add_generation_prompt -%}
      {{-'<|ASSISTANT|>'-}}
  {%- endif -%}