Nodes/comfyui_LLM_party/🖥️GOT-OCR2
ComfyUI Node

🖥️GOT-OCR2

A local vision model built to read structured documents

By heshengtao·Created 2 years ago·Updated 7 days ago· 2,321
🖥️GOT-OCR2
  • image
  • text
model_name_or_path
deviceauto
ocr_typeformat
is_enabletrue
ocr_box
ocr_color
multi_cropfalse
renderfalse
out_dir_path/tmp/ComfyUI/custom_nodes/comfyui_LLM_party/output
dtypebfloat16

Most OCR tools are built to read plain text and lose everything else - tables collapse into a wall of words, formulas turn into gibberish, layout disappears. GOT-OCR2.0 ("General OCR Theory") is a purpose-built vision-language model designed specifically to handle that: documents with structure, not just strings of characters. This node runs it locally inside comfyui_LLM_party, no API key required - just a model to load and, ideally, a decent GPU.

How it works

You point it at a GOT-OCR2 checkpoint (a Hugging Face repo id or a local path - there's no built-in default, so this is a required field you have to fill in yourself) and it loads the model with the transformers library. Feed it an image and pick whether you want plain-text extraction or format-preserving output that keeps structure like tables and formulas intact.

The inputs and outputs that matter

  • model_name_or_path - the model to load. No default value at all, which is the first trap: leave it empty and the node has nothing to load. Point it at a GOT-OCR2 checkpoint on Hugging Face or a local copy you've already downloaded.
  • device (auto / cuda / cpu / mps) - where inference runs.
  • ocr_type - format (default) preserves structure - tables, formulas, layout - in the output; ocr gives you plain text only, faster and simpler when structure doesn't matter.
  • image - the document or image to read.
  • dtype (float32 / float16 / bfloat16 / int8 / int4) - precision, and the main lever for fitting the model on a smaller GPU. Lower precision uses less VRAM at some quality cost; int4 is the most aggressive option if you're VRAM-constrained.
  • ocr_box / ocr_color (optional) - target a specific region of the image instead of the whole thing.
  • multi_crop (optional) - for large images, crop and process in sections rather than one pass.

Output: text - the extracted content, structured or plain depending on ocr_type.

How to install it

Search comfyui_LLM_party in ComfyUI Manager and install, restart, then fill in model_name_or_path on the node before your first run. Manual install:

cd ComfyUI/custom_nodes
git clone https://github.com/heshengtao/comfyui_LLM_party.git

Run pip install -r requirements.txt from the pack's folder with ComfyUI's Python, then restart. If you give it a Hugging Face repo id rather than a local path, the model weights download automatically on first run - that first run will take a while and needs enough disk space and bandwidth to pull a multi-gigabyte checkpoint.

Common issues & troubleshooting

It errors out immediately on a fresh install. Check model_name_or_path first - it has no default, so an empty field is a guaranteed failure before the node even gets to your image. This is the single most common trap with this node specifically, since most of this pack's other model-loading nodes at least have a placeholder.

Out-of-memory on a smaller GPU. Step down dtype - try bfloat16 or float16 before jumping straight to int8/int4, since quantization further than you need costs quality for no benefit.

Tables or formulas still come out garbled. Confirm ocr_type is set to format, not ocr - the plain-text mode intentionally discards the structure-preserving behavior that's the whole point of reaching for this model over a simpler OCR tool.

Category大模型派对(llm_party)/图片(image)

Inputs (11)

NameTypeDefaultDescription
model_name_or_pathSTRING
deviceCOMBOauto4 options: auto, cuda, cpu, mps
ocr_typeCOMBOformat2 options: ocr, format
imageIMAGE
is_enableBOOLEANtrue
ocr_boxoptSTRING
ocr_coloroptSTRING
multi_cropoptBOOLEANfalse
renderoptBOOLEANfalse
out_dir_pathoptSTRING/tmp/ComfyUI/custom_nodes/comfyui_LLM_party/output
dtypeoptCOMBObfloat165 options: float32, float16, bfloat16, int8, int4

Outputs (1)

NameTypeDescription
textSTRING