参考链接如下::

参考链接:https://github.com/datalab-to/marker?tab=readme-ov-file#llm-services

底层的OCR模型:https://github.com/datalab-to/surya

作用:开源免费🆓,多 GPU 推理、生成效果不错,可结合 llm 进行优化,后续可以多试试,对比对比其他工具,目前工作中够用就行,暂时还没必要自己训练。

1、测试和使用非常的简单:只需要 2 行:

1.1 安装:

pip install marker-pdf

1.2 使用: 全部默认配置的话是这样的

marker_single ./2506.11763v1.pdf 

建议:

1、查看文档配置相关参数,我这里因为是 32 页文档,没有处理完成,处理了25 页(1.4w字(word 统计) 用时152s ,每秒接近 92 个字,使用的是 4090 GPU 机器。);

2、对比看看表格情况怎样?

原始 PDF: 感觉差不多够用了,不够后面可以再加 LLM 增强

3、还可以多 GPU 执行,大家可以多多探索下

官方 -> Usage

First, some configuration:

  • Your torch device will be automatically detected, but you can override this. For example, TORCH_DEVICE=cuda.
  • Some PDFs, even digital ones, have bad text in them. Set -force_ocr to force OCR on all lines, or the strip_existing_ocr to keep all digital text, and strip out any existing OCR text.
  • If you care about inline math, set force_ocr to convert inline math to LaTeX.

Interactive App

I've included a streamlit app that lets you interactively try marker with some basic options. Run it with:

pip install streamlit streamlit-ace
marker_gui

Convert a single file

marker_single /path/to/file.pdf

You can pass in PDFs or images.

Options:

  • -page_range TEXT: Specify which pages to process. Accepts comma-separated page numbers and ranges. Example: -page_range "0,5-10,20" will process pages 0, 5 through 10, and page 20.
  • -output_format [markdown|json|html|chunks]: Specify the format for the output results.
  • -output_dir PATH: Directory where output files will be saved. Defaults to the value specified in settings.OUTPUT_DIR.
  • -paginate_output: Paginates the output, using \\n\\n{PAGE_NUMBER} followed by  * 48, then \\n\\n
  • -use_llm: Uses an LLM to improve accuracy. You will need to configure the LLM backend - see below.
  • -force_ocr: Force OCR processing on the entire document, even for pages that might contain extractable text. This will also format inline math properly.
  • -block_correction_prompt: if LLM mode is active, an optional prompt that will be used to correct the output of marker. This is useful for custom formatting or logic that you want to apply to the output.
  • -strip_existing_ocr: Remove all existing OCR text in the document and re-OCR with surya.
  • -redo_inline_math: If you want the absolute highest quality inline math conversion, use this along with -use_llm.
  • -disable_image_extraction: Don't extract images from the PDF. If you also specify -use_llm, then images will be replaced with a description.
  • -debug: Enable debug mode for additional logging and diagnostic information.
  • -processors TEXT: Override the default processors by providing their full module paths, separated by commas. Example: -processors "module1.processor1,module2.processor2"
  • -config_json PATH: Path to a JSON configuration file containing additional settings.
  • config --help: List all available builders, processors, and converters, and their associated configuration. These values can be used to build a JSON configuration file for additional tweaking of marker defaults.
  • -converter_cls: One of marker.converters.pdf.PdfConverter (default) or marker.converters.table.TableConverter. The PdfConverter will convert the whole PDF, the TableConverter will only extract and convert tables.
  • -llm_service: Which llm service to use if -use_llm is passed. This defaults to marker.services.gemini.GoogleGeminiService.
  • -help: see all of the flags that can be passed into marker. (it supports many more options then are listed above)

The list of supported languages for surya OCR is here. If you don't need OCR, marker can work with any language.

Convert multiple files

marker /path/to/input/folder
  • marker supports all the same options from marker_single above.
  • -workers is the number of conversion workers to run simultaneously. This is automatically set by default, but you can increase it to increase throughput, at the cost of more CPU/GPU usage. Marker will use 5GB of VRAM per worker at the peak, and 3.5GB average.

Convert multiple files on multiple GPUs

NUM_DEVICES=4 NUM_WORKERS=15 marker_chunk_convert ../pdf_in ../md_out
  • NUM_DEVICES is the number of GPUs to use. Should be 2 or greater.
  • NUM_WORKERS is the number of parallel processes to run on each GPU.

Use from python

See the PdfConverter class at marker/converters/pdf.py function for additional arguments that can be passed.

from marker.converters.pdf import PdfConverter
from marker.models import create_model_dict
from marker.output import text_from_renderedconverter = PdfConverter(artifact_dict=create_model_dict(),
)
rendered = converter("FILEPATH")
text, _, images = text_from_rendered(rendered)

rendered will be a pydantic basemodel with different properties depending on the output type requested. With markdown output (default), you'll have the properties markdownmetadata, and images. For json output, you'll have childrenblock_type, and metadata.

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如若转载,请注明出处:http://www.pswp.cn/bicheng/93870.shtml
繁体地址,请注明出处:http://hk.pswp.cn/bicheng/93870.shtml
英文地址,请注明出处:http://en.pswp.cn/bicheng/93870.shtml

如若内容造成侵权/违法违规/事实不符,请联系英文站点网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

STM32HAL 快速入门(七):GPIO 输入之光敏传感器控制蜂鸣器

STM32HAL 快速入门(七):GPIO 输入之光敏传感器控制蜂鸣器 前言 大家好,这里是 Hello_Embed。上一篇我们用 GPIO 输入模式实现了按键控制 LED,本篇将进阶到 “光敏传感器控制蜂鸣器”—— 通过读取光敏传感器的信号&…

windows环境,安装kafka

步骤 1: 准备工作 确保已安装 Java:Kafka 需要 Java 运行时环境 (JRE) 或 Java 开发工具包 (JDK) 来运行。请确认您的系统上已安装了 Java,并且 JAVA_HOME 环境变量正确配置。 解压 Kafka:将下载的 Kafka 压缩包解压到一个目录,比…

机器翻译60天修炼专栏介绍和目录

文章目录 第一章:机器翻译基础认知与语言学铺垫 第二章:经典机器翻译模型(统计机器翻译) 第三章:神经网络基础与词向量技术 第四章:神经机器翻译(NMT)基础架构 第五章:NMT模型进阶与训练实践 第六章:预训练模型与机器翻译应用 第七章:研究前沿与综合项目 导论:学习…

openwrt增加自定义网页

一. 简介 本文介绍在OpenWRT中使用Luci框架定制设备配置页面的方法,包括添加静态页面和参数配置页面的过程,以及如何利用lua脚本实现界面与功能的结合。 二. Luci介绍 UCI 是 Openwrt 中为实现所有系统配置的一个统一接口,英文名 Unified Configuration Interface,即统一…

微服务的编程测评系统11-jmeter-redis-竞赛列表

提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档 文章目录前言1. 退出登录1.1 后端1.2 前端2. 获取当前用户信息3. C端用户竞赛列表功能3.1 后端3.2 Jmeter-基本操作3.3 数据版本性能测试-压力测试3.4 redis版本-缓存结构设计…

海滨浴场应急广播:守护碧海蓝天的安全防线

海滨浴场应急广播:守护碧海蓝天的安全防线!海滨浴场,是人们休闲娱乐、亲近自然的理想场所。然而,变幻莫测的海洋环境也潜藏着诸多安全隐患,如溺水、离岸流、海蜇蜇伤、极端天气等。为了有效应对突发事件,保…

华曦达港股IPO观察丨以创新研发为笔,构建AI Home智慧生活新蓝图

深圳市华曦达科技股份有限公司自创立伊始,便将敏锐的市场洞察与前沿技术追踪视为生命线。通过构建一支卓越的研发团队,公司专注于自主核心技术的深耕与积累,以精密的硬件与创新的软件筑起坚实的技术壁垒。其精心打造的“技术创新-…

构建现代化的Web UI自动化测试框架:从图片上传测试实践说起

构建现代化的Web UI自动化测试框架:从图片上传测试实践说起如何设计一个可维护、可扩展的Web UI自动化测试框架?本文通过一个图片上传测试实例,详细介绍专业测试框架的搭建与实践。当前测试框架结构 首先,让我们了解一下当前的测试…

Apache IoTDB:大数据时代时序数据库选型的技术突围与实践指南

摘要:时序数据库在大数据时代迎来爆发式增长,IoTDB作为Apache顶级开源项目展现出显著优势:1. 性能卓越:支持千万级数据点/秒写入,18:1高压缩比,查询延迟低至500ms;2. 创新架构:采用树…

2025年8月16日(星期六):雨骑古莲村游记

清晨,当第一缕微光还未完全驱散夜幕的静谧,我们这群由校长领衔的骑行爱好者已整装待发。咖啡节早市尚未开摊,空气中弥漫着一种期待与宁静交织的氛围,仿佛连时间都在为我们即将开启的旅程而放慢脚步。今天的目标是古莲村&#xff0…

Pandas数据预处理中缺失值处理

一、缺失值的概念表现形式1.数据库中常用null表示2.部分编程语言中用NA表示3.可能表现为空字符串(‘’)或特定数值4.在Pandas中统一用NaN表示(来自NumPy库,NaN、NAN、nan本质一致)NaN的特性1.与任何值都不相等&#xf…

计算机网络:(十五)TCP拥塞控制与拥塞控制算法深度剖析

> 当网络变成"堵城",TCP如何化身智能交通指挥家?揭秘百万级并发背后的流量控制艺术! ### 一、生死攸关:为什么需要拥塞控制? **真实灾难案例**:1986年劳伦斯伯克利实验室网络大崩溃,因缺乏拥塞控制导致全网瘫痪36小时。TCP拥塞控制由此诞生,核心解决**资…

python中的单下划线“_”与双下划线“__”的使用场景及“左右双下划线”(魔术方法:`__xxx__`)

在Python中,单下划线“_”和双下划线“__”的使用场景和含义有显著区别,主要体现在命名约定和语法 一、单下划线“_”的使用场景 单下划线更多是编程约定(而非强制语法),用于传递特定的“暗示”,不影响代码…

我们为什么需要时序数据库?

引言在当今数据驱动的世界中,时间序列数据正以前所未有的速度增长。从物联网设备传感器、金融交易记录到应用程序性能监控,时间序列数据无处不在。传统的关系型数据库在处理这类数据时往往力不从心,这时时序数据库(Time Series Database, TSD…

python-林粒粒的视频笔记1

python的方法和函数指什么 可变类型和不可变类型 不可变类型,比如字符串通过方法调用后,字符串本身的值不改变 要改变需要重新赋值才能进行改变 比如可变数据类型类型,调用方法后可以直接改变原列表 因此,可变数据类型需要再重新赋…

CentOS 7的下载与安装

一 、CentOS 7的下载与安装 注意: CentOS 7 已于2024年6月30日停止维护! 1、下载 由于 centos 7 已经停止维护,部分镜像网站移除了对centos 7的支持,这里找到了部分现在还可以使用的镜像网站 阿里云开源镜像站:http…

矿物分类系统开发笔记(二):模型训练[删除空缺行]

目录 一、阶段衔接与开发目标 二、数据准备 三、模型选择与训练 1. 逻辑回归(LR) 2. 随机森林(RF) 3. 高斯朴素贝叶斯(GNB) 4. 支持向量机(SVM) 5. AdaBoost 6. XGBoost 四…

通信方式:命名管道

一、命名管道 1. 命名管道的原理 有了匿名管道,理解命名管道就非常简单了。 对于普通文件而言,两个进程打开同一个文件,OS是不会将文件加载两次的,这两个进程都会指向同一个文件,那么,也就享有同一份 in…

如何将数据库快速接入大模型实现智能问数,实现chatbi、dataagent,只需短短几步,不需要配置工作流!

智能问数系统初始化操作流程 一、系统初始化与管理员账号创建登录与初始化提示:首次访问系统登录页,若系统未初始化,会弹出 “系统未完成初始化,请初始化管理员账号” 提示,点击【去创建】。填写管理员信息&#xff1a…

告别手写文档!Spring Boot API 文档终极解决方案:SpringDoc OpenAPI

在前后端分离和微服务盛行的今天,API 文档是团队协作的“通用语言”。一份清晰、准确、实时同步的文档,能极大提升开发和联调效率。然而,手动编写和维护 API 文档(如 Word、Markdown 或 Postman)是一场永无止境的噩梦—…