Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -14,6 +14,7 @@ DEFAULT_MODEL_PATH = model_file
|
|
14 |
|
15 |
from llama_cpp import Llama
|
16 |
llm = Llama(model_path=model_file, model_type="mistral")
|
|
|
17 |
|
18 |
|
19 |
def predict(input, chatbot, max_length, top_p, temperature, history):
|
@@ -21,7 +22,7 @@ def predict(input, chatbot, max_length, top_p, temperature, history):
|
|
21 |
response = ""
|
22 |
history.append(input)
|
23 |
|
24 |
-
for output in llm(input, stream=True, temperature=temperature, top_p=top_p, max_tokens=max_length, ):
|
25 |
piece = output['choices'][0]['text']
|
26 |
response += piece
|
27 |
chatbot[-1] = (chatbot[-1][0], response)
|
|
|
14 |
|
15 |
from llama_cpp import Llama
|
16 |
llm = Llama(model_path=model_file, model_type="mistral")
|
17 |
+
llm._token_eos = 7
|
18 |
|
19 |
|
20 |
def predict(input, chatbot, max_length, top_p, temperature, history):
|
|
|
22 |
response = ""
|
23 |
history.append(input)
|
24 |
|
25 |
+
for output in llm(input, stream=True, temperature=temperature, top_p=top_p, max_tokens=max_length, stop=["<|im_token|>"]):
|
26 |
piece = output['choices'][0]['text']
|
27 |
response += piece
|
28 |
chatbot[-1] = (chatbot[-1][0], response)
|