ollama 提示词超过一定长度会被截断

1 原因:ollama默认的上下文长度是2048,需要人工创建新的模型并更改默认的上下文长度
2 操作步骤
1) 生成原模型配置文件:

ollama show  --modelfile 模型名  > current_modelfile.txt

2) 在生成的current_modelfile.txt文件中增加一个字段:

PARAMETER num_ctx 8192 

我这里将修改后的配置文件名改成了Modelfile
3) 创建新的模型

sudo ollama create 新名字 -f ./Modelfile
posted @ 2025-11-07 09:13  Milo-Chen  阅读(2)  评论(0)    收藏  举报