Nodes/Comfyui_CXH_joy_caption/CXH_MinCP3_4B_Chat
ComfyUI Node

CXH_MinCP3_4B_Chat

A local text LLM inside your ComfyUI graph

By StartHua·Created 2 years ago·Updated 2 years ago· 624
CXH_MinCP3_4B_Chat
  • pipe
  • STRING
promptProvide a detailed description of the details and content contained in the image, and generate a short prompt that can be used for image generation tasks in Stable Diffusion,remind you only need respons prompt itself and no other information.
top_p1
max_tokens1024
temperature0.70
seed656545

CXH_MinCP3_4B_Chat is the chat/query node for MiniCPM3-4B - the pack's text-only language model. You hand it a prompt, it hands you a completion. That's the whole node. What makes it worth having in this particular pack is the pipeline it connects to: caption a batch with JoyCaption, then run the resulting captions through this model for cleanup, translation, or reformatting - all locally, no API key, no data leaving your machine.

The README's changelog is blunt about what MiniCPM3-4B is good at: "chat, translation, rewriting are all strong." For a ComfyUI ecosystem that's mostly about vision, this is the text-tidying sidekick.

How it works

It's a plain generate loop. The prompt is wrapped via apply_chat_template into a single user message, run through pipe.model.generate(...) with your top_p, temperature, and max_tokens, and the response is decoded and returned. No image input, no vision - if you wire an image into this node you're mistaken; that's the MiniCPM-V 2.6 nodes' job.

Inputs and output

  • pipe - from CXH_MinCP3_4B_Load.
  • prompt - multiline; the default is the pack's generic "describe this image / make it an SD prompt" instruction, which is a leftover from the vision nodes and not very useful for a text-only chat. Replace it with what you actually want (translate to Chinese, rewrite as a training caption, summarize).
  • top_p (0–1, default 0.7), max_tokens (10–4048, default 1024), temperature (0–1, default 0.7), seed.
  • Output: one STRING - the model's reply.

Installing

Pack install - ComfyUI Manager (search "Comfyui_CXH_joy_caption") or:

cd ComfyUI/custom_nodes
git clone https://github.com/StartHua/Comfyui_CXH_joy_caption
cd Comfyui_CXH_joy_caption
python -m pip install -r requirements.txt

Model download happens on the loader node first run.

Troubleshooting

  • Default prompt is a vision prompt. That "provide a detailed description of the image" default only makes sense on the vision nodes. On a text-only model it'll happily hallucinate a description of nothing - change it.
  • Slow generation on a busy graph: 4B at bfloat16 with device_map="auto" can spill to CPU. Use the GPTQ-Int4 loader option if VRAM is tight.
  • seed doesn't force deterministic output - the source passes it through but generation settings are what they are. For reproducible outputs, fix temperature low and top_p high.
  • Translation note: MiniCPM3-4B is a Chinese-oriented model family; if your captions are English, it's perfectly usable, just not tuned for English-first like some Western models.
CategoryCXH/LLM

Inputs (6)

NameTypeDefaultDescription
pipeCXH_MinCP3_4B_Pipe
promptSTRINGProvide a detailed description of the details and content contained in the image, and generate a short prompt that can be used for image generation tasks in Stable Diffusion,remind you only need respons prompt itself and no other information.
top_pFLOAT10–1
max_tokensINT102410–4048
temperatureFLOAT0.700–1
seedINT6565450–1000000

Outputs (1)

NameTypeDescription
STRINGSTRING