Skip to content

Commit

Permalink
Display thinking for deepseek r1
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinHuSh committed Feb 12, 2025
1 parent 9bcccad commit 99888b1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion deepdoc/vision/operators.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ class NormalizeImage(object):

def __init__(self, scale=None, mean=None, std=None, order='chw', **kwargs):
if isinstance(scale, str):
scale = np.float32(scale) if scale != 'None' else None
scale = eval(scale)
self.scale = np.float32(scale if scale is not None else 1.0 / 255.0)
mean = mean if mean is not None else [0.485, 0.456, 0.406]
std = std if std is not None else [0.229, 0.224, 0.225]
Expand Down
8 changes: 7 additions & 1 deletion rag/llm/chat_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,13 @@ def chat_streamly(self, system, history, gen_conf):
continue
if not resp.choices[0].delta.content:
resp.choices[0].delta.content = ""
ans += resp.choices[0].delta.content
if hasattr(resp.choices[0].delta, "reasoning_content") and resp.choices[0].delta.reasoning_content:
if ans.find("<think>") < 0:
ans += "<think>"
ans = ans.replace("</think>", "")
ans += resp.choices[0].delta.reasoning_content + "</think>"
else:
ans += resp.choices[0].delta.content

tol = self.total_token_count(resp)
if not tol:
Expand Down

0 comments on commit 99888b1

Please sign in to comment.