Nodes/ComfyUI_LayerStyle_Advance/LayerUtility: JoyCaption2 Split(Advance)
ComfyUI Node Runs on cloud

LayerUtility: JoyCaption2 Split(Advance)

JoyCaption2 Split — JoyCaption2 captioning with a shared, pre-loaded model

By chflame163·Created 2 years ago·Updated 4 months ago· 696
LayerUtility: JoyCaption2 Split(Advance)
  • image
  • joy2_model
  • extra_options
  • text
caption_type
caption_length
user_prompt
max_new_tokens300
top_p0.90
temperature0.60

Same captioning model as this pack's plain JoyCaption2 node - fpgaminer's "alpha-two" generation, built specifically to be uncensored and free where the alternatives at the time were either paywalled and filtered (ChatGPT) or open but weak and still censored past PG (CogVLM), which is exactly why it became a default recommendation for captioning LoRA training sets. The difference here isn't the model, it's the wiring: this node splits model loading out into a separate Load JoyCaption2 Model node, and it exists specifically for one reason - when you have multiple JoyCaption2 nodes in a single graph, they can all share that one loaded model instead of each keeping its own copy resident in VRAM.

Why the split matters

The plain JoyCaption2 node bundles config and inference together - every instance of it manages its own model load, and cache_model is what keeps a given instance from reloading between runs. That's fine for one node. It gets wasteful fast if you're running several JoyCaption2 nodes in parallel - say, generating captions in a few different caption_type styles off the same image, or batching variants. JoyCaption2Split decouples the two: load the model once via Load JoyCaption2 Model, then wire that single handle into as many JoyCaption2Split nodes as you want, and they all run inference against the same in-memory model.

The inputs and outputs that matter

  • image - required, what you're captioning.
  • joy2_model - the shared model handle from Load JoyCaption2 Model. This is what makes the sharing work - no llm_model/device/dtype fields here, those live on the loader node instead.
  • caption_type - nine formats: Descriptive, Descriptive (Informal), Training Prompt (built specifically for feeding into diffusion model training, distinct from the plain descriptive modes), MidJourney, two Booru-style tag-list formats, and Art Critic / Product Listing / Social Media Post for non-training description work.
  • caption_length - a long list from any/very short up through explicit numeric token targets.
  • user_prompt - if filled in, overrides caption_type and any connected extra_options entirely; use it when you want full manual control over the instruction.
  • extra_options (optional) - takes a handle from the pack's JoyCaption2ExtraOptions node, for fine-grained inclusion/exclusion toggles (lighting, camera angle, watermark mentions, and similar detail categories).
  • max_new_tokens, top_p, temperature - standard sampling controls.

Output is text (a list - batch-friendly, one caption per image if you feed a batch).

How to install it

Recommended: ComfyUI Manager, search "ComfyUI Layer Style Advance". Manual:

cd ComfyUI/custom_nodes
git clone https://github.com/chflame163/ComfyUI_LayerStyle_Advance.git

Then install_requirements.bat / install_requirements_aki.bat, or pip install -r requirements.txt plus repair_dependency.bat. Restart.

Model files - needed by the Load JoyCaption2 Model node this depends on, but must be in place regardless: the LLM into ComfyUI/models/LLM, the SigLIP vision encoder into ComfyUI/models/clip, and the cgrkzexw-599808 adapter folder into ComfyUI/models/Joy_caption. All downloadable from Hugging Face directly, or via the author's Baidu mirror links.

Common issues & troubleshooting

UnboundLocalError on clip_processor or text_model, with model files confirmed present. This is the pack's well-documented JoyCaption2 failure mode: transformers needs updating to at least 4.43.2.

Same error persists after updating transformers to 4.45.0+, now with a protobuf descriptor error underneath. Downgrade protobuf to 3.20.3, or set the environment variable PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python - both are documented fixes for this exact combination.

Multiple JoyCaption2Split nodes still seem to be loading separate model copies, VRAM usage climbing with each one. Check they're all actually wired to the same Load JoyCaption2 Model node's output - the sharing only happens if they share the identical upstream handle, not just the same settings.

Not sure whether to use this over plain JoyCaption2. If you only need one caption pass per graph, plain JoyCaption2 is simpler - no extra loader node to wire up. Reach for Split specifically once you're running more than one JoyCaption2 call in the same workflow and want to avoid paying the model-load cost more than once.

Category😺dzNodes/LayerUtility

Inputs (9)

NameTypeDefaultDescription
imageIMAGE
joy2_modelJoyCaption2_Model
caption_typeCOMBO9 options: Descriptive, Descriptive (Informal), Training Prompt, MidJourney, Booru tag list, Booru-like tag list, +3
caption_lengthCOMBO31 options: any, very short, short, medium-length, long, very long, +25
user_promptSTRING
max_new_tokensINT3008–4096
top_pFLOAT0.900–1
temperatureFLOAT0.600–1
extra_optionsoptJoyCaption2ExtraOption

Outputs (1)

NameTypeDescription
textSTRING