MerchantryTidbits

doc-parsing / library

DeepSeek-OCR 2

Capability: DeepSeek-OCR 2

Use it when

  • You need to convert scanned document images into structured markdown locally on your own GPU rather than through a cloud OCR API
  • You have large batches of PDFs to OCR and want concurrent vLLM inference with a benchmark-evaluated vision model

What it solves

Not the fit when

  • CPU-only inference; the retained setup is pinned to CUDA 11.8, Torch 2.6.0, vLLM 0.8.5, and FlashAttention
  • Text-native PDFs that can be extracted without OCR
  • Running unreviewed model repository code in a sensitive environment; the Transformers example uses `trust_remote_code=True`
  • Assuming the Apache repository license settles all model-weight or dataset terms; verify the model card and weight license for the intended use
  • born-digital pdf text extraction
  • handwriting-specific pipelines not documented
  • cpu-only inference
  • document layout editing

Install

git clone https://github.com/deepseek-ai/DeepSeek-OCR-2.git; conda create -n deepseek-ocr2 python=3.12.9; pip install torch==2.6.0 torchvision==0.21.0 torchaudio==2.6.0 --index-url https://download.pytorch.org/whl/cu118; pip install vllm-0.8.5+cu118 wheel, -r requirements.txt, flash-attn==2.7.3 --no-build-isolation

Invoke

vLLM: set paths in DeepSeek-OCR2-vllm/config.py then python run_dpsk_ocr2_image.py (images), run_dpsk_ocr2_pdf.py (concurrent PDFs), run_dpsk_ocr2_eval_batch.py (benchmarks). Transformers: model.infer(tokenizer, prompt='<image>\n<|grounding|>Convert the document to markdown. ', image_file=..., output_path=...)

Alternatives

No reviewed alternatives recorded yet.