LightOnOCR-2 Model Loader
The ~2GB download hiding behind ComfyUI's new OCR node
- model
This is the front half of a two-node OCR pipeline, and on its own it does absolutely nothing visible. No text, no image, just a model being pulled into ComfyUI. It's also the part people forget about until the first run of the other node stalls on a 2GB download. Get the loader right and the actual OCR is nearly boring - which is how you want it.
What it actually is
The Model Loader downloads LightOn's LightOnOCR-2-1B - a 1B-parameter vision-language model from the French AI lab LightOn AI - and packages it with its processor into a LIGHTONOCR2_MODEL object that flows to the companion LightOnOCR-2 Run node. The model is the star, not the wrapper: it's Apache-2.0 licensed, claims state-of-the-art results on the OlmOCR-Bench document-reading benchmark while being a fraction of the size of the competition, and has the download count (well over half a million on Hugging Face) to show for it.
This fills a real gap in ComfyUI. Before it, OCR in a workflow meant EasyOCR or PaddleOCR custom nodes, or leaning on Florence-2's text-recognition mode - which works but was never the point of that tiny generalist. A dedicated OCR model reads receipts, tables, forms, and multi-column pages in natural reading order, and that's a different class of thing. If your workflow is "scan a document and get clean text out," this is the node you reach for.
How it works
On first run it calls Hugging Face's from_pretrained and pulls the weights into your HF cache - a hair under 2GB for the bfloat16 safetensors, so go make tea. It loads the model and the processor (tokenizer plus image processor), wraps them in one object, and passes it along.
The clever bit is caching. The loader's IS_CHANGED returns NaN, so ComfyUI never skips it on re-runs - but the code keeps a class-level cache of the loaded model and short-circuits unless model_name, device, or dtype actually changed. That means you don't re-download and re-load every time you hit Run. Most loaders aren't that polite.
The inputs that matter
All three are dropdowns. You'll set model_name and probably never touch the others.
- model_name - six variants of the same 1B model. The default
lightonai/LightOnOCR-2-1Bis the flagship: "best OCR model," per the model card, and the one you want.-basevariants are for fine-tuning,-bboxvariants additionally emit bounding boxes for embedded images (the Run node in this pack ignores those), and the-soupvariants are merged for extra robustness. Ignore all of them. - device -
auto,cuda, orcpu.autopicks CUDA if present, then Apple MPS, then CPU. Leave it on auto. - dtype -
auto,bfloat16,float16,float32.autoresolves to bfloat16 on CUDA/CPU and float32 on MPS. Leave it, unless you're on an old GPU where bfloat16 misbehaves - then float32 is your safety net.
The single output is model, and it wires straight into the Run node's model input. Nothing else connects to it.
Installation
Install the pack once and both nodes appear under LightOnOCR-2 in the node menu. Easiest path is ComfyUI Manager: search "LightOnOCR-2" and install. Or do it by hand:
cd ComfyUI/custom_nodes
git clone https://github.com/MennilTossFlykune/ComfyUI-LightOnOCR-2.git
Then install the dependency - this is the real gotcha. The pack needs transformers >= 5.0.0, which is what ships the LightOnOcrForConditionalGeneration and LightOnOcrProcessor classes. Stock ComfyUI environments usually sit on an older 4.x, and the import will fail loudly with an ImportError telling you exactly this. Upgrade it in your ComfyUI Python environment:
pip install "transformers>=5.0.0" pillow
Restart ComfyUI. First run of the loader downloads the ~2GB model - subsequent runs are instant, thanks to that cache.
Where people get burned
The transformers version is the big one: if the loader throws an ImportError on startup, that's it. And because you're upgrading a library other custom nodes depend on, if something else in your setup pins an old transformers, upgrade that pack too - you're in dependency-resolution land now. The first-run download catching people by surprise is the other classic; it's not a hang, it's just 2GB. Give it a minute.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| model_name | COMBO | lightonai/LightOnOCR-2-1B | 6 options: lightonai/LightOnOCR-2-1B, lightonai/LightOnOCR-2-1B-base, lightonai/LightOnOCR-2-1B-bbox, lightonai/LightOnOCR-2-1B-bbox-base, lightonai/LightOnOCR-2-1B-ocr-soup, lightonai/LightOnOCR-2-1B-bbox-soup |
| device | COMBO | auto | 3 options: auto, cuda, cpu |
| dtype | COMBO | auto | 4 options: auto, bfloat16, float16, float32 |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| model | LIGHTONOCR2_MODEL | — |