【大语言模型_5】xinference部署embedding模型和rerank模型

ops/2025/3/19 19:11:12/

一、安装xinference

pip install xinference

二、启动xinference

./xinference-local  --host=0.0.0.0  --port=5544

三、注册本地模型

1、注册embedding模型
curl -X POST "http://localhost:5544/v1/models" \
-H "Content-Type: application/json" \
-d '{"model_type": "embedding","model_name": "bce-embedding-base_v1",  "model_uid": "bce-embedding-base_v1",   "model_path": "/root/embed_rerank/bce-embedding-base_v1/" 
}'验证:
curl -X POST "http://localhost:5544/v1/embeddings" \
-H "Content-Type: application/json" \
-d '{"model": "bce-embedding-base_v1","input": ["需要嵌入的文本1", "这是第二个句子"]
}'2、注册rerank模型curl -X POST "http://localhost:5544/v1/models" \
-H "Content-Type: application/json" \
-d '{"model_type": "rerank",              "model_name": "bce-reranker-base_v1",     "model_uid": "bce-reranker-base_v1",   "model_path": "/root/embed_rerank/bce-reranker-base_v1" 
}'验证
curl -X POST "http://localhost:5544/v1/rerank" \
-H "Content-Type: application/json" \
-d '{"model": "bge-reranker-v2-m3","query": "What is Python?","documents": ["Python is a programming language.","Java is another language.","Python is used for web development."]
}'3、执行./xinference list 查看运行模型

四、删除模型

curl -X DELETE "http://localhost:5544/v1/models/bge-reranker-v2-m3"

五、备注

1、在cpu运行
  • 服务器有显卡但是选择用cpu加载

             启动xinference之前设置

              export CUDA_VISIBLE_DEVICES=""

  • 服务器无显卡会自动在cpu加载模型

2、在gpu运行

启动服务器前设置环境变量

export CUDA_VISIBLE_DEVICES=""

curl -X POST "http://localhost:5544/v1/models" \
-H "Content-Type: application/json" \
-d '{"model_type": "embedding","model_name": "bce-embedding-base_v1",  "model_uid": "bce-embedding-base_v1",   "model_path": "/root/zml/embed_rerank/bce-embedding-base_v1/" "gpu_idx": 1"n_gpu" : 1
}'备注:
gpu_idx :选用的显卡index
n_gpu:选定的显卡总张数


http://www.ppmy.cn/ops/167093.html

相关文章

单片机自学总结

自从工作以来,一直努力耕耘单片机,至今,颇有收获。从51单片机,PIC单片机,直到STM32,以及RTOS和Linux,几乎天天在搞:51单片机,STM8S207单片机,PY32F003单片机,…

微信小程序:修改提示信息placeholder颜色

方法一&#xff1a;使用 placeholder-style 直接在 input 或 textarea 组件中使用 placeholder-style 属性来设置 placeholder 的样式。 <input placeholder"请输入内容" placeholder-style"color: #999; font-size: 14px;" /> 或者&#xff1a; …

计算机网络--访问一个网页的全过程

文章目录 访问一个网页的全过程应用层在浏览器输入URL网址http://www.aspxfans.com:8080/news/index.aspboardID5&ID24618&page1#r_70732423通过DNS获取IP地址生成HTTP请求报文应用层最后 传输层传输层处理应用层报文建立TCP连接传输层最后 网络层网络层对TCP报文进行处…

Ollama 0.4 发布!支持 Llama 3.2 Vision,实现多模态 RAG

“ 阅读本文大概需要5分钟。 前言 最近&#xff0c;Ollama 推出了 0.4 版本&#xff0c;其中最大的亮点就是支持了 Llama 3.2 Vision 模型&#xff0c;该模型具备多模态特性&#xff0c;也就是说能够理解图像并将图像纳入提示词中进行处理&#xff0c;让模型更智能地处理RAG中…

hbuiderx的sass编译器报dart-sass等错误的解决方法

HBuilderX 4.5起&#xff0c;vue2的sass编译器由node-sass改为dart-sass。node-sass是已经被淘汰的不再维护的库&#xff0c;且不支持arm cpu。 node-sass有些过期语法在dart-sass上报错导致无法编译。 虽然默认为dart-sass&#xff0c;但HBuilderX 4.56版也提供了选项&#xf…

K8S学习之基础三十四:K8S之监控Prometheus部署pod版

使用 Kubernetes Pod 的方式部署 Prometheus 是一种常见的方法&#xff0c;尤其是在容器化和微服务架构中。以下是详细的步骤&#xff1a; 1. 创建命名空间&#xff08;可选&#xff09; 为了方便管理&#xff0c;可以为 Prometheus 创建一个单独的命名空间。 yaml 复制 a…

Spark 中agg的用法

在 Spark 中&#xff0c;agg 是用于对 DataFrame 进行聚合操作的函数。它可以同时对多个列应用多个聚合函数&#xff0c;并返回一个新的 DataFrame。agg 通常与 groupBy 结合使用&#xff0c;用于对分组后的数据进行聚合操作。 以下是 agg 的详细用法和示例。 1. agg 的基本用…

仿“东方甄选”直播商城小程序运营平台

在公域直播流量红利趋于饱和、流量成本大幅攀升的当下&#xff0c;私域直播为企业开辟了新的流量聚集和转化渠道&#xff0c;特别是对于那些希望在私域流量领域取得突破的品牌商家来说&#xff0c;直播场景以其独特的高频互动氛围&#xff0c;相比其他运营方式&#xff0c;展现…