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'
相关推荐
有为少年16 分钟前
从独立性、相关性到复杂动力系统
人工智能·深度学习·机器学习·数学建模
阿里云大数据AI技术16 分钟前
【新模型速递】PAI-Model Gallery云上一键部署Qwen3.5模型
人工智能
KG_LLM图谱增强大模型19 分钟前
AgentRxiv:迈向协作式自主科学研究新范式
人工智能·知识图谱
人工智能培训23 分钟前
超级人工智能(AGI)是否是大模型的必然发展方向?
人工智能·深度学习·逻辑回归·agi·具身智能·大模型应用工程师·企业ai培训
Omigeq30 分钟前
1.2.2 - 采样搜索算法(以RRT和RRT*为例) - Python运动规划库教程(Python Motion Planning)
开发语言·人工智能·python·机器人
mantch34 分钟前
教程:Nano-Banana Pro,谷歌官方指南
人工智能·aigc
机器之心1 小时前
又快又省?仅5%参数、训练快4倍!ArcFlow用「非线性」魔法实现FLUX/Qwen推理40倍加速
人工智能·openai
机器之心1 小时前
DeepMind:智能体越多越乱,Agent天花板出现了?
人工智能·openai
banmajiyu1 小时前
异或问题(XOR Question):从单层感知机到多层感知机
人工智能