gokaygokay
commited on
Commit
•
b976407
1
Parent(s):
8511b86
Update app.py
Browse files
app.py
CHANGED
@@ -367,9 +367,18 @@ You are allowed to make up film and branding names, and do them like 80's, 90's
|
|
367 |
for response in stream:
|
368 |
if not response.token.text == "<|im_end|>":
|
369 |
output += response.token.text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
370 |
|
371 |
self.save_prompt(output)
|
372 |
return output
|
|
|
373 |
except Exception as e:
|
374 |
print(f"An error occurred: {e}")
|
375 |
return f"Error occurred while processing the request: {str(e)}"
|
|
|
367 |
for response in stream:
|
368 |
if not response.token.text == "<|im_end|>":
|
369 |
output += response.token.text
|
370 |
+
|
371 |
+
# Remove specific tokens based on the model
|
372 |
+
if model == "Llama 3":
|
373 |
+
output = output.rstrip("<|eot_id|>")
|
374 |
+
elif model == "Mistral":
|
375 |
+
output = output.rstrip("</s>")
|
376 |
+
elif model == "Mistral-Nemo":
|
377 |
+
output = output.rstrip("<|im_end|></s>")
|
378 |
|
379 |
self.save_prompt(output)
|
380 |
return output
|
381 |
+
|
382 |
except Exception as e:
|
383 |
print(f"An error occurred: {e}")
|
384 |
return f"Error occurred while processing the request: {str(e)}"
|