Update app.py
Browse files
app.py
CHANGED
|
@@ -28,10 +28,10 @@ def respond(
|
|
| 28 |
temperature,
|
| 29 |
top_p,
|
| 30 |
):
|
| 31 |
-
stop_tokens = ["</s>", "[INST]", "[INST] ", "<s>", "[/INST]", "[/INST] "]
|
| 32 |
chat_template = '<s>[INST] ' + system_message
|
| 33 |
-
for human, assistant in history:
|
| 34 |
-
|
| 35 |
chat_template += ' ' + message + ' [/INST]'
|
| 36 |
|
| 37 |
print(chat_template)
|
|
@@ -55,7 +55,7 @@ def respond(
|
|
| 55 |
verbose=True,
|
| 56 |
)
|
| 57 |
response = ""
|
| 58 |
-
for chunk in llm.stream_chat(
|
| 59 |
print(chunk.delta, end="", flush=True)
|
| 60 |
response += str(chunk.delta)
|
| 61 |
yield response
|
|
|
|
| 28 |
temperature,
|
| 29 |
top_p,
|
| 30 |
):
|
| 31 |
+
# stop_tokens = ["</s>", "[INST]", "[INST] ", "<s>", "[/INST]", "[/INST] "]
|
| 32 |
chat_template = '<s>[INST] ' + system_message
|
| 33 |
+
# for human, assistant in history:
|
| 34 |
+
# chat_template += human + ' [/INST] ' + assistant + '</s>[INST]'
|
| 35 |
chat_template += ' ' + message + ' [/INST]'
|
| 36 |
|
| 37 |
print(chat_template)
|
|
|
|
| 55 |
verbose=True,
|
| 56 |
)
|
| 57 |
response = ""
|
| 58 |
+
for chunk in llm.stream_chat(chat_template):
|
| 59 |
print(chunk.delta, end="", flush=True)
|
| 60 |
response += str(chunk.delta)
|
| 61 |
yield response
|