Nodes/WAS LMStudio Easy-Query/LM Studio Easy-Caption Dataset
ComfyUI Node

LM Studio Easy-Caption Dataset

Batch-caption a whole folder into training-ready .txt files

By WASasquatch·Created 11 months ago·Updated 6 months ago· 19
LM Studio Easy-Caption Dataset
  • model
  • dataset
  • options
  • captions
  • written_caption_paths
  • result
task_nameBooru-Style
user_prompt
trigger_word_or_phrase
trigger_concat_modeprepend
caption_behavioroverwrite

LM Studio Easy-Caption Dataset is where the WAS LMStudio Easy-Query pack stops being a toy and starts being a training pipeline. Give it a folder of images and it captions every single one, writing a .txt file next to each image - which is exactly the format your LoRA trainer wants. If you've ever stared at a thousand uncaptioned images and thought "there has to be a better way," this is that way, and it runs entirely on your own hardware.

It's the batch sibling of the Easy-Caption node, built on top of WAS Load Image Directory. That node scans a folder and hands this one a LMSTUDIO_DATASET_IMAGES dict; this node walks the dict, captions each image via LM Studio, and writes the result to disk. Since it's per-file, it's the honest way to caption a real dataset - one request per image, so a batch mode that overflows the context window isn't a risk. The output captions list gives you what it wrote, in order, if you want to review before training.

Inputs that matter:

  • model - the LMSTUDIO_MODEL from the Model node; pick a vision model (Qwen3-VL / qwen2.5-vl class) and keep temperature low.
  • dataset - the dict produced by WAS Load Image Directory. Nothing works until that's wired in and the folder is whitelisted (see below).
  • task_name - the same preset system prompts as Easy-Caption: Booru-Style, SDXL Family, Wan Family, Flux Family, Photorealism Caption, Basic Tags, Anime Caption. This is how you match your caption style to the base model you're training on - tags for the anime lineage, prose for Flux/Wan.
  • trigger_word_or_phrase + trigger_concat_mode - stick your trigger on the front (prepend, default) or back (append) of every caption. For a style or character LoRA you'll usually want it prepended.
  • caption_behavior - what to do when a .txt already exists: overwrite (default, replaces it), prepend, or append. Overwrite is the sane default for a fresh run; prepend/append let you layer a trigger onto existing captions without regenerating them.
  • user_prompt - optional extra instructions; options - optional per-request overrides.

Outputs: captions (list of the caption strings), written_caption_paths (list of the .txt files written - handy to verify the run), and result (a single string summarizing the run).

Two setup steps matter, both from the README. First, the security gate: the directory must be whitelisted in lmstudio_config.json under allowed_root_directories, or the load node upstream refuses to touch it. Add your dataset path there and restart ComfyUI:

"allowed_root_directories": ["/mnt/k/datasets", "/home/user/images"]

Use forward slashes even on Windows. Second, install the pack and its Python deps:

cd ComfyUI/custom_nodes
git clone https://github.com/WASasquatch/ComfyUI_LMStudio_EasyQuery
pip install lmstudio numpy Pillow

restart, and have LM Studio running with a VLM downloaded.

Where people get burned: dataset loading fails because the path isn't under an allowed root - check lmstudio_config.json first, not the node. And remember the captioning rule of thumb from the training docs: describe what you want to stay variable, leave what should be fixed undescribed. A good preset helps, but the prompt is only half the equation. If you're captioning a thinking model, run an Options node with strip_thinking_tags on, or every .txt will open with a chain of thought.

CategoryLM Studio

Inputs (8)

NameTypeDefaultDescription
modelLMSTUDIO_MODELModel settings from LM Studio Model node.
datasetLMSTUDIO_DATASET_IMAGESDictionary produced by WASLoadImageDirectory mapping file paths to metadata.
task_nameCOMBOBooru-StyleCaption preset (system prompt).
user_promptSTRINGOptional extra instructions.
trigger_word_or_phraseSTRINGOptional trigger word or phrase to add to each caption.
trigger_concat_modeCOMBOprependWhether to prepend or append the trigger word/phrase to the caption.
caption_behaviorCOMBOoverwriteBehavior when caption file already exists: overwrite (replace), prepend (add before existing), append (add after existing).
optionsoptLMSTUDIO_OPTIONSOverride generation options.

Outputs (3)

NameTypeDescription
captionsSTRING
written_caption_pathsSTRING
resultSTRING