Spaces:
Running on Zero
Running on Zero
Upload app.py with huggingface_hub
Browse files
app.py
CHANGED
|
@@ -61,8 +61,8 @@ def split_reasoning(text: str, enable_thinking: bool) -> tuple[str, str]:
|
|
| 61 |
return "", text.strip()
|
| 62 |
if "</think>" in text:
|
| 63 |
reasoning, answer = text.split("</think>", 1)
|
| 64 |
-
return reasoning.strip(), answer.strip()
|
| 65 |
-
return text.strip(), ""
|
| 66 |
|
| 67 |
|
| 68 |
def history_to_messages(history: list[object] | None) -> list[dict[str, str]]:
|
|
@@ -150,7 +150,7 @@ def respond(
|
|
| 150 |
).to(model.device)
|
| 151 |
|
| 152 |
streamer = TextIteratorStreamer(
|
| 153 |
-
tokenizer, skip_prompt=True, skip_special_tokens=
|
| 154 |
)
|
| 155 |
gen_kwargs = dict(
|
| 156 |
**inputs,
|
|
|
|
| 61 |
return "", text.strip()
|
| 62 |
if "</think>" in text:
|
| 63 |
reasoning, answer = text.split("</think>", 1)
|
| 64 |
+
return reasoning.replace("<think>", "").strip(), answer.strip()
|
| 65 |
+
return text.replace("<think>", "").strip(), ""
|
| 66 |
|
| 67 |
|
| 68 |
def history_to_messages(history: list[object] | None) -> list[dict[str, str]]:
|
|
|
|
| 150 |
).to(model.device)
|
| 151 |
|
| 152 |
streamer = TextIteratorStreamer(
|
| 153 |
+
tokenizer, skip_prompt=True, skip_special_tokens=True
|
| 154 |
)
|
| 155 |
gen_kwargs = dict(
|
| 156 |
**inputs,
|