LM Studio的模型设置中关闭模型推理过程后,大模型仍然输出了推理过程,原因是当这个设置关闭时,enable_thinking值变成了undefined,在模板代码中查看think相关的代码,发现是这样写的:
|
1 2 3 4 5 |
{%- if enable_thinking is defined and enable_thinking is false %} {{- '<think>\n\n</think>\n\n' }} {%- else %} {{- '<think>\n' }} {%- endif %} |
假如enable_thinking未定义,则默认输出think
在上面加一行代码,给enable_thinking设置一个默认值即可:
|
1 2 3 4 5 6 |
{%- set enable_thinking = enable_thinking | default(false) %} {%- if enable_thinking is false %} {{- '<think>\n\n</think>\n\n' }} {%- else %} {{- '<think>\n' }} {%- endif %} |

文章评论 暂无评论
暂无评论