mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-24 22:03:54 +00:00

* 4.7-alpha3 (#62) * doc * Optimize possible null Pointers and parts of Ux * fix: mulity index training error * feat: doc and rename question guide * fix ios speech input (#59) * fix: prompt editor variables nowrap (#61) * change openapi import in http module with curl import (#60) * chore(ui): dataset import modal ui (#58) * chore(ui): dataset import modal ui * use component * fix height * 4.7 (#63) * fix: claude3 image type verification failed (#1038) (#1040) * perf: curl import modal * doc img * perf: adapt cohere rerank * perf: code * perf: input style * doc --------- Co-authored-by: xiaotian <dimsky@163.com> * fix: ts * docker deploy * perf: prompt call * doc * ts * finish ui * perf: outlink detail ux * perf: user schema * fix: plugin update * feat: get current time plugin * fix: ts * perf: fetch anamation * perf: mark ux * doc * perf: select app ux * fix: split text custom string conflict * peref: inform readed * doc * memo flow component * perf: version * faq * feat: flow max runtimes * feat: similarity tip * feat: auto detect file encoding * Supports asymmetric vector model * fix: ts * perf: max w * move code * perf: hide whisper * fix: ts * feat: system msg modal * perf: catch error * perf: inform tip * fix: inform --------- Co-authored-by: heheer <71265218+newfish-cmyk@users.noreply.github.com> Co-authored-by: xiaotian <dimsky@163.com>
91 lines
2.3 KiB
Markdown
91 lines
2.3 KiB
Markdown
---
|
||
title: '接入 ReRank 重排模型'
|
||
description: '接入 ReRank 重排模型'
|
||
icon: 'sort'
|
||
draft: false
|
||
toc: true
|
||
weight: 910
|
||
---
|
||
|
||
## 推荐配置
|
||
|
||
推荐配置如下:
|
||
|
||
{{< table "table-hover table-striped-columns" >}}
|
||
| 类型 | 内存 | 显存 | 硬盘空间 | 启动命令 |
|
||
|------|---------|---------|----------|--------------------------|
|
||
| base | >=4GB | >=3GB | >=8GB | python app.py |
|
||
{{< /table >}}
|
||
|
||
## 部署
|
||
|
||
### 环境要求
|
||
|
||
- Python 3.10.11
|
||
- CUDA 11.7
|
||
- 科学上网环境
|
||
|
||
### 源码部署
|
||
|
||
1. 根据上面的环境配置配置好环境,具体教程自行 GPT;
|
||
2. 下载 [python 文件](https://github.com/labring/FastGPT/tree/main/python/reranker/bge-reranker-base)
|
||
3. 在命令行输入命令 `pip install -r requirements.txt`;
|
||
4. 按照[https://huggingface.co/BAAI/bge-reranker-base](https://huggingface.co/BAAI/bge-reranker-base)下载模型仓库到app.py同级目录
|
||
5. 添加环境变量 `export ACCESS_TOKEN=XXXXXX` 配置 token,这里的 token 只是加一层验证,防止接口被人盗用,默认值为 `ACCESS_TOKEN` ;
|
||
6. 执行命令 `python app.py`。
|
||
|
||
然后等待模型下载,直到模型加载完毕为止。如果出现报错先问 GPT。
|
||
|
||
启动成功后应该会显示如下地址:
|
||
|
||

|
||
|
||
> 这里的 `http://0.0.0.0:6006` 就是连接地址。
|
||
|
||
### docker 部署
|
||
|
||
+ 镜像名: `luanshaotong/reranker:v0.2`
|
||
+ 端口号: 6006
|
||
+ 大小:约8GB
|
||
|
||
**设置安全凭证(即oneapi中的渠道密钥)**
|
||
```
|
||
ACCESS_TOKEN=mytoken
|
||
```
|
||
|
||
**运行命令示例**
|
||
- 无需GPU环境,使用CPU运行
|
||
```sh
|
||
docker run -d --name reranker -p 6006:6006 -e ACCESS_TOKEN=mytoken luanshaotong/reranker:v0.2
|
||
```
|
||
|
||
- 需要CUDA 11.7环境
|
||
```sh
|
||
docker run -d --gpus all --name reranker -p 6006:6006 -e ACCESS_TOKEN=mytoken luanshaotong/reranker:v0.2
|
||
```
|
||
|
||
**docker-compose.yml示例**
|
||
```
|
||
version: "3"
|
||
services:
|
||
reranker:
|
||
image: luanshaotong/reranker:v0.2
|
||
container_name: reranker
|
||
# GPU运行环境,如果宿主机未安装,将deploy配置隐藏即可
|
||
deploy:
|
||
resources:
|
||
reservations:
|
||
devices:
|
||
- driver: nvidia
|
||
count: all
|
||
capabilities: [gpu]
|
||
ports:
|
||
- 6006:6006
|
||
environment:
|
||
- ACCESS_TOKEN=mytoken
|
||
|
||
```
|
||
## 接入 FastGPT
|
||
|
||
参考 [ReRank模型接入](/docs/development/configuration/#rerank-接入),host 变量为部署的域名。
|