Spaces:
Runtime error
Runtime error
Update model.py
Browse files
model.py
CHANGED
@@ -81,7 +81,7 @@ def get_input_token_length(message: str, chat_history: list[tuple[str, str]], sy
|
|
81 |
def run(message: str,
|
82 |
chat_history: list[tuple[str, str]],
|
83 |
system_prompt: str,
|
84 |
-
max_new_tokens: int =
|
85 |
temperature: float = 0.8,
|
86 |
top_p: float = 0.95,
|
87 |
top_k: int = 50) -> Iterator[str]:
|
@@ -107,5 +107,11 @@ def run(message: str,
|
|
107 |
|
108 |
outputs = []
|
109 |
for text in streamer:
|
110 |
-
|
111 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
def run(message: str,
|
82 |
chat_history: list[tuple[str, str]],
|
83 |
system_prompt: str,
|
84 |
+
max_new_tokens: int = 1024,
|
85 |
temperature: float = 0.8,
|
86 |
top_p: float = 0.95,
|
87 |
top_k: int = 50) -> Iterator[str]:
|
|
|
107 |
|
108 |
outputs = []
|
109 |
for text in streamer:
|
110 |
+
if "instruction:" in text:
|
111 |
+
# Append only the part of text before "instruction:" and stop streaming
|
112 |
+
outputs.append(text.split("instruction:")[0])
|
113 |
+
break
|
114 |
+
else:
|
115 |
+
outputs.append(text)
|
116 |
+
|
117 |
+
yield ''.join(outputs)
|