JoyCaption Run
The community's default captioner, running locally in ComfyUI
- image
- text
JoyCaption Run is the local-captioning half of this pack: it runs the community's default natural-language captioner - fpgaminer's JoyCaption - on your own GPU, no API, no key, no uploads. If you're building a LoRA training set for a Flux/Z-Image-style base, this is the node you actually want from the whole pack, because it's the one that does the heavy, private, offline job the API nodes can't.
JoyCaption is the 8B vision-language model that became the training-caption standard (joycaption.json has the full story): built from scratch because the alternatives were an expensive censored API or a weak open model, with equal SFW and NSFW coverage as the founding design goal. This node wraps it for ComfyUI with the practical extras - batch-caption a whole folder of images, save each caption next to its image, and pick an NF4-quantized build that fits on modest VRAM. For a large dataset it's the difference between hand-writing hundreds of captions and walking away while the card churns.
How it works
The node loads a JoyCaption model from your ComfyUI/models/LLM/ folder into memory (a cached singleton, so repeated runs reuse it), runs inference over either a single image tensor or every image in an images_dir folder, and writes/returns captions. The "nf4" model variants load 4-bit via bitsandbytes - the README calls it "a blessing for low VRAM users," and it is. unload_model (default on) frees the VRAM after each run so the model doesn't squat on your card between jobs. The heavy dependencies - transformers, bitsandbytes, accelerate, optimum - are all in the pack's requirements.txt.
The inputs that matter
image(IMAGE, optional) - a single image from the canvas.images_dir(STRING, optional) - a folder path; the node finds every image in it and captions them in a batch, saving each caption to a.txtnext to its image (or intosave_img_prompt_to_folderif you set that). This is the node's superpower.preset_prompt- ten one-shot caption styles (formal, casual, stable diffusion prompt, MidJourney, booru tags, art critic, product listing, social post...). Leave it on the default for descriptive captions, or set it toNone- important, see below.merge_prompt(BOOLEAN) - looks like it appends your custompromptto the preset. It doesn't, in practice.model- four choices: alpha-two / beta-one, each in full or NF4.llama-joycaption-beta-one-hf-llava-nf4(default) is the current best on consumer VRAM.max_new_tokens/temperature/top_k/top_p/do_sample/use_cache/seed- generation controls; defaults are sensible.unload_model- leave on unless you're chaining many caption runs back to back.tagger(optional) - an extra tag string prepended to the prompt for the booru-style modes.
Output: text (STRING) - the caption for a single image, or a confirmation path for folder batches.
Installing it
Part of ComfyUI_Prompt-All-In-One (billwuhao). ComfyUI Manager → search Prompt-All-In-One, or clone + pip install -r requirements.txt. The models do not auto-download - grab the one you want from the README's HuggingFace links (fancyfeast for the full builds, John6666 for the NF4 quants) and place the folder under ComfyUI/models/LLM/. Restart, and it's under 🎤MW/MW-Prompt-All-In-One.
Where people get burned
Two gotchas from reading the source. First, preset_prompt overrides your prompt whenever it isn't None, and the merge_prompt toggle doesn't actually merge - the merged string gets overwritten by the preset on the next line of code. So if your custom prompt isn't taking effect, set preset_prompt to None. Second, NF4 needs a working bitsandbytes install - on Windows that means the right prebuilt wheel for your torch/CUDA version; if the model fails to load, that's the first place to look. Also remember JoyCaption's known weakness (it's in llm-in-comfyui.md): multi-subject attribution is shaky, so audit anything important by hand. But for the bulk job - hundreds of images, natural-language captions, offline and uncensored - this node is the real deal.
Inputs (16)
| Name | Type | Default | Description |
|---|---|---|---|
| prompt | STRING | — | |
| preset_prompt | COMBO | Write a descriptive caption for this image in a formal tone.-以正式的语气为这张图片写一个描述性的标题。 | 10 options: None, Write a descriptive caption for this image in a formal tone.-以正式的语气为这张图片写一个描述性的标题。, Write a descriptive caption for this image in a casual tone.-以随意的语气为这张图片写一个描述性的标题。, Write a stable diffusion prompt for this image.-为这张图片写一个 stable diffusion 提示。, Write a MidJourney prompt for this image.-为这张图片写一个 MidJourney 提示。, Write a list of Booru tags for this image.-为这张图片写一个 Booru 标签列表。, +4 |
| merge_prompt | BOOLEAN | false | — |
| model | COMBO | llama-joycaption-beta-one-hf-llava-nf4 | 4 options: llama-joycaption-alpha-two-hf-llava-nf4, llama-joycaption-alpha-two-hf-llava, llama-joycaption-beta-one-hf-llava, llama-joycaption-beta-one-hf-llava-nf4 |
| use_cache | BOOLEAN | true | — |
| do_sample | BOOLEAN | true | — |
| temperature | FLOAT | 0.600–2 | — |
| top_k | INT | 100–100 | — |
| top_p | FLOAT | 0.900–1 | — |
| max_new_tokens | INT | 2561–2048 | — |
| seed | INT | 00–18446744073709550000 | — |
| unload_model | BOOLEAN | true | — |
| save_img_prompt_to_folder | STRING | — | |
| imageopt | IMAGE | — | |
| images_diropt | STRING | — | |
| taggeropt | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| text | STRING | — |