Nodes/🐰 MaraScott Nodes/🐰 DownloadAndLoadFlorence2Model /v (from Kijai)
ComfyUI Node

🐰 DownloadAndLoadFlorence2Model /v (from Kijai)

Florence-2 model loader β€” it downloads itself, so don't panic at the multi-GB pull

By MaraScottΒ·Created 3 years agoΒ·Updated 10 months agoΒ· 179
🐰 DownloadAndLoadFlorence2Model /v (from Kijai)
  • lora
  • florence2_model
β—„modelmicrosoft/Florence-2-baseβ–Ί
β—„precisionfp16β–Ί
β—„attentionsdpaβ–Ί

Every captioning, OCR or object-detection workflow built on Florence-2 starts with a loader, and this is MaraScott's vendored copy of Kijai's - the exact same node you'd get from ComfyUI-Florence2, wrapped in the pack's namespace. Its job: take a model name, download it if it isn't local yet, load it into VRAM in your chosen precision, and hand you a FL2MODEL object for Florence2Run to consume.

The name is a promise, and it keeps it: pick a model from the dropdown, and it downloads from Hugging Face on the spot. No manual model-file wrangling into models/ like older packs demanded.

How it works

The loader pulls the model into ComfyUI/models/LLM/<model-name> via snapshot_download, then loads it with the transformers library using your precision and attention settings. The three controls map directly to what you'd pick in any HF notebook:

  • model - 13 presets: the Microsoft base/large pairs, DocVQA, the CogFlorence fine-tunes, and the community captioning fine-tunes (gokaygokay/Florence-2-SD3-Captioner, the Flux-Large captioner, and MiaoshouAI's PromptGen series). Default is microsoft/Florence-2-base.
  • precision - fp16 (default), bf16, fp32. On a modern GPU fp16 is the sweet spot; bf16 if you want the extra headroom, fp32 only if you're chasing accuracy on weird hardware.
  • attention - sdpa (default), flash_attention_2, eager. sdpa is the safe modern default and what you should start with.
  • Optional lora input (PEFTLORA) - lets you stack a LoRA on top of the base model.

Output: a single florence2_model of type FL2MODEL β†’ straight into Florence2Run.

Installing it

Part of the MaraScott pack: ComfyUI Manager β†’ search "MaraScott" β†’ Install β†’ restart. Or:

cd ComfyUI/custom_nodes
git clone https://github.com/MaraScott/ComfyUI_MaraScott_Nodes

Then restart. Two real install considerations. First, the model download: the base model is a couple of GB, large is bigger - make sure you have disk and a decent connection; it happens once. Second, the pack pins transformers==4.37.2 in its requirements, and Florence-2 genuinely runs on it, but that pin can conflict with other packs wanting newer transformers - if you install this alongside other LLM packs, be ready to reconcile. flash_attention_2 additionally needs the flash-attn build; don't enable it until you know your setup has it.

Common issues

The first-run "Downloading Florence2 model" hang scares people every time - it's just the snapshot download; let it finish. If loading fails right after a download, a partial/corrupt download is the usual suspect: delete the folder under ComfyUI/models/LLM/ and reload. If you hit an attention-related error, switch to sdpa - it needs no extra deps. And if keep_model_loaded isn't toggled on the Run node, expect the model to reload between runs, which adds seconds each time.

Category🐰 MaraScott/vendor

Inputs (4)

NameTypeDefaultDescription
modelCOMBOmicrosoft/Florence-2-base13 options: microsoft/Florence-2-base, microsoft/Florence-2-base-ft, microsoft/Florence-2-large, microsoft/Florence-2-large-ft, HuggingFaceM4/Florence-2-DocVQA, thwri/CogFlorence-2.1-Large, +7
precisionCOMBOfp163 options: fp16, bf16, fp32
attentionCOMBOsdpa3 options: flash_attention_2, sdpa, eager
loraoptPEFTLORAβ€”

Outputs (1)

NameTypeDescription
florence2_modelFL2MODELβ€”