If you want to test DeepSeek-OCR without using local resources:
- Use the notebook at
notebooks/deepsek_ocr.ipynb. - Open it in Google Colab.
- Important: Select a runtime with GPU. This configuration will not work with CPU.
git lfs installgit clone https://huggingface.co/deepseek-ai/DeepSeek-OCR-
Default:
DeepSeek-OCR is configured to use CUDA and requires a GPU. -
To run on CPU:
Download themodeling_deepseekocr.pyfile from this discussion and replace your local file with it.
To set up your pyproject.toml to download a CUDA-compatible version of torch, add:
[[tool.uv.index]]
name = "pytorch-cu128"
url = "https://download.pytorch.org/whl/cu128"
explicit = true
[tool.uv.sources]
torch = [
{ index = "pytorch-cu128", marker = "sys_platform == 'linux' or sys_platform == 'win32'" },
]
torchvision = [
{ index = "pytorch-cu128", marker = "sys_platform == 'linux' or sys_platform == 'win32'" },
]For more information about specific CUDA versions, see the official uv documentation.
uv sync- Modify the configuration parameters (image path, prompt type, etc.) in the
run_ocr.pyfile. - Run the script to test DeepSeek-OCR.