Update app.py
Browse files
app.py
CHANGED
|
@@ -46,8 +46,11 @@ def predict(message, system_message, max_new_tokens=4056, temperature=3.5, top_p
|
|
| 46 |
)
|
| 47 |
|
| 48 |
response = tokenizer.decode(response_ids[:, input_ids.shape[-1]:][0], skip_special_tokens=True)
|
| 49 |
-
|
|
|
|
|
|
|
| 50 |
|
|
|
|
| 51 |
with gr.Blocks(theme='ParityError/Anime') as demo:
|
| 52 |
gr.Markdown(DESCRIPTION)
|
| 53 |
with gr.Group():
|
|
|
|
| 46 |
)
|
| 47 |
|
| 48 |
response = tokenizer.decode(response_ids[:, input_ids.shape[-1]:][0], skip_special_tokens=True)
|
| 49 |
+
truncate_str = "<|im_end|>"
|
| 50 |
+
if truncate_str in response:
|
| 51 |
+
response = response.split(truncate_str)[0] + truncate_str
|
| 52 |
|
| 53 |
+
return [("bot", response)]
|
| 54 |
with gr.Blocks(theme='ParityError/Anime') as demo:
|
| 55 |
gr.Markdown(DESCRIPTION)
|
| 56 |
with gr.Group():
|