ollama bge-m3 Embending模型永久加载 does not support generate
背景
想要让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.targetsudo systemctl daemon-reloadsudo systemctl restart ollama