Nodes/lf-nodes/Load WD14 model (timm)
ComfyUI Node

Load WD14 model (timm)

Load the WD14 tagger (the accurate, heavy way)

By lucafoscili·Created 2 years ago·Updated 6 days ago· 35
Load WD14 model (timm)
  • ui_widget
  • tagger
model_idSmilingWolf/wd-vit-large-tagger-v3
architecturevit_large_patch16_224
num_classes10861
image_size448
mean0.5,0.5,0.5
std0.5,0.5,0.5
min_probability0.25
max_tags20
tags_to_exclude

This is the loader half of LF's tag-captioning pair: LF_LoadWD14Model gives you a ready-to-run WD14 tagger object, which you then feed into LF_CaptionImageWD14 along with an image to get booru tags out. Think of it as the "make me a tagger" node - the tagger output is a processor + model + settings bundle, not anything you can see on screen.

WD14 (the Danbooru tagger, from the wd-vit-* model family) is the standard tool for captioning anime-image datasets the way Illustrious/Pony/NoobAI were trained. It doesn't describe scenes; it emits the known tag vocabulary with confidence scores. That's a feature, not a limitation - the durable community practice is to run WD14 for tags and a natural-language describer like Florence-2 for scene context, then concatenate.

How it works

Default model_id is SmilingWolf/wd-vit-large-tagger-v3, the current generation of the SmilingWolf tagger family. The node's primary path loads it through HuggingFace transformers; the parameters architecture (vit_large_patch16_224), num_classes (10861), image_size (448) and the mean/std strings are the timm fallback path, kept for compatibility. In practice: leave them alone unless you know you're running the fallback.

The knobs that matter are in the optional section:

  • min_probability (default 0.25) - tags below this confidence get dropped. Lower it if the captions miss things you want; raise it if they're noisy.
  • max_tags (default 20) - how many tags max per image. For training captioning, 20 is a reasonable ceiling; you can push toward 30–40 for a detailed set.
  • tags_to_exclude - comma-separated tags to always strip (e.g. watermark, signature). Supports TagGUI-style escaped commas if a tag itself contains one.

The single output, tagger, carries the loaded processor + model + those defaults straight into LF_CaptionImageWD14.

Installing it

Part of lf-nodes, one install covers it:

cd ComfyUI/custom_nodes
git clone https://github.com/lucafoscili/lf-nodes

restart ComfyUI (or use ComfyUI Manager → "LF Nodes"). Requirements include transformers, timm, and torchvision. The big cost is the model itself: the vit-large tagger is roughly a 1.3GB download from HuggingFace on first load, cached afterward.

Choosing between this and the ONNX loader

lf-nodes ships two WD14 loaders. LF_LoadWD14Onnx runs the same model through onnxruntime - lighter on VRAM, happier on CPU, slightly fiddlier setup. This node (HF/timm) is generally the higher-fidelity path and the one to pick when you have a GPU to spare and care about tag accuracy on a training set. If you're captioning thousands of images on a modest machine, the ONNX version is the pragmatic choice. Where people get burned: forgetting the first-load model download exists and assuming the workflow is stuck.

Category✨ LF Nodes/Configuration

Inputs (10)

NameTypeDefaultDescription
model_idSTRINGSmilingWolf/wd-vit-large-tagger-v3HuggingFace WD14 model ID.
architectureSTRINGvit_large_patch16_224timm architecture for fallback path (kept for compatibility).
num_classesINT10861Number of classes/tags for WD14 model (used only in timm fallback).
image_sizeINT448Input image size for WD14 in timm fallback (Transformers path ignores this).
meanSTRING0.5,0.5,0.5Mean for normalization in timm fallback (comma-separated).
stdSTRING0.5,0.5,0.5Std for normalization in timm fallback (comma-separated).
min_probabilityoptFLOAT0.250–1Minimum confidence to keep a tag when using the HF/timm backend.
max_tagsoptINT20Maximum number of tags to output when using the HF/timm backend.
tags_to_excludeoptSTRINGTags to exclude (comma-separated; TagGUI-style escaped commas are supported).
ui_widgetoptLF_CODE[object Object]

Outputs (1)

NameTypeDescription
taggerTAGGERWD14 HF/timm tagger object (processor + model + defaults).