Model reference · open weights
olmOCR-0225 is an open-weight language model from allenai. olmOCR-7B-0225-preview (BF16) weighs 16.6 GB; the smallest configuration that runs it is 2× RTX 3060 12 GB.
Summary of the allenai/olmOCR-7B-0225-preview model card, 2026-10-01
What it is
| Released by | allenai |
|---|---|
| Released | 2025-01-15 |
| Parameters | 8.3B |
| VRAM | 16.6 GB for the weights |
What it runs on
| Card | Requests at once | Context max | Memory | |
|---|---|---|---|---|
| 8K each | 32K each | |||
| RTX 3060 12 GB … RTX 4060 Ti 16 GB 2 smaller cards | — | — | — | |
| RTX 3090 24 GB | 10 | 2 | all 32K | 23.4 GB |
| RTX 4090 24 GB | 9 | 2 | all 32K | 23.4 GB |
| RTX 5090 32 GB | 26 | 6 | all 32K | 31.0 GB |
| L40S 48 GB | 53 | 13 | all 32K | 44.0 GB |
| A100 80 GB | 126 | 31 | all 32K | 78.2 GB |
| H100 80 GB | 117 | 29 | all 32K | 78.1 GB |
| RTX PRO 6000 Blackwell 96 GB | 150 | 37 | all 32K | 93.8 GB |
| DGX Spark (GB10) 128 GB unified | 179 | 44 | all 32K | 107 GB |
| H200 141 GB | 244 | 61 | all 32K | 138 GB |
| B200 180 GB | 324 | 81 | all 32K | 176 GB |
| 2× RTX 3060 12 GB tensor parallel | 5 | 1 | all 32K | 11.6 GB a card |
| 2× RTX 4060 Ti 16 GB tensor parallel | 21 | 5 | all 32K | 15.4 GB a card |
| Requests at once | 8K tokens each | 32K tokens each |
|---|---|---|
| 1 | 19.1 GB | 20.5 GB |
| 5 | 21.0 GB | 28.1 GB |
| 8 | 22.4 GB | 33.7 GB |
| 16 | 26.2 GB | 48.7 GB |
| 32 | 33.7 GB | 78.8 GB |
| 64 | 48.7 GB | 139 GB |
One card, with vLLM's small-card settings.
From the model card
This is a preview release of the olmOCR model that's fine tuned from Qwen2-VL-7B-Instruct using the olmOCR-mix-0225 dataset.
Quick links:
The best way to use this model is via the olmOCR toolkit. The toolkit comes with an efficient inference setup via sglang that can handle millions of documents at scale.
This model expects as input a single document image, rendered such that the longest dimension is 1024 pixels.
The prompt must then contain the additional metadata from the document, and the easiest way to generate this is to use the methods provided by the olmOCR toolkit.
If you want to prompt this model manually instead of using the olmOCR toolkit, please see the code below.
In normal usage, the olmOCR toolkit builds the prompt by rendering the PDF page, and extracting relevant text blocks and image metadata. To duplicate that you will need to
pip install olmocr
and then run the following sample code.
import torch
import base64
import urllib.request
from io import BytesIO
from PIL import Image
from transformers import AutoProcessor, Qwen2VLForConditionalGeneration
from olmocr.data.renderpdf import render_pdf_to_base64png
from olmocr.prompts import build_finetuning_prompt
from olmocr.prompts.anchor import get_anchor_text
# Initialize the model
model = Qwen2VLForConditionalGeneration.from_pretrained("allenai/olmOCR-7B-0225-preview", torch_dtype=torch.bfloat16).eval()
processor = AutoProcessor.from_pretrained("Qwen/Qwen2-VL-7B-Instruct")
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
model.to(device)
# Grab a sample PDF
urllib.request.urlretrieve("https://molmo.allenai.org/paper.pdf", "./paper.pdf")
# Render page 1 to an image
image_base64 = render_pdf_to_base64png("./paper.pdf", 1, target_longest_image_dim=1024)
# Build the prompt, using document metadata
anchor_text = get_anchor_text("./paper.pdf", 1, pdf_engine="pdfreport", target_length=4000)
prompt = build_finetuning_prompt(anchor_text)
# Build the full prompt
messages = [
{
"role": "user",
"content": [
{"type": "text", "text": prompt},
{"type": "image_url", "image_url": {"url": f"data:image/png;base64,{image_base64}"}},
],
}
]
# Apply the chat template and processor
text = processor.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
main_image = Image.open(BytesIO(base64.b64decode(image_base64)))
inputs = processor(
text=[text],
images=[main_image],
padding=True,
return_tensors="pt",
)
inputs = {key: value.to(device) for (key, value) in inputs.items()}
# Generate the output
output = model.generate(
**inputs,
temperature=0.8,
max_new_tokens=50,
num_return_sequences=1,
do_sample=True,
)
# Decode the output
prompt_length = inputs["input_ids"].shape[1]
new_tokens = output[:, prompt_length:]
text_output = processor.tokenizer.batch_decode(
new_tokens, skip_special_tokens=True
)
print(text_output)
# ['{"primary_language":"en","is_rotation_valid":true,"rotation_correction":0,"is_table":false,"is_diagram":false,"natural_text":"Molmo and PixMo:\\nOpen Weights and Open Data\\nfor State-of-the']
olmOCR is licensed under the Apache 2.0 license. olmOCR is intended for research and educational use. For more information, please see our Responsible Use Guidelines.
Quoted from the model card on Hugging Face. The full card is behind the Hugging Face link above.