背景

想要让bge-3m永久加载,通过使用api接口发现出现异常 does not support generate

curl http://localhost:11434/api/generate -d '{"model": "bge-m3:latest", "keep_alive": -1}'
{"error":"\"bge-m3:latest\" does not support generate"}

解决方案

通过在环境变量中增加OLLAMA_KEEP_ALIVE 解决

# cat /etc/systemd/system/ollama.service
[Unit]
Description=Ollama Service
After=network-online.target

[Service]
ExecStart=/usr/local/bin/ollama serve
User=ollama
Group=ollama
Restart=always
RestartSec=3
Environment="PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin"
Environment="OLLAMA_HOST=0.0.0.0:11434"
Environment="CUDA_VISIBLE_DEVICES=1"
Environment="OLLAMA_KEEP_ALIVE=-1"
[Install]
WantedBy=default.target

sudo systemctl daemon-reload

sudo systemctl restart ollama

Logo

中国智能体开发者社区,聚焦智能体与大模型开发,提供前沿资讯、实用工具链、开源项目及行业案例。通过技术沙龙、开发者大赛等活动,促进经验交流与协作,助力开发者快速构建创新智能应用。

更多推荐