Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Make prompt fully compliant with spec
Browse filescc
@ysharma
,
@ArthurZ
,
@osanseviero
app.py
CHANGED
@@ -34,12 +34,17 @@ examples=[
|
|
34 |
|
35 |
|
36 |
def predict(message, chatbot):
|
37 |
-
|
38 |
-
|
|
|
39 |
for interaction in chatbot:
|
40 |
-
|
|
|
|
|
|
|
41 |
|
42 |
-
|
|
|
43 |
|
44 |
data = {
|
45 |
"inputs": input_prompt,
|
|
|
34 |
|
35 |
|
36 |
def predict(message, chatbot):
|
37 |
+
# The first user message is _not_ stripped
|
38 |
+
do_strip = False
|
39 |
+
input_prompt = f"<s>[INST] <<SYS>>\n{system_message}\n<</SYS>>\n\n "
|
40 |
for interaction in chatbot:
|
41 |
+
user_message = str(interaction[0])
|
42 |
+
user_message = user_message.strip() if do_strip else user_message
|
43 |
+
do_strip = True
|
44 |
+
input_prompt = input_prompt + user_message + " [/INST] " + str(interaction[1]).strip() + " </s><s>[INST] "
|
45 |
|
46 |
+
message = str(message).strip() if do_strip else str(message)
|
47 |
+
input_prompt = input_prompt + message + " [/INST]"
|
48 |
|
49 |
data = {
|
50 |
"inputs": input_prompt,
|