Spaces:
Runtime error
Runtime error
Fully comply to prompt specs (#7)
Browse files- Fully comply to prompt specs (1a429bb3298ed7f25ce10f09fe9b1facc7bb2c71)
model.py
CHANGED
@@ -23,10 +23,15 @@ tokenizer = AutoTokenizer.from_pretrained(model_id)
|
|
23 |
|
24 |
def get_prompt(message: str, chat_history: list[tuple[str, str]],
|
25 |
system_prompt: str) -> str:
|
26 |
-
texts = [f'[INST] <<SYS>>\n{system_prompt}\n<</SYS>>\n\n']
|
|
|
|
|
27 |
for user_input, response in chat_history:
|
28 |
-
|
29 |
-
|
|
|
|
|
|
|
30 |
return ''.join(texts)
|
31 |
|
32 |
|
|
|
23 |
|
24 |
def get_prompt(message: str, chat_history: list[tuple[str, str]],
|
25 |
system_prompt: str) -> str:
|
26 |
+
texts = [f'<s>[INST] <<SYS>>\n{system_prompt}\n<</SYS>>\n\n']
|
27 |
+
# The first user input is _not_ stripped
|
28 |
+
do_strip = False
|
29 |
for user_input, response in chat_history:
|
30 |
+
user_input = user_input.strip() if do_strip else user_input
|
31 |
+
do_strip = True
|
32 |
+
texts.append(f'{user_input} [/INST] {response.strip()} </s><s>[INST] ')
|
33 |
+
message = message.strip() if do_strip else message
|
34 |
+
texts.append(f'{message} [/INST]')
|
35 |
return ''.join(texts)
|
36 |
|
37 |
|