deepseek-ai_DeepSeek-OCR
deepseek-ai · View on Hugging Face ↗
DeepSeek's OCR model — compact context-compression VLM for document text extraction.
✓ verified · rehash-vs-hf-metadata at 2026-08-20T20:57:35Z
mit6.23 GB (6,684,375,687 bytes)transformerssafetensorsdeepseek_vl_v2feature-extractiondeepseekvision-languageocrcustom_codeimage-text-to-textmultilingualeval-resultspaper: 2510.18234
Get this model
Download deepseek-ai_DeepSeek-OCR.torrent
Recommended — the .torrent carries the webseed url-list, so your client can fall back to plain HTTPS if the swarm is thin. See/verify for the full download + verification walkthrough.
Model card
The complete upstream card, rendered from this payload's README.md — the same hash-verified bytes the torrent distributes. Images and off-site links are removed; the original card on Hugging Face carries them.
pipeline_tag: image-text-to-text language:
- multilingual tags:
- deepseek
- vision-language
- ocr
- custom_code license: mit library_name: transformers
🌟 Github | 📥 Model Download | 📄 Paper Link | 📄 Arxiv Paper Link |
DeepSeek-OCR: Contexts Optical Compression
Explore the boundaries of visual-text compression.
Usage
Inference using Huggingface transformers on NVIDIA GPUs. Requirements tested on python 3.12.9 + CUDA11.8:
torch==2.6.0
transformers==4.46.3
tokenizers==0.20.3
einops
addict
easydict
pip install flash-attn==2.7.3 --no-build-isolation
from transformers import AutoModel, AutoTokenizer
import torch
import os
os.environ["CUDA_VISIBLE_DEVICES"] = '0'
model_name = 'deepseek-ai/DeepSeek-OCR'
tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)
model = AutoModel.from_pretrained(model_name, _attn_implementation='flash_attention_2', trust_remote_code=True, use_safetensors=True)
model = model.eval().cuda().to(torch.bfloat16)
# prompt = "<image>\nFree OCR. "
prompt = "<image>\n<|grounding|>Convert the document to markdown. "
image_file = 'your_image.jpg'
output_path = 'your/output/dir'
# infer(self, tokenizer, prompt='', image_file='', output_path = ' ', base_size = 1024, image_size = 640, crop_mode = True, test_compress = False, save_results = False):
# Tiny: base_size = 512, image_size = 512, crop_mode = False
# Small: base_size = 640, image_size = 640, crop_mode = False
# Base: base_size = 1024, image_size = 1024, crop_mode = False
# Large: base_size = 1280, image_size = 1280, crop_mode = False
# Gundam: base_size = 1024, image_size = 640, crop_mode = True
res = model.infer(tokenizer, prompt=prompt, image_file=image_file, output_path = output_path, base_size = 1024, image_size = 640, crop_mode=True, save_results = True, test_compress = True)
vLLM
Refer to 🌟GitHub for guidance on model inference acceleration and PDF processing, etc.
[2025/10/23] 🚀🚀🚀 DeepSeek-OCR is now officially supported in upstream vLLM.
uv venv
source .venv/bin/activate
# Until v0.11.1 release, you need to install vLLM from nightly build
uv pip install -U vllm --pre --extra-index-url https://wheels.vllm.ai/nightly
from vllm import LLM, SamplingParams
from vllm.model_executor.models.deepseek_ocr import NGramPerReqLogitsProcessor
from PIL import Image
# Create model instance
llm = LLM(
model="deepseek-ai/DeepSeek-OCR",
enable_prefix_caching=False,
mm_processor_cache_gb=0,
logits_processors=[NGramPerReqLogitsProcessor]
)
# Prepare batched input with your image file
image_1 = Image.open("path/to/your/image_1.png").convert("RGB")
image_2 = Image.open("path/to/your/image_2.png").convert("RGB")
prompt = "<image>\nFree OCR."
model_input = [
{
"prompt": prompt,
"multi_modal_data": {"image": image_1}
},
{
"prompt": prompt,
"multi_modal_data": {"image": image_2}
}
]
sampling_param = SamplingParams(
temperature=0.0,
max_tokens=8192,
# ngram logit processor args
extra_args=dict(
ngram_size=30,
window_size=90,
whitelist_token_ids={128821, 128822}, # whitelist: <td>, </td>
),
skip_special_tokens=False,
)
# Generate output
model_outputs = llm.generate(model_input, sampling_param)
# Print output
for output in model_outputs:
print(output.outputs[0].text)
Visualizations
Acknowledgement
We would like to thank Vary, GOT-OCR2.0, MinerU, PaddleOCR, OneChart, Slow Perception for their valuable models and ideas.
We also appreciate the benchmarks: Fox, OminiDocBench.
Citation
@article{wei2025deepseek,
title={DeepSeek-OCR: Contexts Optical Compression},
author={Wei, Haoran and Sun, Yaofeng and Li, Yukun},
journal={arXiv preprint arXiv:2510.18234},
year={2025}
}
Magnet link (secondary — no webseeds)
Opens the swarm directly, but carries no webseed url-list. Prefer the.torrent download above — HTTP fallback seeds ride inside it.
magnet:?xt=urn:btih:49f368f8e62842fce7725cd6adeb6c559ea46f0a&dn=deepseek-ai_DeepSeek-OCROpen magnet in torrent client · infohash 49f368f8e62842fce7725cd6adeb6c559ea46f0a
Files & hashes
| Path | Size | Method | Hash |
|---|---|---|---|
| LICENSE | 1.1 KB (1,084 B) | sha1-git-blob | d62e3bef9f054f21b7fc616365850fbf879a99ff |
| README.md | 6.2 KB (6,308 B) | sha1-git-blob | c6b3fb147ef7261513f4f76020def3e73f9a75ae |
| assets/fig1.png | 386.8 KB (396,104 B) | sha256-lfs | 3a709eb3fdb51cf6d8a546ffb8efe3c80bef61ae0183c2c8476a4c4a41efa3f1 |
| assets/show1.jpg | 114.1 KB (116,813 B) | sha256-lfs | 887e88e60e5833bc10a2cd7edb89ea7e6992abaae5e1550b027c611b8b8456f2 |
| assets/show2.jpg | 210.9 KB (216,011 B) | sha256-lfs | 81d08f7f33d9d39b95dd9b8162506659e6822d621b9829a208f3830c34c2b4d0 |
| assets/show3.jpg | 241.3 KB (247,052 B) | sha256-lfs | cd24b0cfc7b6c0b1b34bd1aa55bc385e746298fdd82410db6c0d4e0bf69085c0 |
| assets/show4.jpg | 262.5 KB (268,763 B) | sha256-lfs | 2fe88eacc470c34d00225151372d3770948864f3d9cfaae16afa15b2432d7793 |
| config.json | 2.6 KB (2,666 B) | sha1-git-blob | 0bc764cb729cfad6649038ce3b5fa6c29e0c5b34 |
| configuration_deepseek_v2.py | 10.4 KB (10,646 B) | sha1-git-blob | a8622c20101ed06940eb7fb6164babbc499bc524 |
| conversation.py | 9.0 KB (9,253 B) | sha1-git-blob | 65c295e81cd804080ec238b31d1922f33e1f9405 |
| deepencoder.py | 37.1 KB (38,008 B) | sha1-git-blob | de1687dfec3a4a8a00980a8444baba0082ce779b |
| model-00001-of-000001.safetensors | 6.21 GB (6,672,547,120 B) | sha256-lfs | 1169e7cdc28ff2fb6186556acb2175db148ad26a62097df4c45a17e523180d3f |
| model.safetensors.index.json | 241.0 KB (246,759 B) | sha1-git-blob | 76a9e9987d31aec961c934257dc0159b295fdaa6 |
| modeling_deepseekocr.py | 39.2 KB (40,133 B) | sha1-git-blob | 05ebf949161b9e0684a676de9526089b1deaa636 |
| modeling_deepseekv2.py | 80.3 KB (82,224 B) | sha1-git-blob | ff008470d58b98d3f8304ecfb6ee1bd04c877739 |
| processor_config.json | 460 B (460 B) | sha1-git-blob | 9153af2ad5e59ad9cf24fed29cf286fcf10d389a |
| special_tokens_map.json | 801 B (801 B) | sha1-git-blob | d59d312be868edc63b195e19e256c730dba685ad |
| tokenizer.json | 9.5 MB (9,979,544 B) | sha1-git-blob | c93a1c4d2ecf31bb5a9ec39eb73dfbf915aaf77e |
| tokenizer_config.json | 162.0 KB (165,938 B) | sha1-git-blob | ba9d4175d69cde58ad9f68a76a4758df091eaffa |
Provenance
| Upstream repository | deepseek-ai/DeepSeek-OCR |
|---|---|
| Revision (pinned) | 9f30c71f441d010e5429c532364a86705536c53a |
| Fetched at | 2026-08-20T20:53:13Z |
| License at fetch | mit |
| Snapshot tool | huggingface · seedbank 0.1.0 |
Trackers
- udp://announce.aitorrent.org:6969/announce
- http://announce.aitorrent.org:7070/announce
- udp://announce2.aitorrent.org:6970/announce
- http://announce2.aitorrent.org:7071/announce
- udp://tracker.opentrackr.org:1337/announce
- udp://open.demonii.com:1337/announce
- udp://open.stealth.si:80/announce
- udp://exodus.desync.com:6969/announce
- udp://tracker.torrent.eu.org:451/announce