Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
赵月辉
/
fastgpt-migrated
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Unverified
Commit
8980664b
authored
Mar 06, 2025
by
YeYuheng
Committed by
archer
Mar 06, 2025
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
markerv0.2 (#3992)
* markerv0.2 * marker2
parent
43f30b37
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
20 deletions
+41
-20
docSite/content/zh-cn/docs/development/custom-models/marker.md
+12
-7
plugins/model/pdf-marker/Readme.md
+29
-13
No files found.
docSite/content/zh-cn/docs/development/custom-models/marker.md
View file @
8980664b
...
@@ -22,12 +22,10 @@ PDF 是一个相对复杂的文件格式,在 FastGPT 内置的 pdf 解析器
...
@@ -22,12 +22,10 @@ PDF 是一个相对复杂的文件格式,在 FastGPT 内置的 pdf 解析器
参考文档
[
Marker 安装教程
](
https://github.com/labring/FastGPT/tree/main/plugins/model/pdf-marker
)
,安装 Marker 模型。封装的 API 已经适配了 FastGPT 自定义解析服务。
参考文档
[
Marker 安装教程
](
https://github.com/labring/FastGPT/tree/main/plugins/model/pdf-marker
)
,安装 Marker 模型。封装的 API 已经适配了 FastGPT 自定义解析服务。
这里介绍快速 Docker 安装的方法:
这里介绍快速 Docker 安装的方法:
```
dockerfile
```
dockerfile
docker pull crpi-h3snc261q1dosroc.cn-hangzhou.personal.cr.aliyuncs.com/marker11/marker_images:
latest
docker pull crpi-h3snc261q1dosroc.cn-hangzhou.personal.cr.aliyuncs.com/marker11/marker_images:
v0.2
docker run --gpus all -itd -p 7231:723
1 --name model_pdf_v1 crpi-h3snc261q1dosroc.cn-hangzhou.personal.cr.aliyuncs.com/marker11/marker_images:latest
docker run --gpus all -itd -p 7231:723
2 --name model_pdf_v2 -e PROCESSES_PER_GPU="2" crpi-h3snc261q1dosroc.cn-hangzhou.personal.cr.aliyuncs.com/marker11/marker_images:v0.2
```
```
### 2. 添加 FastGPT 文件配置
### 2. 添加 FastGPT 文件配置
```
json
```
json
...
@@ -36,7 +34,7 @@ docker run --gpus all -itd -p 7231:7231 --name model_pdf_v1 crpi-h3snc261q1dosro
...
@@ -36,7 +34,7 @@ docker run --gpus all -itd -p 7231:7231 --name model_pdf_v1 crpi-h3snc261q1dosro
"systemEnv"
:
{
"systemEnv"
:
{
xxx
xxx
"customPdfParse"
:
{
"customPdfParse"
:
{
"url"
:
"http://xxxx.com/v
1/parse/file"
,
//
自定义
PDF
解析服务地址
"url"
:
"http://xxxx.com/v
2/parse/file"
,
//
自定义
PDF
解析服务地址
marker
v
0.2
"key"
:
""
,
//
自定义
PDF
解析服务密钥
"key"
:
""
,
//
自定义
PDF
解析服务密钥
"doc2xKey"
:
""
,
//
doc
2
x
服务密钥
"doc2xKey"
:
""
,
//
doc
2
x
服务密钥
"price"
:
0
//
PDF
解析服务价格
"price"
:
0
//
PDF
解析服务价格
...
@@ -80,4 +78,11 @@ docker run --gpus all -itd -p 7231:7231 --name model_pdf_v1 crpi-h3snc261q1dosro
...
@@ -80,4 +78,11 @@ docker run --gpus all -itd -p 7231:7231 --name model_pdf_v1 crpi-h3snc261q1dosro
上图是分块后的结果,下图是 pdf 原文。整体图片、公式、表格都可以提取出来,效果还是杠杠的。
上图是分块后的结果,下图是 pdf 原文。整体图片、公式、表格都可以提取出来,效果还是杠杠的。
不过要注意的是,
[
Marker
](
https://github.com/VikParuchuri/marker
)
的协议是
`GPL-3.0 license`
,请在遵守协议的前提下使用。
不过要注意的是,
[
Marker
](
https://github.com/VikParuchuri/marker
)
的协议是
`GPL-3.0 license`
,请在遵守协议的前提下使用。
\ No newline at end of file
## 旧版 Marker 使用方法
如需使用旧版Marker可以使用以下命令:
```
dockerfile
docker pull crpi-h3snc261q1dosroc.cn-hangzhou.personal.cr.aliyuncs.com/marker11/marker_images:v0.1
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
```
并将 FastGPT 文件配置中的url改为 "http://xxxx.com/v1/parse/file"
\ No newline at end of file
plugins/model/pdf-marker/Readme.md
View file @
8980664b
...
@@ -70,7 +70,7 @@ export PROCESSES_PER_GPU="1"
...
@@ -70,7 +70,7 @@ export PROCESSES_PER_GPU="1"
python api_mp.py
python api_mp.py
```
```
# 镜像打包和部署
# 镜像打包和部署
(推荐)
## 本地构建镜像
## 本地构建镜像
...
@@ -83,26 +83,42 @@ export PROCESSES_PER_GPU="1"
...
@@ -83,26 +83,42 @@ export PROCESSES_PER_GPU="1"
```bash
```bash
sudo docker run --gpus all -itd -p 7231:7231 --name model_pdf_v1 -e PROCESSES_PER_GPU="2" model_pdf
sudo docker run --gpus all -itd -p 7231:7231 --name model_pdf_v1 -e PROCESSES_PER_GPU="2" model_pdf
```
```
## 快速构建镜像
## 快速构建镜像(推荐)
### marker v0.1
```
dockerfile
```
dockerfile
docker pull crpi-h3snc261q1dosroc.cn-hangzhou.personal.cr.aliyuncs.com/marker11/marker_images:latest
docker pull crpi-h3snc261q1dosroc.cn-hangzhou.personal.cr.aliyuncs.com/marker11/marker_images:v0.1
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
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
```
*注意*:参数PROCESSES_PER_GPU设置每张显卡上文件处理的并行数量,24G的显卡可以设置为2。在多显卡的环境中会自动切换显卡来运行多文件的并行处理。
### marker v0.2
```
dockerfile
docker pull crpi-h3snc261q1dosroc.cn-hangzhou.personal.cr.aliyuncs.com/marker11/marker_images:v0.2
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
```
```
*注意*:参数PROCESSES_PER_GPU设置每张显卡上文件处理的并行数量,24G的显卡可以设置为2。在多显卡的环境中会自动切换显卡来运行多文件的并行处理。
# 访问示例
# 访问示例
用Post方法访问端口为 `7321 ` 的 `v1/parse/file` 服务
marker v0.1:
用Post方法访问端口为 `7321 ` 的 `v1/parse/file` 服务
参数:file-->本地文件的地址
marker v0.2:用Post方法访问端口为 `7321 ` 的 `v2/parse/file` 服务
- 访问方法
```
curl --location --request POST "http://localhost:7231/v1/parse/file"
\
--header "Authorization: Bearer your_access_token"
\
--form "file=@./file/chinese_test.pdf"
```
- 访问方法
- v0.1
```
curl --location --request POST "http://localhost:7231/v1/parse/file"
\
--header "Authorization: Bearer your_access_token"
\
--form "file=@./file/chinese_test.pdf"
```
参数:file-->本地文件的地址
- v0.2
```
curl --location --request POST "http://localhost:7231/v2/parse/file"
\
--header "Authorization: Bearer your_access_token"
\
--form "file=@./file/chinese_test.pdf"
```
- 多文件测试数据
- 多文件测试数据
运行 `test` 文件下的 `test.py` 文件,修改里面的 `file_paths` 为自己仓库的 `url` 即可
运行 `test` 文件下的 `test.py` 文件,修改里面的 `file_paths` 为自己仓库的 `url` 即可
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment