ForkDeepInfraDeepInfrapublished Jul 10, 2025seen 5d

deepinfra/olmocr

forked from allenai/olmocr

Open original ↗

Captured source

source ↗
published Jul 10, 2025seen 5dcaptured 15hhttp 200method plain

deepinfra/olmocr

Description: Toolkit for linearizing PDFs for LLM datasets/training

License: Apache-2.0

Stars: 0

Forks: 0

Open issues: 0

Created: 2025-07-10T00:38:31Z

Pushed: 2025-07-09T22:35:59Z

Default branch: main

Fork: yes

Parent repository: allenai/olmocr

Archived: no

README:

A toolkit for converting PDFs and other image-based document formats into clean, readable, plain text format.

Try the online demo: https://olmocr.allenai.org/

Features:

  • Convert PDF, PNG, and JPEG based documents into clean Markdown
  • Support for equations, tables, handwriting, and complex formatting
  • Automatically removes headers and footers
  • Convert into text with a natural reading order, even in the presence of

figures, multi-column layouts, and insets

  • Efficient, less than $200 USD per million pages converted
  • (Based on a 7B parameter VLM, so it requires a GPU)

News

  • June 17, 2025 - v0.1.75 - Switch from sglang to vllm based inference pipeline, updated docker image to CUDA 12.8.
  • May 23, 2025 - v0.1.70 - Official docker support and images are now available! [See Docker usage](#using-docker)
  • May 19, 2025 - v0.1.68 - olmOCR-Bench launch, scoring 77.4. Launch includes 2 point performance boost in olmOCR pipeline due to bug fixes with prompts.
  • Mar 17, 2025 - v0.1.60 - Performance improvements due to better temperature selection in sampling.
  • Feb 25, 2025 - v0.1.58 - Initial public launch and demo.

Benchmark

**olmOCR-Bench**: We also ship a comprehensive benchmark suite covering over 7,000 test cases across 1,400 documents to help measure performance of OCR systems.

Model ArXiv Old Scans Math Tables Old Scans Headers and Footers Multi column Long tiny text Base Overall

Marker v1.7.5 (base) 76.0 57.9 57.6 27.8 84.9 72.9 84.6 99.1 70.1 ± 1.1

MinerU v1.3.10 75.4 47.4 60.9 17.3 96.6 59.0 39.1 96.6 61.5 ± 1.1

Mistral OCR API 77.2 67.5 60.6 29.3 93.6 71.3 77.1 99.4 72.0 ± 1.1

olmOCR v0.1.75 (Anchored) 74.9 71.2 71.0 42.2 94.5 78.3 73.3 98.3 75.5 ± 1.0

Installation

Requirements:

  • Recent NVIDIA GPU (tested on RTX 4090, L40S, A100, H100) with at least 20 GB of GPU RAM
  • 30GB of free disk space

You will need to install poppler-utils and additional fonts for rendering PDF images.

Install dependencies (Ubuntu/Debian)

sudo apt-get update
sudo apt-get install poppler-utils ttf-mscorefonts-installer msttcorefonts fonts-crosextra-caladea fonts-crosextra-carlito gsfonts lcdf-typetools

Set up a conda environment and install olmocr. The requirements for running olmOCR are difficult to install in an existing python environment, so please do make a clean python environment to install into.

conda create -n olmocr python=3.11
conda activate olmocr

# For CPU-only operations, ex running the benchmark
pip install olmocr[bench]

# For actually converting the files with your own GPU
pip install olmocr[gpu] --extra-index-url https://download.pytorch.org/whl/cu128

# Recommended: Install flash infer for faster inference on GPU
pip install https://download.pytorch.org/whl/cu128/flashinfer/flashinfer_python-0.2.5%2Bcu128torch2.7-cp38-abi3-linux_x86_64.whl

Local Usage Example

For quick testing, try the web demo. To run locally, a GPU is required, as inference is powered by sglang under the hood.

Convert a Single PDF:

# Download a sample PDF
curl -o olmocr-sample.pdf https://olmocr.allenai.org/papers/olmocr_3pg_sample.pdf

# Convert it to markdown
python -m olmocr.pipeline ./localworkspace --markdown --pdfs olmocr-sample.pdf

Convert an Image file:

python -m olmocr.pipeline ./localworkspace --markdown --pdfs random_page.png

Convert Multiple PDFs:

python -m olmocr.pipeline ./localworkspace --markdown --pdfs tests/gnarly_pdfs/*.pdf

With the addition of the --markdown flag, results will be stored as markdown files inside of ./localworkspace/markdown/.

Viewing Results

The ./localworkspace/ workspace folder will then have both Dolma and markdown files (if using --markdown).

cat localworkspace/markdown/olmocr-sample.md
olmOCR: Unlocking Trillions of Tokens in PDFs with Vision Language Models
...

Multi-node / Cluster Usage

If you want to convert millions of PDFs, using multiple nodes running in parallel, then olmOCR supports reading your PDFs from AWS S3, and coordinating work using an AWS S3 output bucket.

For example, you can start this command on your first worker node, and it will set up a simple work queue in your AWS bucket and start converting PDFs.

python -m olmocr.pipeline s3://my_s3_bucket/pdfworkspaces/exampleworkspace --pdfs s3://my_s3_bucket/jakep/gnarly_pdfs/*.pdf

Now on any subsequent nodes, just run this and they will start grabbing items from the same workspace queue.

python -m olmocr.pipeline s3://my_s3_bucket/pdfworkspaces/exampleworkspace

If you are at Ai2 and want to linearize millions of PDFs efficiently using beaker, just add the --beaker flag. This will prepare the workspace on your local machine, and then launch N GPU workers in the cluster to start converting PDFs.

For example:

python -m olmocr.pipeline s3://my_s3_bucket/pdfworkspaces/exampleworkspace --pdfs s3://my_s3_bucket/jakep/gnarly_pdfs/*.pdf --beaker --beaker_gpus 4

Using Docker

Pull the Docker image.

docker pull alleninstituteforai/olmocr:latest

To run the container interactively:

docker run -it --gpus all --name olmocr_container alleninstituteforai/olmocr:latest /bin/bash

If you want to access your local files inside the container, use volume mounting:

docker run -it --gpus all \
-v /path/to/your/local/files:/local_files \
--name olmocr_container \
alleninstituteforai/olmocr:latest /bin/bash

All dependencies are already installed. Once you’re inside the container, you can run olmOCR commands. For example:

curl -o olmocr-sample.pdf https://olmocr.allenai.org/papers/olmocr_3pg_sample.pdf

python -m olmocr.pipeline ./localworkspace --markdown --pdfs olmocr-sample.pdf

> You can also visit our Docker repository on Docker Hub.

Full documentation for the…

Excerpt shown — open the source for the full document.

Notability

notability 1.0/10

Routine fork, no traction.