cpu环境利用xinference的docker镜像离线部署maidalun1020/bce-embedding-base_v1和BAAI/bge-reranker-v2-m3
1. 编写compose.yaml启动文件
version: '3.8' services: xinference: image: xprobe/xinference:v3.2.1-cpu container_name: xinference restart: unless-stopped ports: - "8890:9997" environment: - XINFERENCE_MODEL_SRC=local - XINFERENCE_HOME=/xinference-data - XINFERENCE_LOG_LEVEL=INFO # 禁用认证 - XINFERENCE_AUTH_ADVANCED=false volumes: - /data/xinference-models/:/models - /data/xinference-data/:/xinference-data command: - xinference-local - -H - 0.0.0.0
2. 下载模型文件
/data/xinference-models/bce-embedding-base_v1 drwxr-xr-x 2 root root 4096 Aug 27 13:03 1_Pooling -rw-r--r-- 1 root root 741 Aug 27 13:03 config.json -rw-r--r-- 1 root root 124 Aug 27 13:03 configuration.json -rw-r--r-- 1 root root 117 Aug 27 13:03 config_sentence_transformers.json -rw-r--r-- 1 root root 349 Aug 27 13:03 modules.json -rw-r--r-- 1 root root 925 Aug 27 13:03 README.md -rw-r--r-- 1 root root 54 Aug 27 13:03 sentence_bert_config.json -rw-r--r-- 1 root root 280 Aug 27 13:03 special_tokens_map.json -rw-r--r-- 1 root root 5069051 Aug 27 13:03 sentencepiece.bpe.model -rw-r--r-- 1 root root 1172 Aug 27 13:03 tokenizer_config.json -rw-r--r-- 1 root root 179968 Aug 27 13:03 Wechat.jpg -rw-r--r-- 1 root root 17098108 Aug 27 13:03 tokenizer.json -rw-r--r-- 1 root root 1112239014 Aug 27 13:04 pytorch_model.bin
/data/xinference-models/bge-reranker-v2-m3
-rw-r--r-- 1 root root 795 Aug 28 12:33 config.json
-rw-r--r-- 1 root root 77 Aug 28 12:33 configuration.json
drwxr-xr-x 2 root root 4096 Aug 28 12:33 assets
-rw-r--r-- 1 root root 17229 Aug 28 12:33 README.md
-rw-r--r-- 1 root root 964 Aug 28 12:33 special_tokens_map.json
-rw-r--r-- 1 root root 1173 Aug 28 12:33 tokenizer_config.json
-rw-r--r-- 1 root root 5069051 Aug 28 12:33 sentencepiece.bpe.model
-rw-r--r-- 1 root root 17098273 Aug 28 12:33 tokenizer.json
-rw-r--r-- 1 root root 2271071852 Aug 28 12:35 model.safetensors
3. 运行compose.yaml
docker compose up -d
4. 注册模型
curl -X POST http://localhost:9997/v1/models \ -H "Content-Type: application/json" \ -d '{ "model_name": "bce-embedding-base_v1", "model_type": "embedding", "model_path": "/models/bce-embedding-base_v1" }' curl -X POST http://localhost:9997/v1/models \ -H "Content-Type: application/json" \ -d '{ "model_name": "bge-reranker-v2-m3", "model_type": "rerank", "model_path": "/models/bge-reranker-v2-m3" }'

浙公网安备 33010602011771号