Nodes/ComfyUI-NunchakuFluxLoraStacker/hswq_Florence2ModelLoader
ComfyUI Node

hswq_Florence2ModelLoader

The same loader, for weights you already have on disk

By ussoewwin·Created about a year ago·Updated 15 days ago· 22
hswq_Florence2ModelLoader
  • lora
  • florence2_model
◄model▾►
◄precision▾►
◄attentionsdpa►
◄convert_to_safetensorsfalse►

This is the offline twin of hswq_DownloadAndLoadFlorence2Model. Identical outputs, identical precision and attention options, one difference: instead of picking a Hugging Face repo and having the node fetch it, model is a folder name under ComfyUI/models/LLM/. If the weights are already there, this is the node you want.

You'll reach for it in three situations. You downloaded a checkpoint by hand (or with huggingface-cli) and don't want a second copy. You're running a fine-tune that isn't one of the fourteen presets the download node accepts. Or you already have Kijai's Florence-2 pack installed, which uses the same models/LLM location - so its downloads show up here for free.

How it works

The node enumerates the LLM model paths ComfyUI knows about (so extra_model_paths.yaml counts too), keeps the directories, and offers them as the model dropdown - the tooltip says it plainly: "models are expected to be in Comfyui/models/LLM folder". Pick one and the loading path is exactly what the download node does after its download: with transformers 5.x it uses the pack's own loader, building the model under init_empty_weights() and streaming tensors in from model.safetensors or pytorch_model.bin; on older transformers it uses the classic from_pretrained. Sage attention modes are configured as SDPA and swapped in at module level, and only actually engage on transformers ≥ 5.0 - below that you get a warning and SDPA.

Either way the model is parked on the offload device and moved to the GPU per run by hswq_Florence2Run, which offloads it again afterwards unless you flip its keep_model_loaded option.

Inputs and outputs

  • model - the folder dropdown. Note there's no Hugging Face fallback here: if the folder doesn't contain the weights, it errors rather than downloading.
  • precision - fp16, bf16, fp32. Worth watching: unlike its downloader sibling, this node declares no default, so the widget lands on the first entry (fp16). Set it deliberately to match what you saved.
  • attention - same five options, sdpa by default. Flash Attention 2 needs the flash-attn package; sage_attention_2 needs sageattention on a 3090/4090-class card; sage_attention_3 is Blackwell (5090) plus the sageattn3 wheel.
  • optional lora - the PEFTLORA socket, where hswq_DownloadAndLoadFlorence2Lora connects. Under the hood it wraps the loaded model with peft's PeftModel.from_pretrained.
  • optional convert_to_safetensors - converts a legacy .bin checkpoint to .safetensors for faster subsequent loads, and deletes the .bin when it succeeds.
  • output florence2_model (FL2MODEL), same structure as the download node, so the two are swappable in a working graph.

What the folder needs to look like

A standard Florence-2 repo layout - the config and the processor/tokenizer files next to the weights:

ComfyUI/models/LLM/Florence-2-large/
├── config.json
├── model.safetensors      # or pytorch_model.bin
└── ... tokenizer / processor files

If the weights aren't in there, you get a FileNotFoundError naming the path it checked, which is the one case where the error message tells you everything.

Installing it

Part of ussoewwin/ComfyUI-NunchakuFluxLoraStacker, which merged a fork of kijai/ComfyUI-Florence2 in under nodes/florence2/ - the hswq_ prefix keeps the class types distinct so both packs can be installed at once. Manager: search ComfyUI-NunchakuFluxLoraStacker. Manual:

cd ComfyUI/custom_nodes
git clone https://github.com/ussoewwin/ComfyUI-NunchakuFluxLoraStacker.git
pip install -r requirements.txt

Restart, then drop your model folder into ComfyUI/models/LLM/. The Florence-2 dependencies (transformers>=4.39.0,!=4.50.*, peft, accelerate, timm, matplotlib, pillow) are all in that requirements file - install the whole thing, not just the captioning bits, since the pack's CCSR dependencies are imported at load time and a missing one hides every node in it.

If something's off

Your new model isn't in the dropdown. The list is built when ComfyUI asks the node for its input types, from the folders that existed at that moment. Refresh the page (or restart) after copying a model in, then look again.

A model you didn't put there is listed. That's a side effect of the shared models/LLM convention - anything Kijai's pack or another Florence-2 pack downloaded shows up too. Harmless; just don't pick a folder that isn't a Florence-2 checkpoint.

It loads and then captions badly / errors inside the run. Check precision matches the weights you actually have, and that the folder is a complete repo rather than just a weights file.

An import error for flash attention or sage attention. You chose a backend whose package isn't installed. Switch attention to sdpa and move on.

CategoryFlorence2

Inputs (5)

NameTypeDefaultDescription
modelCOMBOmodels are expected to be in Comfyui/models/LLM folder
precisionCOMBO3 options: fp16, bf16, fp32
attentionCOMBOsdpa5 options: flash_attention_2, sdpa, eager, sage_attention_2, sage_attention_3
loraoptPEFTLORA—
convert_to_safetensorsoptBOOLEANfalseSome of the older model weights are not saved in .safetensors format, which seem to cause longer loading times, this option converts the .bin weights to .safetensors

Outputs (1)

NameTypeDescription
florence2_modelFL2MODEL—