Update app.py
Browse files
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 |
-
["
|
90 |
-
["
|
91 |
-
["
|
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("
|
99 |
-
gr.Slider(0, 1, 0.
|
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"),
|