LM Studio Caption Dataset
Same folder captioning, but with your own system prompt instead of a preset
- model
- dataset
- options
- captions
- written_caption_paths
- result
LM Studio Caption Dataset is the custom-prompt sibling of the pack's Easy-Caption Dataset node. Same folder-in, .txt-files-out pipeline, same trigger and overwrite handling - the only real difference is that instead of picking from the preset tasks (Booru-Style, Flux Family, and friends), you write the system prompt yourself. The author's default is baked in as a starting point: "You are a professional image captioner. Describe the image in natural, concise prose with attention to composition, lighting, and details."
That's the whole reason this node exists. The presets are tuned for common training targets, but captions are the highest-leverage thing you control in a LoRA run, and plenty of projects need a style no preset captures. Maybe you're captioning a product set and want every file to mention the brand. Maybe you want extremely terse captions, or a fixed sentence template, or a specific voice. Here, the system_prompt input is your captioning spec - edit it and every image gets captioned in that voice.
The mechanism is identical to its preset sibling: it takes a dataset dict from WAS Load Image Directory, walks the images, resizes each to image_max_size, sends it to the model running in LM Studio, and writes one .txt beside each image. It doesn't care which base you're training - that's your job to express in the prompt. The captioning rule that survives every architecture change still applies: describe what you want adjustable, leave fixed features undescribed, and keep temperature low for consistency.
Inputs that matter:
- model -
LMSTUDIO_MODELfrom the Model node; needs to be a vision model for image inputs. - dataset - the dict from WAS Load Image Directory.
- system_prompt - your captioning instructions. This is the input that distinguishes this node.
- user_prompt - optional extra per-run instructions layered on top.
- trigger_word_or_phrase + trigger_concat_mode - prepend or append a trigger to every caption. For a character or style LoRA, prepend is the usual move.
- caption_behavior -
overwrite(default) replaces an existing.txt;prepend/appendmerge into it, handy for adding a trigger to already-captioned sets. - options (optional) - per-request sampling overrides.
Outputs are the same triple as the preset version: captions (the strings), written_caption_paths (the .txt files written), and result (a single run summary string).
Setup is shared with the rest of the pack, so if you've installed it you're done - the one thing to remember is the security gate upstream: the image directory must sit under an allowed_root_directories entry in lmstudio_config.json, or WAS Load Image Directory will refuse it. Restart ComfyUI after editing that file.
cd ComfyUI/custom_nodes
git clone https://github.com/WASasquatch/ComfyUI_LMStudio_EasyQuery
pip install lmstudio numpy Pillow
Two practical notes. First, test your system prompt on a couple of images through the single-image Easy-Caption node before you let it loose on a thousand files - a bad prompt is a lot more expensive to fix after it's written. Second, if your model is a thinking model, wire an Options node with strip_thinking_tags on, or the reasoning text ends up in every caption file and you'll be scrubbing it out of a whole dataset.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| model | LMSTUDIO_MODEL | Model settings from LM Studio Model node. | |
| dataset | LMSTUDIO_DATASET_IMAGES | Dictionary produced by WASLoadImageDirectory mapping file paths to metadata. | |
| system_prompt | STRING | You are a professional image captioner. Describe the image in natural, concise prose with attention to composition, lighting, and details. | System prompt that defines the assistant's behavior and captioning style. |
| user_prompt | STRING | Optional extra instructions for each image. | |
| trigger_word_or_phrase | STRING | Optional trigger word or phrase to add to each caption. | |
| trigger_concat_mode | COMBO | prepend | Whether to prepend or append the trigger word/phrase to the caption. |
| caption_behavior | COMBO | overwrite | Behavior when caption file already exists: overwrite (replace), prepend (add before existing), append (add after existing). |
| optionsopt | LMSTUDIO_OPTIONS | Override generation options. |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| captions | STRING | — |
| written_caption_paths | STRING | — |
| result | STRING | — |