Spaces:
Sleeping
Sleeping
Upload app.py
Browse files
app.py
CHANGED
|
@@ -217,7 +217,7 @@ def call_llm(messages: List[dict], model: str, logs: List[str]) -> dict:
|
|
| 217 |
)
|
| 218 |
print("torch.no_grad")
|
| 219 |
# 解碼生成內容後
|
| 220 |
-
full_text = _hf_tok.decode(
|
| 221 |
gen_text = full_text[len(prompt):] if full_text.startswith(prompt) else full_text
|
| 222 |
logs.append(f"[LOCAL LLM] raw_len={len(gen_text)}")
|
| 223 |
logs.append(f"[LOCAL LLM] raw_head={gen_text[:200].replace(chr(10),' ')}") # 前 200 字方便 Debug
|
|
|
|
| 217 |
)
|
| 218 |
print("torch.no_grad")
|
| 219 |
# 解碼生成內容後
|
| 220 |
+
full_text = _hf_tok.decode(out_ids[0], skip_special_tokens=True)
|
| 221 |
gen_text = full_text[len(prompt):] if full_text.startswith(prompt) else full_text
|
| 222 |
logs.append(f"[LOCAL LLM] raw_len={len(gen_text)}")
|
| 223 |
logs.append(f"[LOCAL LLM] raw_head={gen_text[:200].replace(chr(10),' ')}") # 前 200 字方便 Debug
|