deepseek-ocr
deepseek-ocr — an installable skill for AI agents.
By reason-machines · 1,597 installs
npx skills add reason-machines/trending-skills --skill deepseek-ocr
Source repository · Upstream listing
DeepSeek OCR
Skill by [ara.so](https://ara.so) — Daily 2026 Skills collection.
DeepSeek OCR is a vision language model for Optical Character Recognition with "Contexts Optical Compression." It supports native and dynamic resolutions, multiple prompt modes (document to markdown, free OCR, figure parsing, grounding), and can be run via vLLM (high throughput) or HuggingFace Transformers. It processes images and PDFs, outputting structured text or markdown.
Installation
Prerequisites
CUDA 11.8+, PyTorch 2.6.0
Python 3.12.9 (via conda recommended)
Setup
Alternative: upstream vLLM (nightly)
Model Download
Model is available on HuggingFace: deepseek ai/DeepSeek OCR
Inference: vLLM (Recommended for Production)
Single Image — Streaming
Batch Images
PDF Processing (via vLLM scripts)
Benchmark Evaluation
Inference: HuggingFace Transformers
Transformers Script
Prompt Reference
Use Case Prompt
Document → Markdown <image \n< grounding Convert the document to markdown.
General OCR <image \n< grounding OCR this image.
Free OCR (no layout) <image \nFree OCR.
Parse figure/chart <image \nParse the figure.
General description <image \nDescribe this image in detail.
Grounded REC <image \nLocate <\ ref\ TARGET TEXT<\ /ref\ in the image.
Supported Resolutions
Mode Resolution Vision Tokens
Tiny 512×512 64
Small 640×640 100
Base 1024×1024 256
Large 1280×1280 400
Gundam (dynamic) n×640×640 + 1×1024×1024 variable
Configuration (vLLM)
Edit DeepSeek OCR master/DeepSeek OCR vllm/config.py :
Common Patterns
Process a Directory of Images
Convert PDF Pages to Markdown
Grounded Text Location (REC)
Troubleshooting
transformers version conflict with vLLM
vLLM 0.8.5 requires transformers =4.51.1 — if running both in the same env, this error is safe to ignore per the project docs.
Flash Attention build errors
CUDA out of memory
Use smaller resolution: base size=512 or base size=640
Disable crop mode=False to avoid multi crop dynamic resolution
Reduce batch size in vLLM inputs
Model output is garbled / repetitive
Ensure NGramPerReqLogitsProcessor is passed to LLM — this is required for proper decoding:
Tables not rendering correctly
Add table token IDs to the whitelist:
Multi GPU inference
Key Files