
DeepSeek-OCR
An OCR model that turns document images into text and markdown, from DeepSeek AI.
- Stars
- 24.1k
- Forks
- 2.2k
- Licence
- MIT
- Language
- Python
- Last update
- 9 months ago
- Type
- AI model / agent
What it is
DeepSeek-OCR is a research model released by DeepSeek AI that reads text from images, such as scanned pages or PDFs, and converts them into text or markdown. The README frames it as an investigation into compressing text into visual tokens, using vision encoders from an LLM-centric viewpoint. It is mainly used by developers who want to run OCR locally through Python.
- Convert a document image to markdown using the grounding prompt shown in the README
- Run plain text extraction on an image with the 'Free OCR.' prompt
- Process PDFs in batches with the included run_dpsk_ocr_pdf.py script
- Run batch evaluation for benchmarks with run_dpsk_ocr_eval_batch.py
Great for
- Developers who want an open-weight OCR model they can run themselves
- Teams converting scanned documents into markdown or plain text
- Researchers studying visual-text compression with vision encoders
- Users who already have a CUDA GPU environment set up
Not ideal for
- People who need a point-and-click app: the README only shows Python scripts and commands
- Users without an NVIDIA/CUDA GPU setup, since the install instructions assume CUDA 11.8 and torch 2.6.0
- Teams needing guaranteed accuracy on specific document types, since the README shows examples but no accuracy benchmarks in the truncated text
How to get it
- 1
Clone and build from source
You'll need: Python 3.12.9 (via conda, per README) · CUDA 11.8 with torch 2.6.0 (per README) · Conda
Clone the repository
git clone https://github.com/deepseek-ai/DeepSeek-OCR.gitCreate and activate the conda environment
conda create -n deepseek-ocr python=3.12.9 -y && conda activate deepseek-ocrInstall PyTorch (CUDA 11.8 build)
pip install torch==2.6.0 torchvision==0.21.0 torchaudio==2.6.0 --index-url https://download.pytorch.org/whl/cu118Install project requirements
pip install -r requirements.txt - 2
Run it
- Set the INPUT_PATH and OUTPUT_PATH in DeepSeek-OCR-master/DeepSeek-OCR-vllm/config.py
- Change into the DeepSeek-OCR-master/DeepSeek-OCR-vllm folder
- Run python run_dpsk_ocr_image.py to process an image with streaming output
- 3
Get the most out of it
- Use the grounding prompt '<image>\n<|grounding|>Convert the document to markdown.' for document-to-markdown output
- Use 'Free OCR.' when you only need plain text without layout
- Pick a resolution mode from the Support-Modes list to trade detail against vision token count
- Use the vLLM path for batched PDF processing, as the README reports about 2500 tokens/s on an A100-40G
Downloads
Strengths
- Open weights and MIT-licensed code, with a Hugging Face model download
- Supports both vLLM and Transformers inference paths in the README
- Offers several resolution modes (Tiny to Large, plus Gundam) for different speed and detail trade-offs
Trade-offs
- Setup is involved: it requires a specific CUDA/torch version, a vLLM wheel, and flash-attn
- The README is truncated and does not state hardware requirements beyond an A100-40G throughput note
Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.