docker部署本地词向量模型

开源项目:GitHub - huggingface/text-embeddings-inference: A blazing fast inference solution for text embeddings models

1. 下载词向量模型

参考我的另一篇博客:langchain 加载本地词向量模型

2. 部署词向量模型

就三行命令

复制代码
model=/data/BAAI/bge-m3
volume=/home/project/text_embedding/models
docker run -p 8082:80 -v $volume:/data --pull always ghcr.io/huggingface/text-embeddings-inference:cpu-1.5 --model-id $model

会先去下载 docker 镜像,然后运行容器。我这里下载的是 cpu 版本的 docker 镜像,其他硬件环境的 docker 镜像参考:https://huggingface.co/docs/text-embeddings-inference/supported_models

特别要强调的是:model 的路径可不是随便写的。在我的这个例子中,启动 docker 时,映射的路径是**$volume:/data** ,因此 model 的路径必须以**/data** 开头,不然的话是找不到模型的。

我的模型存放路径:/home/project/text_embedding/models/BAAI/bge-m3,大家可以参考我的路径来调整 model 和 volume 变量的值。

3. 调用词向量模型

使用 REST API 调用,可调用的 API 参考:Text Embeddings Inference API

复制代码
curl 127.0.0.1:8082/embed \
    -X POST \
    -d '{"inputs":"What is Deep Learning?"}' \
    -H 'Content-Type: application/json'
相关推荐
AI多Agent协作实战派3 小时前
【AI探索历程17】从“给自己用“到想“让别人用“
人工智能
吴佳浩4 小时前
Memory Provider 实战:Hermes、Mem0、Honcho、Hindsight 为什么都这样设计?
人工智能·agent·ai编程
吴佳浩4 小时前
企业级 Agent Memory 选型指南:如何构建可扩展的 Memory Service?
人工智能·agent·ai编程
北方的银狐-Zero5 小时前
ERP 管执行,数据管标准,OntoL本体 管思考:企业智能化升级的规划图
大数据·人工智能·本体论
浅安的邂逅6 小时前
260918-白帽把 OpenAI 论坛“打穿“了:攻防赛漏洞、账户被 Claude 入侵、模型偷偷掩盖不当行为
人工智能·大模型·ai编程·ai模型·行业动态
jinyishu_6 小时前
认识 AI Agent:概念、架构、设计模式与主流框架
人工智能
Hrain-AI6 小时前
AI 爬虫三档授权工程落地:搜索放行、训练拦截、Agent 分层(附脚本)
人工智能·elasticsearch·milvus
sunhy_csdn6 小时前
“词码”作为 Token 候选译名
人工智能
Hrain-AI6 小时前
多 Agent 并行不打架:worktree 隔离与反馈回流落地(附脚本)
网络·数据库·人工智能·架构