Skip to content

本地部署marker将pdf转换为markdown #273

Description

@FrankKai

黑色加粗的是需要注意的点。

brew install python
pip3 install torch torchvision torchaudio
git clone https://github.com/VikParuchuri/marker.git

在clone下来的marker目录下(这个一定要注意)
创建一个Python虚拟环境

python3 -m venv myenv

macOS用source,其他系统用别的。

source ./myenv/bin/activate 

后面这2步都是在,myenv环境里的。((myenv) ➜ marker git:(master))

如果不在这个环境里,会报command not found: marker_single

pip3 install marker-pdf    
marker_single ./pdfs/output_galaxy_form-page.pdf  

Downloading layout model...: 100%|██████████████████████████████████████████████████████████████████████████████████████████| 5/5 [01:44<00:00, 20.97s/it]
Loaded layout model s3://layout/2025_02_18 on device mps with dtype torch.float16
Downloading texify model...: 100%|██████████████████████████████████████████████████████████████████████████████████████████| 9/9 [02:20<00:00, 15.57s/it]
Loaded texify model s3://texify/2025_02_18 on device mps with dtype torch.float16
Downloading text_recognition model...: 0%|

批量转换:

marker batch --input /path/to/pdf_folder --output /path/to/output_folder --batch-size 2

地址:https://github.com/VikParuchuri/marker

参考:
https://medium.com/@sumsourabh14/this-is-how-i-convert-pdf-to-markdown-379ddb6e4405
https://post.smzdm.com/p/a2xzn3z2/

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions