Spaces:
Running
Running
:boom: [Fix] Remove whole token which ends with stop_sequences
Browse files- configs/config.json +1 -1
- networks/huggingface_streamer.py +9 -10
configs/config.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
{
|
2 |
"app_name": "HuggingFace LLM API",
|
3 |
-
"version": "1.4.
|
4 |
"host": "0.0.0.0",
|
5 |
"port": 23333
|
6 |
}
|
|
|
1 |
{
|
2 |
"app_name": "HuggingFace LLM API",
|
3 |
+
"version": "1.4.1a",
|
4 |
"host": "0.0.0.0",
|
5 |
"port": 23333
|
6 |
}
|
networks/huggingface_streamer.py
CHANGED
@@ -157,16 +157,15 @@ class HuggingfaceStreamer:
|
|
157 |
|
158 |
content = self.parse_line(line)
|
159 |
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
content = content.replace(self.stop_sequences, "")
|
170 |
logger.back(content, end="")
|
171 |
|
172 |
output = self.message_outputer.output(
|
|
|
157 |
|
158 |
content = self.parse_line(line)
|
159 |
|
160 |
+
if content.strip().endswith(self.stop_sequences):
|
161 |
+
content_type = "Finished"
|
162 |
+
logger.success("\n[Finished]")
|
163 |
+
is_finished = True
|
164 |
+
else:
|
165 |
+
content_type = "Completions"
|
166 |
+
if line_count == 1:
|
167 |
+
content = content.lstrip()
|
168 |
+
|
|
|
169 |
logger.back(content, end="")
|
170 |
|
171 |
output = self.message_outputer.output(
|