Skip to content

Commit 29292f1

Browse files
authored
markerv0.2 (#3992)
* markerv0.2 * marker2
1 parent 23754ba commit 29292f1

File tree

2 files changed

+40
-19
lines changed
  • docSite/content/zh-cn/docs/development/custom-models
  • plugins/model/pdf-marker

2 files changed

+40
-19
lines changed

docSite/content/zh-cn/docs/development/custom-models/marker.md

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,10 @@ PDF 是一个相对复杂的文件格式,在 FastGPT 内置的 pdf 解析器
2222
参考文档 [Marker 安装教程](https://github.com/labring/FastGPT/tree/main/plugins/model/pdf-marker),安装 Marker 模型。封装的 API 已经适配了 FastGPT 自定义解析服务。
2323

2424
这里介绍快速 Docker 安装的方法:
25-
2625
```dockerfile
27-
docker pull crpi-h3snc261q1dosroc.cn-hangzhou.personal.cr.aliyuncs.com/marker11/marker_images:latest
28-
docker run --gpus all -itd -p 7231:7231 --name model_pdf_v1 crpi-h3snc261q1dosroc.cn-hangzhou.personal.cr.aliyuncs.com/marker11/marker_images:latest
26+
docker pull crpi-h3snc261q1dosroc.cn-hangzhou.personal.cr.aliyuncs.com/marker11/marker_images:v0.2
27+
docker run --gpus all -itd -p 7231:7232 --name model_pdf_v2 -e PROCESSES_PER_GPU="2" crpi-h3snc261q1dosroc.cn-hangzhou.personal.cr.aliyuncs.com/marker11/marker_images:v0.2
2928
```
30-
3129
### 2. 添加 FastGPT 文件配置
3230

3331
```json
@@ -36,7 +34,7 @@ docker run --gpus all -itd -p 7231:7231 --name model_pdf_v1 crpi-h3snc261q1dosro
3634
"systemEnv": {
3735
xxx
3836
"customPdfParse": {
39-
"url": "http://xxxx.com/v1/parse/file", // 自定义 PDF 解析服务地址
37+
"url": "http://xxxx.com/v2/parse/file", // 自定义 PDF 解析服务地址 marker v0.2
4038
"key": "", // 自定义 PDF 解析服务密钥
4139
"doc2xKey": "", // doc2x 服务密钥
4240
"price": 0 // PDF 解析服务价格
@@ -80,4 +78,11 @@ docker run --gpus all -itd -p 7231:7231 --name model_pdf_v1 crpi-h3snc261q1dosro
8078

8179
上图是分块后的结果,下图是 pdf 原文。整体图片、公式、表格都可以提取出来,效果还是杠杠的。
8280

83-
不过要注意的是,[Marker](https://github.com/VikParuchuri/marker) 的协议是`GPL-3.0 license`,请在遵守协议的前提下使用。
81+
不过要注意的是,[Marker](https://github.com/VikParuchuri/marker) 的协议是`GPL-3.0 license`,请在遵守协议的前提下使用。
82+
## 旧版 Marker 使用方法
83+
如需使用旧版Marker可以使用以下命令:
84+
```dockerfile
85+
docker pull crpi-h3snc261q1dosroc.cn-hangzhou.personal.cr.aliyuncs.com/marker11/marker_images:v0.1
86+
docker run --gpus all -itd -p 7231:7231 --name model_pdf_v1 -e PROCESSES_PER_GPU="2" crpi-h3snc261q1dosroc.cn-hangzhou.personal.cr.aliyuncs.com/marker11/marker_images:v0.1
87+
```
88+
并将 FastGPT 文件配置中的url改为 "http://xxxx.com/v1/parse/file"

plugins/model/pdf-marker/Readme.md

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ export PROCESSES_PER_GPU="1"
7070
python api_mp.py
7171
```
7272

73-
# 镜像打包和部署
73+
# 镜像打包和部署(推荐)
7474

7575
## 本地构建镜像
7676

@@ -83,26 +83,42 @@ export PROCESSES_PER_GPU="1"
8383
```bash
8484
sudo docker run --gpus all -itd -p 7231:7231 --name model_pdf_v1 -e PROCESSES_PER_GPU="2" model_pdf
8585
```
86-
## 快速构建镜像
86+
## 快速构建镜像(推荐)
87+
### marker v0.1
8788
```dockerfile
88-
docker pull crpi-h3snc261q1dosroc.cn-hangzhou.personal.cr.aliyuncs.com/marker11/marker_images:latest
89-
docker run --gpus all -itd -p 7231:7231 --name model_pdf_v1 -e PROCESSES_PER_GPU="2" crpi-h3snc261q1dosroc.cn-hangzhou.personal.cr.aliyuncs.com/marker11/marker_images:latest
89+
docker pull crpi-h3snc261q1dosroc.cn-hangzhou.personal.cr.aliyuncs.com/marker11/marker_images:v0.1
90+
docker run --gpus all -itd -p 7231:7231 --name model_pdf_v1 -e PROCESSES_PER_GPU="2" crpi-h3snc261q1dosroc.cn-hangzhou.personal.cr.aliyuncs.com/marker11/marker_images:v0.1
91+
```
92+
*注意*:参数PROCESSES_PER_GPU设置每张显卡上文件处理的并行数量,24G的显卡可以设置为2。在多显卡的环境中会自动切换显卡来运行多文件的并行处理。
93+
94+
### marker v0.2
95+
```dockerfile
96+
docker pull crpi-h3snc261q1dosroc.cn-hangzhou.personal.cr.aliyuncs.com/marker11/marker_images:v0.2
97+
docker run --gpus all -itd -p 7231:7232 --name model_pdf_v2 -e PROCESSES_PER_GPU="2" crpi-h3snc261q1dosroc.cn-hangzhou.personal.cr.aliyuncs.com/marker11/marker_images:v0.2
9098
```
91-
*注意*:参数PROCESSES_PER_GPU设置每张显卡上文件处理的并行数量,24G的显卡可以设置为2。在多显卡的环境中会自动切换显卡来运行多文件的并行处理。
9299
# 访问示例
93100

94-
用Post方法访问端口为 `7321 ``v1/parse/file` 服务
101+
marker v0.1:用Post方法访问端口为 `7321 ``v1/parse/file` 服务
95102

96-
参数:file-->本地文件的地址
103+
marker v0.2:用Post方法访问端口为 `7321 ``v2/parse/file` 服务
97104

98-
- 访问方法
99105

100-
```
101-
curl --location --request POST "http://localhost:7231/v1/parse/file" \
102-
--header "Authorization: Bearer your_access_token" \
103-
--form "file=@./file/chinese_test.pdf"
104-
```
105106

107+
- 访问方法
108+
109+
- v0.1
110+
```
111+
curl --location --request POST "http://localhost:7231/v1/parse/file" \
112+
--header "Authorization: Bearer your_access_token" \
113+
--form "file=@./file/chinese_test.pdf"
114+
```
115+
参数:file-->本地文件的地址
116+
- v0.2
117+
```
118+
curl --location --request POST "http://localhost:7231/v2/parse/file" \
119+
--header "Authorization: Bearer your_access_token" \
120+
--form "file=@./file/chinese_test.pdf"
121+
```
106122
- 多文件测试数据
107123

108124
运行 `test` 文件下的 `test.py` 文件,修改里面的 `file_paths` 为自己仓库的 `url` 即可

0 commit comments

Comments
 (0)