Baike.dev
All toolsTrendingOpen sourceNewsSubmit
Log in
< 返回工具列表
M

marker

> 编程语言
开源

Convert PDF to markdown + JSON quickly with high accuracy

38.1K stars0 点赞0 次浏览
访问官网GitHub

工具介绍

Convert PDF to markdown + JSON quickly with high accuracy

Datalab

State of the Art models for Document Intelligence


# Marker Marker converts documents to markdown, JSON, chunks, and HTML quickly and accurately. - Converts PDF, image, PPTX, DOCX, XLSX, HTML, EPUB files in all languages - Formats tables, forms, equations, inline math, links, references, and code blocks - Extracts and saves images - Removes headers/footers/other artifacts - Extensible with your own formatting and logic - Optionally boost accuracy with LLMs (and your own prompt) - Works on GPU, CPU, or MPS ## Try Datalab's Managed Platform Our managed platform runs a version of our latest open source model, [Chandra](https://github.com/datalab-to/chandra) — higher accuracy than Marker, with zero data retention by default, SOC 2 Type 2, and custom BAAs. If you have high volume workloads, we offer a batch processing service that has processed 1B+ pages per week — we manage the infrastructure so your workloads finish on time. Get started with **$5 in free credits** — [sign up](https://www.datalab.to/?utm_source=gh-marker). ## Performance We measure marker on [olmocr-bench](https://github.com/allenai/olmocr/tree/main/olmocr/bench), a third-party benchmark of 1,403 PDFs with tests covering math, tables, multi-column layout, scans, and hard edge cases. Balanced mode scores **76.0%** overall — **83.5%** on born-digital PDFs — ahead of MinerU and docling and within range of much larger VLMs, while fast mode runs the layout + text-layer path far cheaper (and a no-OCR mode goes faster still). Scores are the olmocr-bench overall (macro-average across the 8 categories). See [below](#benchmarks) for the full per-category scores, the competitive comparison, and instructions on how to run your own benchmarks. ## Hybrid Mode For the highest accuracy, pass the `--use_llm` flag to use an LLM alongside marker. This will do things like merge tables across pages, handle inline math, format tables properly, and extract values from forms. It works with Gemini, Claude, OpenAI-compatible, Azure, Vertex, OpenRouter, or Ollama models. By default, it uses `gemini-3.5-flash`. See [below](#llm-services) for details. ## Examples | PDF | File type | Markdown | JSON | |-----|-----------|------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------| | [Think Python](https://greenteapress.com/thinkpython/thinkpython.pdf) | Textbook | [View](https://github.com/VikParuchuri/marker/blob/master/data/examples/markdown/thinkpython/thinkpython.md) | [View](https://github.com/VikParuchuri/marker/blob/master/data/examples/json/thinkpython.json) | | [Switch Transformers](https://arxiv.org/pdf/2101.03961.pdf) | arXiv paper | [View](https://github.com/VikParuchuri/marker/blob/master/data/examples/markdown/switch_transformers/switch_trans.md) | [View](https://github.com/VikParuchuri/marker/blob/master/data/examples/json/switch_trans.json) | | [Multi-column CNN](https://arxiv.org/pdf/1804.07821.pdf) | arXiv paper | [View](https://github.com/VikParuchuri/marker/blob/master/data/examples/markdown/multicolcnn/multicolcnn.md) | [View](https://github.com/VikParuchuri/marker/blob/master/data/examples/json/multicolcnn.json) | # Commercial usage Our code is licensed under **Apache 2.0** — free to use, including commercially. Our model weights use a modified AI Pubs Open Rail-M license (free for research, personal use, and startups under $5M funding/revenue). For commercial use of the model weights beyond that, visit our pricing page [here](https://www.datalab.to/pricing?utm_source=gh-marker). # Community [Discord](https://discord.gg//KuZwXNGnfH) is where we discuss future development. # Installation You'll need python 3.10+ and [PyTorch](https://pytorch.org/get-started/locally/). Install with: ```shell pip install marker-pdf ``` If you want to use marker on documents other than PDFs, you will need to install additional dependencies with: ```shell pip install marker-pdf[full] ``` ## Inference backend prerequisites Surya auto-spawns the server on first use, and you need `vllm` (NVIDIA GPU) or `llama.cpp` (CPU / Apple Silicon): - **NVIDIA GPU:** [Docker](https://docs.docker.com/get-docker/) plus the [NVIDIA Container Toolkit](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html). - **CPU / Apple Silicon:** the `llama-server` binary from llama.cpp: ```shell brew install llama.cpp # macOS # or grab a release from https://github.com/ggml-org/llama.cpp/releases ``` # Usage First, some configuration: - **Mode** (`--mode balanced|fast`; defaults by device — `balanced` on GPU, `fast` on CPU/MPS): - `balanced` (best on a **GPU**) uses the surya VLM for layout, OCRs inline math, and re-OCRs the **whole page** whenever any of its embedded text is bad — highest quality. - `fast` (optimized for **CPU**) uses the lightweight rf-detr layout detector, extracts text with pdftext, and keeps VLM use minimal: equations, surgical block-level repair of individual garbled/empty blocks, and a single full-page pass only for pages that are scanned or mostly bad. A clean digital document without equations never starts the VLM server. - Tables are reconstructed from the PDF text layer in both modes (scanned tables come from the full-page OCR); low-confidence reconstructions fall back to the VLM, with a stricter bar in balanced. - `--disable_ocr` turns off **all** VLM calls (including equations) in either mode — pure text-layer extraction. - Marker runs layout, OCR, and table recognition through a single surya VLM, served by a local inference server (used for OCR in both modes, and for layout in balanced mode). The server is spawned automatically on first use - vLLM (docker) on NVIDIA GPUs, llama.cpp elsewhere. You can also point marker at an already-running server with `SURYA_INFERENCE_URL=http://host:port/v1`. - Useful server settings (all surya env vars): `SURYA_INFERENCE_BACKEND` (`vllm` or `llamacpp`), `SURYA_INFERENCE_PARALLEL` (concurrent requests — by default this auto-scales to the server's capacity: the GPU's `max_num_seqs` under vllm, a conservative slot count under llama.cpp; set an int only to override), `SURYA_INFERENCE_KEEP_ALIVE` (keep the server running between invocations), `VLLM_GPUS` (GPU indices for the server). - Some PDFs, even digital ones, have bad text in them. Set `--force_ocr` to force OCR on all pages, or the `strip_existing_ocr` to keep all digital text, and strip out any existing OCR text. - Inline math is converted to LaTeX automatically in balanced mode (`ocr_inline_math`); in fast mode, set `--force_ocr` or `--ocr_inline_math` to get the same. ## Interactive App I've included a streamlit app that lets you interactively try marker with some basic options. Run it with: ```shell pip install -U streamlit streamlit-ace marker_gui ``` ## Convert a single file ```shell marker_single /path/to/file.pdf ``` You can pass in PDFs or images. Options: - `--mode [balanced|fast]`: Conversion mode (see above). Defaults by device: `balanced` on GPU, `fast` on CPU/MPS. - `--disable_ocr`: Never call the VLM - pure text-layer extraction (equations and scanned pages are skipped). - `--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](#llm-services). - `--force_ocr`: Force OCR processing on the entire document, even for pages that might contain extractable text. - `--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. - `--keep_pageheader_in_output` / `--keep_pagefooter_in_output`: Keep running page headers / footers in the output instead of stripping them (they are removed by default). - `--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) OCR runs through the surya VLM, which is multilingual - see the [surya README](https://github.com/datalab-to/surya) for details. If you don't need OCR, marker can work with any language. ## Convert multiple files ```shell 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 usage. All workers share a single inference server, which the parent process spawns. - The parent budgets total VLM concurrency automatically: it reads the server's capacity and splits it across workers (aggregate in-flight ≈ 1.5× capacity), so adding workers never over-queues the server. Set `SURYA_INFERENCE_PARALLEL` yourself only to override. - With `--disable_ocr` no inference server is started at all, and the pool is sized purely by CPU cores. - `--skip_existing` skips input files that already have output in `--output_dir` (resume a run); `--max_files N` caps how many files are converted; `--disable_multiprocessing` runs everything in one process. ### Batch sizing cheat sheet (e.g. 1000 docs) - **One GPU machine**: `marker /folder --output_dir out` — defaults handle it: one vllm server, a CPU-sized worker pool, concurrency budgeted to the GPU. Add `--mode fast` if you want cheaper/faster conver

核心特点

  • •Converts PDF, image, PPTX, DOCX, XLSX, HTML, EPUB files in all languages
  • •Formats tables, forms, equations, inline math, links, references, and code blocks
  • •Extracts and saves images
  • •Removes headers/footers/other artifacts
  • •Extensible with your own formatting and logic
  • •Optionally boost accuracy with LLMs (and your own prompt)
  • •Works on GPU, CPU, or MPS
  • •NVIDIA GPU: Docker plus the NVIDIA Container Toolkit.
  • •CPU / Apple Silicon: the llama-server binary from llama.cpp:
  • •Mode (--mode balanced|fast; defaults by device — balanced on GPU, fast on CPU/MPS):

> 标签

Python

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月9日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言
Baike.dev

baike.dev helps you discover great languages, frameworks, databases, DevOps and cloud-native tools.

Quick links

  • Home
  • All tools
  • Trending
  • Open source

About

  • About us
  • Community
  • News

Contribute

Found a great developer tool? Share it with the community.

Submit a tool
© 2026 baike.dev Developer EncyclopediaUpdated daily · Discover great developer tools