Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -113,16 +113,17 @@ def gpu_predict(model_path, device_map, torch_dtype,
|
|
| 113 |
)
|
| 114 |
output_res = output_text[0]
|
| 115 |
# 兼容原逻辑:提取 think> 之后的内容
|
| 116 |
-
try:
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
except Exception:
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
return new_prompt_ret, ""
|
|
|
|
| 126 |
except Exception as e:
|
| 127 |
# 失败则返回原始提示词和错误信息
|
| 128 |
return org_prompt_cot, f"推理失败:{e}"
|
|
|
|
| 113 |
)
|
| 114 |
output_res = output_text[0]
|
| 115 |
# 兼容原逻辑:提取 think> 之后的内容
|
| 116 |
+
# try:
|
| 117 |
+
# assert output_res.count("think>") == 2
|
| 118 |
+
# new_prompt_ret = output_res.split("think>")[-1]
|
| 119 |
+
# if new_prompt_ret.startswith("\n"):
|
| 120 |
+
# new_prompt = new_prompt_ret[1:]
|
| 121 |
+
# new_prompt = replace_single_quotes(new_prompt)
|
| 122 |
+
# except Exception:
|
| 123 |
+
# # 如果格式不符合预期,则直接回退为原始输入
|
| 124 |
+
# new_prompt_ret = org_prompt_cot
|
| 125 |
+
# return new_prompt_ret, ""
|
| 126 |
+
return output_res, ""
|
| 127 |
except Exception as e:
|
| 128 |
# 失败则返回原始提示词和错误信息
|
| 129 |
return org_prompt_cot, f"推理失败:{e}"
|