Instructions to use deepseek-ai/DeepSeek-OCR with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use deepseek-ai/DeepSeek-OCR with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="deepseek-ai/DeepSeek-OCR", trust_remote_code=True)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("deepseek-ai/DeepSeek-OCR", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use deepseek-ai/DeepSeek-OCR with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "deepseek-ai/DeepSeek-OCR" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "deepseek-ai/DeepSeek-OCR", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/deepseek-ai/DeepSeek-OCR
- SGLang
How to use deepseek-ai/DeepSeek-OCR with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "deepseek-ai/DeepSeek-OCR" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "deepseek-ai/DeepSeek-OCR", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "deepseek-ai/DeepSeek-OCR" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "deepseek-ai/DeepSeek-OCR", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use deepseek-ai/DeepSeek-OCR with Docker Model Runner:
docker model run hf.co/deepseek-ai/DeepSeek-OCR
🧠 Why does DeepSeek-OCR not use Multi-Head Latent Attention (MLA)?
Hi DeepSeek team 👋,
First of all, thank you for releasing DeepSeek-OCR — it’s an impressive and elegant vision-to-text model.
While exploring the model architecture and configuration files (config.json), I noticed that Multi-Head Latent Attention (MLA) is default enabled in this OCR model.
Questions
Could you please share some insights into why MLA was not used in DeepSeek-OCR?
- Was it due to compatibility issues between MLA and the vision encoder–decoder pipeline?
- Or did MLA not provide practical benefits in the OCR setting (e.g., shorter sequence lengths or the main bottleneck lying elsewhere)?
- Is there any plan to integrate MLA into future versions of DeepSeek-OCR to improve inference efficiency?
I’m asking because MLA has demonstrated significant efficiency gains in your other models (e.g., DeepSeek-V2/V3), and I’m curious about the reasoning behind excluding it here.
Thanks again for your excellent work and for open-sourcing this project! 🙏
Hello,
We actually have an internal MLA-enabled version of DeepSeek-OCR.
The only reason it hasn’t been open-sourced yet is simply that I haven’t had the bandwidth to implement the code needed to convert the internal weights into the Hugging Face format.
Best regards
Hi
Hello Sir, I am currently in School (8th Grade from Pakistan) doing basic ML, any suggestions for me ?
Hello Sir, I am currently in School (8th Grade from Pakistan) doing basic ML, any suggestions for me ?
hey bro I would like you to make a bunch of neural networks on ur ow like ur own architectures and experiment and train models u will get a perfect one
Hi
