ollama Ability to预加载嵌入模型

mrwjdhj3  于 2个月前  发布在  其他
关注(0)|答案(2)|浏览(31)

"空请求"技巧预加载模型目前不适用于嵌入模型。
来源:https://github.com/ollama/ollama/blob/main/docs/faq.md#how-can-i-preload-a-model-into-ollama-to-get-faster-response-times 和 #2431

$ curl http://localhost:11434/api/embed -d '{"model": "all-minilm:latest"}'
{"error":"invalid input type"}%
ollama --version
ollama version is 0.3.4
sgtfey8w

sgtfey8w1#

目前可以使用已弃用的/embeddings端点进行解决:

$ curl http://localhost:11434/api/embeddings -d '{"model": "all-minilm:latest"}'
{"embedding":[]}%

此外,看起来ollama-js类型也需要更新,.embed和.embeddings方法都需要input/prompt。

2w3kk1z5

2w3kk1z52#

我刚刚发送了一个带有无限keep_alive的丢弃请求,如下所示:

curl http://localhost:11434/api/embed -d "{\"input\": \"whatever\", \"model\": \"bge-m3\", \"keep_alive\": -1}"

相关问题