[GH-ISSUE #247] 在进行模型调用时发现的跳过思考的问题 #181

Closed
opened 2026-10-26 21:16:20 +00:00 by bsakaguchi · 12 comments
Owner

Originally created by @69gg on GitHub (Feb 3, 2025).
Original GitHub issue: https://github.com/deepseek-ai/DeepSeek-R1/issues/247

回答示例:

--> ChatCompletionChunk(id='0194ca**********0ed88827a55c94', choices=[Choice(delta=ChoiceDelta(content='\n\n根据', function_call=None, refusal=None, role='assistant', tool_calls=None), finish_reason=None, index=0, logprobs=None, content_filter_results={'hate': {'filtered': False}, 'self_harm': {'filtered': False}, 'sexual': {'filtered': False}, 'violence': {'filtered': False}})], created=173****8, model='deepseek-ai/DeepSeek-R1', object='chat.completion.chunk', service_tier=None, system_fingerprint='', usage=CompletionUsage(completion_tokens=1085, prompt_tokens=55, total_tokens=1140, completion_tokens_details=None, prompt_tokens_details=None))


ChatCompletionChunk(id='0194ca2******************827a55c94', choices=[Choice(delta=ChoiceDelta(content='题目', function_call=None, refusal=None, role='assistant', tool_calls=None), finish_reason=None, index=0, logprobs=None, content_filter_results={'hate': {'filtered': False}, 'self_harm': {'filtered': False}, 'sexual': {'filtered': False}, 'violence': {'filtered': False}})], created=173*****18, model='deepseek-ai/DeepSeek-R1', object='chat.completion.chunk', service_tier=None, system_fingerprint='', usage=CompletionUsage(completion_tokens=1086, prompt_tokens=55, total_tokens=1141, completion_tokens_details=None, prompt_tokens_details=None))

可以看到,在模型输出时,输出了\n\n来跳过思考。
我也尝试使用了使用建议中的方法,即强制模型在输出时使用<think>\n作为开头({"role": "assistant", "content": "<think>\n"}):

>>> from openai import OpenAI
>>>
>>> client = OpenAI(api_key="sk-***************************", base_url="https://api.siliconflow.cn/v1")
>>> response = client.chat.completions.create(
...     model='deepseek-ai/DeepSeek-R1',
...     messages=[
...         {'role': 'user',
...         'content': "中国大模型行业2025年将会迎来哪些机遇和挑战"}, {"role": "assistant", "content": "<think>\n"}
...     ],
...     stream=True
... )
>>>
>>> for chunk in response:
...     print(chunk.choices[0].delta.content, end='')
...


中国大模型行业在2025年将处于技术与应用快速迭代的关键阶段。随着政策支持、技术突破和市场需求的多重驱动,这一领域既会迎来重大机遇,也面临复杂挑战。以下是具体的分析:

---

### **一、核心机遇**
1. **政策红利加速释放**
   - **国家级AI战略推动**:2025年作为“十四五”规划的收官之年,政策将持续倾斜于AI基础设施与核心算法研发。地方政府可能推出 专项基金支持大模型落地,尤其在“新基建”领域(如智能城市、工业互联网)的应用会获得更多资源。
   - **数据开放与监管协同**:公共数据授权运营试点可能扩大,部分高价值行业数据(如医疗、交通)向合规企业开放,推动垂直领 域大模型的训练效率提升。

2. **技术突破与生态成熟**
   - **算力自主化提速**:华为昇腾、寒武纪等国产芯片产能提升,结合分布式训练技术和低功耗架构优化,2025年或出现支持千亿参 数模型训练的本土化算力集群,降低对英伟达等供应链依赖。
   - **轻量化与行业定制**:模型压缩技术(如知识蒸馏)和微调工具链的完善,将推动企业能以更低成本开发专用模型(如金融风控 、智能制造场景下的“小参数高精度”模型)。

3. **垂直化应用的规模化爆发**
   - **产业智能化升级**:在制造业,大模型将深度融入产品设计(如生成式AI辅助工业设计)、供应链优化(需求预测)和故障诊断 领域,推动“AI+工业”市场规模增长。
   - **医疗与科学研究的革命**:多模态大模型在基因序列分析、药物分子生成中的效率可能超越传统方法,通过国家支持的医疗AI平 台实现快速商业化。

4. **国际化与标准输出**
   - **“一带一路”市场布局**:结合海外数字基建合作项目(如东南亚智慧城市),中国大模型可能输出本地化语言服务(如东南亚小 语种模型),抢占新兴市场。.......

可以看到不能。可能是我的调用方法不对(强制方法不对),请指正。

另附一开始回答所使用的代码:

import openai
import markdown  # 用于将 Markdown 转换为 HTML
import tempfile
import webbrowser
import re


def add_blockquote(match):
    # 仅处理标签内的内容
    content = match.group(1).strip()
    quoted_content = "\n".join([f"> {line}" for line in content.split("\n")])
    return f"<think>\n{quoted_content}\n</think>"  # 保持标签不变


client = openai.OpenAI(
    api_key="sk-***************",
    base_url="https://api.siliconflow.cn/v1",
)

messages = [
]

while True:
    #content = input(">>> ")
    
    content = ""
    print(">>> ", end="")
    try:
        while True:
            line = input()
            content += line + "\n"
    except KeyboardInterrupt:
        print("--> ", end="")
    
    
    messages.append({"role": "user", "content": content + "\n\n请进行深度思考,将思考内容放置在<think></think>标签内。回答时使用markdown+LaTeX标准格式。"}, {"role": "assistant", "content": "<think>\n"})

    completion = client.chat.completions.create(
        model='deepseek-ai/DeepSeek-R1',
        messages=messages,
        stream=True,
        max_tokens=8192,
        temperature=0.6,
        top_p=0.7,
        frequency_penalty=0.0,
    )

    collected_chunks = []
    collected_messages = []

    for chunk in completion:
        collected_messages.append(chunk.choices[0].delta.content)  # 保存消息
        if chunk.choices[0].delta.content:
            print(chunk, end="\n\n\n")  # 实时打印

    # 将完整回复加入消息历史
    full_reply = "".join([m for m in collected_messages if m])
    print("[DEBUG RAW REPLY]", full_reply)
    messages.append({"role": "assistant", "content": full_reply})
    print("\n")  # 在回复后添加换行

    # 将 Markdown 格式的回答转换为 HTML
    full_reply_fix = re.sub(
        r"<think>(.*?)</think>",  # 匹配标签对
        add_blockquote,
        full_reply,
        flags=re.DOTALL,
    )
    html_content = markdown.markdown(
        full_reply_fix.replace("<think>", "").replace("</think>", "\n---\n")
    )
    # 转换Markdown(禁用数学相关扩展)
    html = markdown.markdown(
    full_reply_fix,
    extensions=['tables', 'fenced_code', 'codehilite'],
    output_format='html5'
)

# 包裹完整HTML结构
    final_html = f"""
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>回答渲染</title>
    <!-- MathJax 配置 -->
    <script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
    <script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
    <style>
        .codehilite {{ background: #f8f8f8; padding: 10px; }}
        table {{ border-collapse: collapse; margin: 20px 0; }}
        th, td {{ border: 1px solid #ddd; padding: 8px; }}
    </style>
</head>
<body>
    {html}
</body>
</html>
"""



    # 将 HTML 内容写入临时文件,并使用默认浏览器打开
    with tempfile.NamedTemporaryFile(
        "w", delete=False, suffix=".html", encoding="utf-8"
    ) as f:
        f.write(final_html)
        temp_file_path = f.name

    webbrowser.open("file://" + temp_file_path)

注

  • 我使用了siliconflow的api服务
Originally created by @69gg on GitHub (Feb 3, 2025). Original GitHub issue: https://github.com/deepseek-ai/DeepSeek-R1/issues/247 回答示例: ```>>> 如果昨天是明天的话就好了,那么今天就是周五了。请问:实际上,句中的今天可能是周几? --> ChatCompletionChunk(id='0194ca**********0ed88827a55c94', choices=[Choice(delta=ChoiceDelta(content='\n\n根据', function_call=None, refusal=None, role='assistant', tool_calls=None), finish_reason=None, index=0, logprobs=None, content_filter_results={'hate': {'filtered': False}, 'self_harm': {'filtered': False}, 'sexual': {'filtered': False}, 'violence': {'filtered': False}})], created=173****8, model='deepseek-ai/DeepSeek-R1', object='chat.completion.chunk', service_tier=None, system_fingerprint='', usage=CompletionUsage(completion_tokens=1085, prompt_tokens=55, total_tokens=1140, completion_tokens_details=None, prompt_tokens_details=None)) ChatCompletionChunk(id='0194ca2******************827a55c94', choices=[Choice(delta=ChoiceDelta(content='题目', function_call=None, refusal=None, role='assistant', tool_calls=None), finish_reason=None, index=0, logprobs=None, content_filter_results={'hate': {'filtered': False}, 'self_harm': {'filtered': False}, 'sexual': {'filtered': False}, 'violence': {'filtered': False}})], created=173*****18, model='deepseek-ai/DeepSeek-R1', object='chat.completion.chunk', service_tier=None, system_fingerprint='', usage=CompletionUsage(completion_tokens=1086, prompt_tokens=55, total_tokens=1141, completion_tokens_details=None, prompt_tokens_details=None)) ``` 可以看到,在模型输出时,输出了\n\n来跳过思考。 我也尝试使用了*使用建议*中的方法,即强制模型在输出时使用\<think\>\\n作为开头(`{"role": "assistant", "content": "<think>\n"}`): ``` >>> from openai import OpenAI >>> >>> client = OpenAI(api_key="sk-***************************", base_url="https://api.siliconflow.cn/v1") >>> response = client.chat.completions.create( ... model='deepseek-ai/DeepSeek-R1', ... messages=[ ... {'role': 'user', ... 'content': "中国大模型行业2025年将会迎来哪些机遇和挑战"}, {"role": "assistant", "content": "<think>\n"} ... ], ... stream=True ... ) >>> >>> for chunk in response: ... print(chunk.choices[0].delta.content, end='') ... 中国大模型行业在2025年将处于技术与应用快速迭代的关键阶段。随着政策支持、技术突破和市场需求的多重驱动,这一领域既会迎来重大机遇,也面临复杂挑战。以下是具体的分析: --- ### **一、核心机遇** 1. **政策红利加速释放** - **国家级AI战略推动**:2025年作为“十四五”规划的收官之年,政策将持续倾斜于AI基础设施与核心算法研发。地方政府可能推出 专项基金支持大模型落地,尤其在“新基建”领域(如智能城市、工业互联网)的应用会获得更多资源。 - **数据开放与监管协同**:公共数据授权运营试点可能扩大,部分高价值行业数据(如医疗、交通)向合规企业开放,推动垂直领 域大模型的训练效率提升。 2. **技术突破与生态成熟** - **算力自主化提速**:华为昇腾、寒武纪等国产芯片产能提升,结合分布式训练技术和低功耗架构优化,2025年或出现支持千亿参 数模型训练的本土化算力集群,降低对英伟达等供应链依赖。 - **轻量化与行业定制**:模型压缩技术(如知识蒸馏)和微调工具链的完善,将推动企业能以更低成本开发专用模型(如金融风控 、智能制造场景下的“小参数高精度”模型)。 3. **垂直化应用的规模化爆发** - **产业智能化升级**:在制造业,大模型将深度融入产品设计(如生成式AI辅助工业设计)、供应链优化(需求预测)和故障诊断 领域,推动“AI+工业”市场规模增长。 - **医疗与科学研究的革命**:多模态大模型在基因序列分析、药物分子生成中的效率可能超越传统方法,通过国家支持的医疗AI平 台实现快速商业化。 4. **国际化与标准输出** - **“一带一路”市场布局**:结合海外数字基建合作项目(如东南亚智慧城市),中国大模型可能输出本地化语言服务(如东南亚小 语种模型),抢占新兴市场。....... ``` 可以看到不能。可能是我的调用方法不对(强制方法不对),请指正。 ## 另附一开始回答所使用的代码: ```python import openai import markdown # 用于将 Markdown 转换为 HTML import tempfile import webbrowser import re def add_blockquote(match): # 仅处理标签内的内容 content = match.group(1).strip() quoted_content = "\n".join([f"> {line}" for line in content.split("\n")]) return f"<think>\n{quoted_content}\n</think>" # 保持标签不变 client = openai.OpenAI( api_key="sk-***************", base_url="https://api.siliconflow.cn/v1", ) messages = [ ] while True: #content = input(">>> ") content = "" print(">>> ", end="") try: while True: line = input() content += line + "\n" except KeyboardInterrupt: print("--> ", end="") messages.append({"role": "user", "content": content + "\n\n请进行深度思考,将思考内容放置在<think></think>标签内。回答时使用markdown+LaTeX标准格式。"}, {"role": "assistant", "content": "<think>\n"}) completion = client.chat.completions.create( model='deepseek-ai/DeepSeek-R1', messages=messages, stream=True, max_tokens=8192, temperature=0.6, top_p=0.7, frequency_penalty=0.0, ) collected_chunks = [] collected_messages = [] for chunk in completion: collected_messages.append(chunk.choices[0].delta.content) # 保存消息 if chunk.choices[0].delta.content: print(chunk, end="\n\n\n") # 实时打印 # 将完整回复加入消息历史 full_reply = "".join([m for m in collected_messages if m]) print("[DEBUG RAW REPLY]", full_reply) messages.append({"role": "assistant", "content": full_reply}) print("\n") # 在回复后添加换行 # 将 Markdown 格式的回答转换为 HTML full_reply_fix = re.sub( r"<think>(.*?)</think>", # 匹配标签对 add_blockquote, full_reply, flags=re.DOTALL, ) html_content = markdown.markdown( full_reply_fix.replace("<think>", "").replace("</think>", "\n---\n") ) # 转换Markdown(禁用数学相关扩展) html = markdown.markdown( full_reply_fix, extensions=['tables', 'fenced_code', 'codehilite'], output_format='html5' ) # 包裹完整HTML结构 final_html = f""" <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>回答渲染</title> <!-- MathJax 配置 --> <script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script> <script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script> <style> .codehilite {{ background: #f8f8f8; padding: 10px; }} table {{ border-collapse: collapse; margin: 20px 0; }} th, td {{ border: 1px solid #ddd; padding: 8px; }} </style> </head> <body> {html} </body> </html> """ # 将 HTML 内容写入临时文件,并使用默认浏览器打开 with tempfile.NamedTemporaryFile( "w", delete=False, suffix=".html", encoding="utf-8" ) as f: f.write(final_html) temp_file_path = f.name webbrowser.open("file://" + temp_file_path) ``` # 注 - 我使用了siliconflow的api服务
Author
Owner

@CrazyBoyM commented on GitHub (Feb 4, 2025):

我也是深受这个问题困扰,使用api从R1蒸馏数据,发现官网的都可以顺利产生思维过程,但是从百度云千帆、siliconflow、opendev的三方自部署api都不行,刷了一夜的数据大部分都没有思维链,不知道是不是他们这些第三方R1 api提供方偷偷部署的缩水版本R1的原因。从国外的fireworks平台提供的R1 api可以

<!-- gh-comment-id:2632456899 --> @CrazyBoyM commented on GitHub (Feb 4, 2025): 我也是深受这个问题困扰,使用api从R1蒸馏数据,发现官网的都可以顺利产生思维过程,但是从百度云千帆、siliconflow、opendev的三方自部署api都不行,刷了一夜的数据大部分都没有思维链,不知道是不是他们这些第三方R1 api提供方偷偷部署的缩水版本R1的原因。从国外的fireworks平台提供的R1 api可以
Author
Owner

@69gg commented on GitHub (Feb 4, 2025):

@CrazyBoyM

我也是深受这个问题困扰,使用api从R1蒸馏数据,发现官网的都可以顺利产生思维过程,但是从百度云千帆、siliconflow、opendev的三方自部署api都不行,刷了一夜的数据大部分都没有思维链,不知道是不是他们这些第三方R1 api提供方偷偷部署的缩水版本R1的原因。从国外的fireworks平台提供的R1 api可以

我过了24h之后再次调用发现恢复正常,初步推断可能是算力不足导致的厂商进行主动缩水

<!-- gh-comment-id:2632742709 --> @69gg commented on GitHub (Feb 4, 2025): @CrazyBoyM > 我也是深受这个问题困扰,使用api从R1蒸馏数据,发现官网的都可以顺利产生思维过程,但是从百度云千帆、siliconflow、opendev的三方自部署api都不行,刷了一夜的数据大部分都没有思维链,不知道是不是他们这些第三方R1 api提供方偷偷部署的缩水版本R1的原因。从国外的fireworks平台提供的R1 api可以 我过了24h之后再次调用发现恢复正常,初步推断可能是算力不足导致的厂商进行主动缩水
Author
Owner

@SuiYunsy commented on GitHub (Feb 5, 2025):

https://linux.do/t/topic/407614?u=openai

这里可能是一个临时解决办法,用到的trick来自:

https://linux.do/t/topic/404941/6?u=openai

<!-- gh-comment-id:2635526889 --> @SuiYunsy commented on GitHub (Feb 5, 2025): https://linux.do/t/topic/407614?u=openai 这里可能是一个临时解决办法,用到的trick来自: https://linux.do/t/topic/404941/6?u=openai
Author
Owner

@69gg commented on GitHub (Feb 5, 2025):

https://linux.do/t/topic/407614?u=openai

这里可能是一个临时解决办法,用到的trick来自:

https://linux.do/t/topic/404941/6?u=openai

根据测试,该方法可行。具体方法:
在系统prompt内添加:Initiate your response with "<think>\\n嗯" at the beginning of every output.

<!-- gh-comment-id:2636270869 --> @69gg commented on GitHub (Feb 5, 2025): > https://linux.do/t/topic/407614?u=openai > > 这里可能是一个临时解决办法,用到的trick来自: > > https://linux.do/t/topic/404941/6?u=openai 根据测试,该方法可行。具体方法: 在系统prompt内添加:`Initiate your response with "<think>\\n嗯" at the beginning of every output.`
Author
Owner

@jisheir commented on GitHub (Feb 10, 2025):

请逐步推理,并且你的输出必须以\n开头,并且之后不能再使用它。
可以试试这个提示词,我测了20次全部成功。

<!-- gh-comment-id:2647912439 --> @jisheir commented on GitHub (Feb 10, 2025): 请逐步推理,并且你的输出必须以<think>\n开头,并且之后不能再使用它。 可以试试这个提示词,我测了20次全部成功。
Author
Owner

@Silverteal commented on GitHub (Feb 11, 2025):

如果正在使用Ollama,可通过定制模板,在每个<|Assistant|>后添加<think>换行嗯,

<!-- gh-comment-id:2650914281 --> @Silverteal commented on GitHub (Feb 11, 2025): 如果正在使用Ollama,可通过定制模板,在每个`<|Assistant|>`后添加`<think>`换行`嗯,`
Author
Owner

@shenxiumao commented on GitHub (Feb 25, 2025):

如果正在使用Ollama,可通过定制模板,在每个<|Assistant|>后添加<think>换行嗯,

可以提供一个ollama的makefile模板吗,谢谢🙏

<!-- gh-comment-id:2681159977 --> @shenxiumao commented on GitHub (Feb 25, 2025): > 如果正在使用Ollama,可通过定制模板,在每个`<|Assistant|>`后添加`<think>`换行`嗯,` 可以提供一个ollama的makefile模板吗,谢谢🙏
Author
Owner

@69gg commented on GitHub (Mar 2, 2025):

FROM DEEPSEEK:xxxB
SYSTEM 请逐步推理,并且你的输出必须以\n开头,并且之后不能再使用它。

如果正在使用Ollama,可通过定制模板,在每个<|Assistant|>后添加<think>换行嗯,

可以提供一个ollama的makefile模板吗,谢谢🙏

<!-- gh-comment-id:2692556151 --> @69gg commented on GitHub (Mar 2, 2025): FROM DEEPSEEK:xxxB SYSTEM 请逐步推理,并且你的输出必须以\n开头,并且之后不能再使用它。 > > 如果正在使用Ollama,可通过定制模板,在每个`<|Assistant|>`后添加`<think>`换行`嗯,` > > 可以提供一个ollama的makefile模板吗,谢谢🙏
Author
Owner

@victory-zz commented on GitHub (Mar 12, 2025):

https://linux.do/t/topic/407614?u=openai
这里可能是一个临时解决办法,用到的trick来自:
https://linux.do/t/topic/404941/6?u=openai

根据测试,该方法可行。具体方法: 在系统prompt内添加:Initiate your response with "<think>\\n嗯" at the beginning of every output.

大佬,我是用的是deepseek:r1:14b的模型,怎么做到像其他平台接入deepseek一样,可以通过按钮切换,控制模型不进行深度思考

<!-- gh-comment-id:2716080106 --> @victory-zz commented on GitHub (Mar 12, 2025): > > https://linux.do/t/topic/407614?u=openai > > 这里可能是一个临时解决办法,用到的trick来自: > > https://linux.do/t/topic/404941/6?u=openai > > 根据测试,该方法可行。具体方法: 在系统prompt内添加:`Initiate your response with "<think>\\n嗯" at the beginning of every output.` 大佬,我是用的是deepseek:r1:14b的模型,怎么做到像其他平台接入deepseek一样,可以通过按钮切换,控制模型不进行深度思考
Author
Owner

@Silverteal commented on GitHub (Mar 15, 2025):

如果正在使用Ollama,可通过定制模板,在每个<|Assistant|>后添加<think>换行嗯,

可以提供一个ollama的makefile模板吗,谢谢🙏

FROM deepseek-r1
TEMPLATE """{{- if .System }}{{ .System }}{{ end }}
{{- range $i, $_ := .Messages }}
{{- $last := eq (len (slice $.Messages $i)) 1}}
{{- if eq .Role "user" }}<|User|>{{ .Content }}
{{- else if eq .Role "assistant" }}<|Assistant|><think>
嗯,好的,{{ .Content }}{{- if not $last }}<|end▁of▁sentence|>{{- end }}
{{- end }}
{{- if and $last (ne .Role "assistant") }}<|Assistant|><think>
嗯,好的,{{- end }}
{{- end }}"""
PARAMETER temperature 0.6
PARAMETER stop <|begin▁of▁sentence|>
PARAMETER stop <|end▁of▁sentence|>
PARAMETER stop <|User|>
PARAMETER stop <|Assistant|>
LICENSE """MIT License

Copyright (c) 2023 DeepSeek

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
"""
<!-- gh-comment-id:2726211220 --> @Silverteal commented on GitHub (Mar 15, 2025): > > 如果正在使用Ollama,可通过定制模板,在每个`<|Assistant|>`后添加`<think>`换行`嗯,` > > 可以提供一个ollama的makefile模板吗,谢谢🙏 ``` FROM deepseek-r1 TEMPLATE """{{- if .System }}{{ .System }}{{ end }} {{- range $i, $_ := .Messages }} {{- $last := eq (len (slice $.Messages $i)) 1}} {{- if eq .Role "user" }}<|User|>{{ .Content }} {{- else if eq .Role "assistant" }}<|Assistant|><think> 嗯,好的,{{ .Content }}{{- if not $last }}<|end▁of▁sentence|>{{- end }} {{- end }} {{- if and $last (ne .Role "assistant") }}<|Assistant|><think> 嗯,好的,{{- end }} {{- end }}""" PARAMETER temperature 0.6 PARAMETER stop <|begin▁of▁sentence|> PARAMETER stop <|end▁of▁sentence|> PARAMETER stop <|User|> PARAMETER stop <|Assistant|> LICENSE """MIT License Copyright (c) 2023 DeepSeek Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. """ ```
Author
Owner

@Silverteal commented on GitHub (Mar 15, 2025):

https://linux.do/t/topic/407614?u=openai
这里可能是一个临时解决办法,用到的trick来自:
https://linux.do/t/topic/404941/6?u=openai

根据测试,该方法可行。具体方法: 在系统prompt内添加:Initiate your response with "<think>\\n嗯" at the beginning of every output.

大佬,我是用的是deepseek:r1:14b的模型,怎么做到像其他平台接入deepseek一样,可以通过按钮切换,控制模型不进行深度思考

官方版的聊天关闭思考按钮后实际上是用的V3模型。接入版不知道。但根据测试,可以Modelfile强行设置一个空白的思考内容。

<!-- gh-comment-id:2726211584 --> @Silverteal commented on GitHub (Mar 15, 2025): > > > https://linux.do/t/topic/407614?u=openai > > > 这里可能是一个临时解决办法,用到的trick来自: > > > https://linux.do/t/topic/404941/6?u=openai > > > > > > 根据测试,该方法可行。具体方法: 在系统prompt内添加:`Initiate your response with "<think>\\n嗯" at the beginning of every output.` > > 大佬,我是用的是deepseek:r1:14b的模型,怎么做到像其他平台接入deepseek一样,可以通过按钮切换,控制模型不进行深度思考 官方版的聊天关闭思考按钮后实际上是用的V3模型。接入版不知道。但根据测试,可以Modelfile强行设置一个空白的思考内容。
Author
Owner

@69gg commented on GitHub (Mar 15, 2025):

https://linux.do/t/topic/407614?u=openai
这里可能是一个临时解决办法,用到的trick来自:
https://linux.do/t/topic/404941/6?u=openai

根据测试,该方法可行。具体方法: 在系统prompt内添加:Initiate your response with "<think>\\n嗯" at the beginning of every output.

大佬,我是用的是deepseek:r1:14b的模型,怎么做到像其他平台接入deepseek一样,可以通过按钮切换,控制模型不进行深度思考

官方版的聊天关闭思考按钮后实际上是用的V3模型。接入版不知道。但根据测试,可以Modelfile强行设置一个空白的思考内容。

@Silverteal 我目前还不知道如何使用Malefile设置推理是否,但是你可以通过手动使用V3模型来让他不进行推理。参考此处官方说明进行使用。如何你使用python调用,可以将上下文存储于变量,不需要推理是更改model ID即可

<!-- gh-comment-id:2726499010 --> @69gg commented on GitHub (Mar 15, 2025): > > > > https://linux.do/t/topic/407614?u=openai > > > > 这里可能是一个临时解决办法,用到的trick来自: > > > > https://linux.do/t/topic/404941/6?u=openai > > > > > > > > > 根据测试,该方法可行。具体方法: 在系统prompt内添加:`Initiate your response with "<think>\\n嗯" at the beginning of every output.` > > > > > > 大佬,我是用的是deepseek:r1:14b的模型,怎么做到像其他平台接入deepseek一样,可以通过按钮切换,控制模型不进行深度思考 > > 官方版的聊天关闭思考按钮后实际上是用的V3模型。接入版不知道。但根据测试,可以Modelfile强行设置一个空白的思考内容。 @Silverteal 我目前还不知道如何使用Malefile设置推理是否,但是你可以通过手动使用V3模型来让他不进行推理。[参考此处官方说明](https://github.com/deepseek-ai/DeepSeek-V3)进行使用。如何你使用python调用,可以将上下文存储于变量,不需要推理是更改model ID即可
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
deepseek-ai/DeepSeek-R1#181
No description provided.