Spaces:
Sleeping
Sleeping
fix: Fixed prompt format
Browse files
app.py
CHANGED
@@ -18,10 +18,10 @@ def format_prompt(message, history):
|
|
18 |
logging.debug("Input Message: %s", message)
|
19 |
logging.debug("Input History: %s", history)
|
20 |
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
prompt += "
|
25 |
|
26 |
return prompt
|
27 |
|
@@ -29,6 +29,7 @@ def format_prompt(message, history):
|
|
29 |
def generate(
|
30 |
prompt, history, system_prompt, temperature=0.9, max_new_tokens=256, top_p=0.95, repetition_penalty=1.0,
|
31 |
):
|
|
|
32 |
logging.info("Generating Response")
|
33 |
logging.debug("Input Prompt: %s", prompt)
|
34 |
logging.debug("Input History: %s", history)
|
|
|
18 |
logging.debug("Input Message: %s", message)
|
19 |
logging.debug("Input History: %s", history)
|
20 |
|
21 |
+
for user_prompt, bot_response in history:
|
22 |
+
prompt += f"<s> [INST] {user_prompt} [/INST]"
|
23 |
+
prompt += f" {bot_response}</s> "
|
24 |
+
prompt += f"[INST] {message} [/INST]"
|
25 |
|
26 |
return prompt
|
27 |
|
|
|
29 |
def generate(
|
30 |
prompt, history, system_prompt, temperature=0.9, max_new_tokens=256, top_p=0.95, repetition_penalty=1.0,
|
31 |
):
|
32 |
+
"""Generates the text based on user prompt."""
|
33 |
logging.info("Generating Response")
|
34 |
logging.debug("Input Prompt: %s", prompt)
|
35 |
logging.debug("Input History: %s", history)
|