Nodes/ComfyUI-DeepseekOCR/DeepSeek OCR: Load Model
ComfyUI Node

DeepSeek OCR: Load Model

Real document OCR locally, no API key required

By Geo1230·Created 10 months ago·Updated 10 months ago· 3
DeepSeek OCR: Load Model
    • model
    dtypebf16
    devicecuda

    The name is the pitch: this node loads DeepSeek-OCR, DeepSeek's vision-language model for reading documents, into your GPU so you can OCR locally. No API calls, no key, no "send my invoice to someone's server" anxiety - the whole thing runs on your machine. If you've ever tried EasyOCR or PaddleOCR inside ComfyUI and gotten garbled tables or missed a watermark, this is the class of model people describe as "more powerful" when the older OCR tools fail. It's a genuinely different beast: instead of a traditional OCR detector, it's a ~3B vision-language model that reads the image and writes the text back, which is why it handles tables, charts, handwriting-adjacent layouts, and locating things by description instead of just transcribing.

    The catch is the first run. The model is about 8–10 GB of weights, and this Load node is where all of that happens.

    What it actually does

    Under the hood the loader does three things. First, it makes sure the weights exist at ComfyUI/models/deepseek-ocr/deepseek-ai_DeepSeek-OCR/. If they're missing it auto-downloads them via huggingface-cli on first run, using its own HuggingFace cache under models/deepseek-ocr/hf_cache so it doesn't pollute your global ~/.cache. It's polite about it too - a file lock so two queued workflows don't download in parallel, and a log at ComfyUI/log/deepseek_ocr.log tracking progress.

    Then it loads the model with trust_remote_code=True - DeepSeek-OCR ships custom modeling code, which is also why the requirements include matplotlib even though you're not plotting anything. And it caches the loaded handle globally, so re-running a workflow doesn't reload 10 GB from disk every time. That's why the two-node split exists: Load once, Run as many times as you want.

    The inputs that matter

    Only two, and you can leave both alone most of the time:

    • dtype - bf16 (default, recommended), fp16, fp32. bf16 is the balance point. Drop to fp16 if you're short on VRAM. The loader quietly falls back bf16 → fp16 → fp32 if a precision fails to load, so a crash usually means something else is wrong.
    • device - cuda by default. You can type cpu, but "speed" will not be the word you use to describe it.

    The output is a model handle of type DPSK_OCR - wire that into the DeepSeek OCR: Run node. It's not a tensor, not a string, just an opaque handle; you don't do anything with it except connect the wire.

    Installing it

    Via ComfyUI Manager (search "DeepSeekOCR"), or the manual way:

    cd ComfyUI/custom_nodes/
    git clone https://github.com/Geo1230/ComfyUI-DeepseekOCR.git
    

    Then install dependencies - with your venv's Python or python_embeded on Windows portable installs:

    pip install -r requirements.txt
    

    The requirements pull in transformers>=4.46, tokenizers, einops, easydict, addict, huggingface_hub, Pillow, numpy, and matplotlib. One pin matters more than the rest: the author recommends transformers 4.46.3, and if you're on 4.55+ and things break, the documented fix is:

    pip install transformers==4.46.3 tokenizers==0.20.3
    

    You don't need to pre-download the model - the loader fetches it on first use. If you'd rather do it in the terminal (and watch the progress instead of guessing), the README's manual path is huggingface-cli download deepseek-ai/DeepSeek-OCR --local-dir . --repo-type model inside that deepseek-ai_DeepSeek-OCR folder. Want to kill auto-download entirely? Set the env var DPSK_AUTODOWNLOAD=0 before starting ComfyUI.

    Where people get burned

    • The first run looks frozen. It's downloading ~10 GB; watch the console or the log file, not the node. Give it the time.
    • Transformers version hell. This is the #1 breakage for custom-code models. If Load throws in trust_remote_code or a transformers import, pin 4.46.3 before blaming anything else.
    • OOM on load. bf16 is roughly 6–7 GB of VRAM just for the model. If it won't fit, switch to fp16 on the Load node - and consider running at Tiny/Small resolution on the Run node too.
    • Auto-download failing in restricted networks: set an HF_ENDPOINT mirror, or disable auto-download and pull the weights manually.

    This pack is small and young (it's the kind of thing with zero search impressions yet), so bugs surface in the log file and the README rather than in a thriving forum. But the core model it wraps is a genuinely capable piece of OCR tech, and this is the cleanest ComfyUI path to it.

    CategoryDeepSeek/OCR

    Inputs (2)

    NameTypeDefaultDescription
    dtypeCOMBObf163 options: bf16, fp16, fp32
    deviceSTRINGcuda

    Outputs (1)

    NameTypeDescription
    modelDPSK_OCR