djstrong commited on
Commit
8d15c61
1 Parent(s): f3cc1ab

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -8
app.py CHANGED
@@ -34,6 +34,17 @@ def predict(message, history, system_prompt, temperature, max_new_tokens, top_k,
34
  for human, assistant in history:
35
  instruction += human + ' [/INST] ' + assistant + '</s>[INST]'
36
  instruction += ' ' + message + ' [/INST]'
 
 
 
 
 
 
 
 
 
 
 
37
  else:
38
  raise Exception("Incorrect chat template, select 'ChatML' or 'Mistral Instruct'")
39
  print(instruction)
@@ -86,17 +97,14 @@ gr.ChatInterface(
86
  title=EMOJI + " " + MODEL_NAME,
87
  description=DESCRIPTION,
88
  examples=[
89
- ["Can you solve the equation 2x + 3 = 11 for x?"],
90
- ["Write an epic poem about Ancient Rome."],
91
- ["Who was the first person to walk on the Moon?"],
92
- ["Use a list comprehension to create a list of squares for numbers from 1 to 10."],
93
- ["Recommend some popular science fiction books."],
94
- ["Can you write a short story about a time-traveling detective?"]
95
  ],
96
  additional_inputs_accordion=gr.Accordion(label="⚙️ Parameters", open=False),
97
  additional_inputs=[
98
- gr.Textbox("Perform the task to the best of your ability.", label="System prompt"),
99
- gr.Slider(0, 1, 0.8, label="Temperature"),
100
  gr.Slider(128, 4096, 1024, label="Max new tokens"),
101
  gr.Slider(1, 80, 40, label="Top K sampling"),
102
  gr.Slider(0, 2, 1.1, label="Repetition penalty"),
 
34
  for human, assistant in history:
35
  instruction += human + ' [/INST] ' + assistant + '</s>[INST]'
36
  instruction += ' ' + message + ' [/INST]'
37
+ elif CHAT_TEMPLATE == "Bielik":
38
+ stop_tokens = ["</s>"]
39
+ prompt_builder = ["<s>"]
40
+ for human, assistant in history:
41
+ if system_prompt:
42
+ prompt_builder.append(f"[INST] <<SYS>>\n{system_prompt}\n<</SYS>>\n\n{human} [/INST] {assistant}</s>")
43
+ system_prompt = None
44
+ else:
45
+ prompt_builder.append(f"[INST] {human} [/INST] {assistant}</s>")
46
+ prompt_builder.append(f"[INST] {message} [/INST]")
47
+ instruction = ''.join(prompt_builder)
48
  else:
49
  raise Exception("Incorrect chat template, select 'ChatML' or 'Mistral Instruct'")
50
  print(instruction)
 
97
  title=EMOJI + " " + MODEL_NAME,
98
  description=DESCRIPTION,
99
  examples=[
100
+ ["Kim jesteś?"],
101
+ ["Ile to jest 9+2-1?"],
102
+ ["Napisz mi coś miłego."]
 
 
 
103
  ],
104
  additional_inputs_accordion=gr.Accordion(label="⚙️ Parameters", open=False),
105
  additional_inputs=[
106
+ gr.Textbox("Jesteś pomocnym asystentem o imieniu Bielik.", label="System prompt"),
107
+ gr.Slider(0, 1, 0.6, label="Temperature"),
108
  gr.Slider(128, 4096, 1024, label="Max new tokens"),
109
  gr.Slider(1, 80, 40, label="Top K sampling"),
110
  gr.Slider(0, 2, 1.1, label="Repetition penalty"),