由于ollama官网下载的大模型只支持2K上下文推理,会导致cline出现异常报错,所以需要改模型上下文长度到32K-128K
只需要在模型存储的目录下运行以下几条命令即可
1、获取Modelfile配置文件 名字需要使用ollama提供pull时完整的名字 ollama show --modelfile ticlazau/qwen2.5-coder-7b-instruct > Modelfile
2、修改Modelfile文件内容 32768=32k 131072=128K 根据模型和自己需求设置
PARAMETER num_ctx 131072
3、根据这个配置文件生成新的ticlazau/qwen2.5-coder-7b-instruct_32K
名称的模型 ollama create -f Modelfile ticlazau/qwen2.5-coder-7b-instruct_32K:ctx32k
4、完成啦!可以查看新模型的参数
ollama show ticlazau/qwen2.5-coder-7b-instruct_32K:ctx32k
5、运行新的模型命令
ollama run ticlazau/qwen2.5-coder-7b-instruct_32K:ctx32k