CXH_MinCP3_4B_Chat
A local text LLM inside your ComfyUI graph
- pipe
- STRING
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- fromCXH_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. seeddoesn't force deterministic output - the source passes it through but generation settings are what they are. For reproducible outputs, fixtemperaturelow andtop_phigh.- 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.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| pipe | CXH_MinCP3_4B_Pipe | — | |
| prompt | STRING | Provide 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_p | FLOAT | 10–1 | — |
| max_tokens | INT | 102410–4048 | — |
| temperature | FLOAT | 0.700–1 | — |
| seed | INT | 6565450–1000000 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | — |