🍭大炮-Qwen3VL批量打标@炮老师的小课堂
Caption an entire folder to .txt with Qwen3-VL — the dataset workhorse
- 🎯 Qwen3VL额外选项
- 处理结果
If you've ever hand-captioned a LoRA dataset, you know why this node exists. Qwen3VL_Batch_Caption from the 大炮-Qwen3VL pack points at a folder, runs every image in it through Qwen3-VL, and writes a <imagename>.txt next to each one. That's the whole job, and it's the one you'll actually reach for when the dataset is 500 images and your patience is not.
Captioning is the highest-leverage thing you do before a training run, and the rule that survives every architecture change is: describe what you want to remain variable, leave what should stay fixed undescribed. This node is the automation around that rule - it doesn't decide what a good caption says, it just makes the model write one per file in your chosen style. For the natural-language bases (Flux, Z-Image, Qwen-Image, Krea 2) that's exactly what you want; the community standard is to auto-caption a large set with a VLM like this and audit the small, important ones by hand.
How it works
It's a thin driver around the pack's main node - it instantiates Qwen3VL_Advanced internally and feeds it one image at a time. So it shares all the same machinery: models auto-download to ComfyUI/models/prompt_generator/, the default 4B model needs ~6GB VRAM at FP16 (or ~2GB in 4-bit), and the model unloads after the run unless you flip 🔄 保持模型加载 on. The flow is: read folder → sort images → skip any that already have a .txt → caption the rest → report.
Two behaviors are easy to miss and worth internalizing. First, it resumes: existing .txt files are skipped unless 🔄 强制覆盖 is on, so a crashed run doesn't restart from zero. Second, if your seed control is set to 随机, the node forces overwrite - that combination means every run re-captions everything, which is the intended "generate a different flavor" loop, but it will surprise you if you expected resume behavior and forgot the seed mode.
The inputs that matter
- 📁 输入文件夹 / 📂 输出文件夹 - input path is required and must exist; output defaults to the input folder, so plain
.txtfiles appear beside the images. - 🤖 模型选择, ⚙️ 量化级别, 🖼️ 最大长边 - same model stack as the main node. Keep 最大长边 at 768 for speed and VRAM headroom; bigger doesn't meaningfully buy you better captions here.
- 💭 预设提示词 - the five captioning styles (tag list / simple / detailed / ultra-detailed / cinematic). For training captions on LLM-encoder bases, detailed is the sensible default and 标签 (tag style) is what you'd pick if you were feeding an anime lineage instead. ✏️ 自定义提示词 overrides all of them.
- 📝 前缀文本 / 📌 后缀文本 - text prepended/appended to every caption. This is your trigger-word slot: a character LoRA wants its trigger token in front of each caption, and this is where it goes.
- 🔢 最大令牌数, 🌡️ 采样温度, 🎯 核采样参数 - generation dials. Leave them unless output is too long or too samey.
- 🔄 重命名文件, 🏷️ 文件名前缀, 🔢 起始编号 - optionally rename outputs to
image_0001.txtstyle instead of matching source names. Handy for feeding a trainer that wants normalized filenames. - 🎲 随机种子 / 🎯 种子控制 - in 固定 mode you get deterministic captions per image (useful when debugging caption quality); 递增 gives each image its own seed in order.
The optional 🎯 Qwen3VL额外选项 socket takes the pack's extra-options node, which appends things like "include lighting info" or "exclude NSFW descriptions" to every caption - worth a look if you want photography-style detail without hand-writing a custom prompt.
The output, 处理结果, is a summary report string (success/fail/skip counts and a file list). Wire it to a text display or ignore it - the real output is the .txt files on disk.
Installing and troubleshooting
Same as the rest of the pack - ComfyUI Manager (search ComfyUI-Qwen3VL-DP) or:
cd ComfyUI/custom_nodes
git clone https://github.com/paolaoshi/ComfyUI-Qwen3VL-DP
cd ComfyUI-Qwen3VL-DP
pip install -r requirements.txt
then restart. The transformers >= 4.57.0 requirement is non-negotiable - the "Transformers does not recognize this architecture" error for qwen3_vl means your transformers is too old. First run downloads the model (several GB), and large source images can spike VRAM, so keep 最大长边 down. The folder captioning pattern has been community-tested for years on other VLMs; the only real gotcha unique to this node is the seed-mode-overwrites-existing-txt behavior above. Point it at a copy of your dataset first, check one .txt, then let it run.
Inputs (21)
| Name | Type | Default | Description |
|---|---|---|---|
| 🤖 模型选择 | COMBO | Qwen3-VL-4B-Instruct | 20 options: Qwen3-VL-2B-Instruct, Qwen3-VL-2B-Thinking, Qwen3-VL-2B-Instruct-FP8, Qwen3-VL-2B-Thinking-FP8, Qwen3-VL-4B-Instruct, Qwen3-VL-4B-Thinking, +14 |
| ⚙️ 量化级别 | COMBO | None (FP16) | 3 options: 4-bit (节省显存), 8-bit (平衡), None (FP16) |
| 🖼️ 最大长边 | INT | 768256–2048 | — |
| 📁 输入文件夹 | STRING | — | |
| 📂 输出文件夹 | STRING | — | |
| 💭 预设提示词 | COMBO | 提示词风格 - 详细 | 5 options: 提示词风格 - 标签, 提示词风格 - 简单, 提示词风格 - 详细, 提示词风格 - 极致详细, 提示词风格 - 电影感 |
| ✏️ 自定义提示词 | STRING | — | |
| 🔢 最大令牌数 | INT | 102464–4096 | — |
| 🌡️ 采样温度 | FLOAT | 0.60.1–1 | — |
| 🎯 核采样参数 | FLOAT | 0.900–1 | — |
| 🚀 开启TF32加速 | BOOLEAN | false | 启用TF32加速(仅支持Ampere及以上架构显卡,如30/40/50系,能显著提升速度) |
| 🔄 保持模型加载 | BOOLEAN | false | — |
| 🎲 随机种子 | INT | -1-1–18446744073709550000 | 随机种子,-1为随机 |
| 🎯 种子控制 | COMBO | 随机 | 3 options: 随机, 固定, 递增 |
| 📝 前缀文本 | STRING | — | |
| 📌 后缀文本 | STRING | — | |
| 🔄 重命名文件 | BOOLEAN | false | — |
| 🏷️ 文件名前缀 | STRING | image_ | — |
| 🔢 起始编号 | INT | 10–9999999 | — |
| 🔄 强制覆盖 | BOOLEAN | false | 启用后会覆盖已存在的txt文件,用于重新生成不同风格的描述 |
| 🎯 Qwen3VL额外选项opt | QWEN3VL_EXTRA_OPTIONS | 可选的Qwen3VL额外选项,连接Qwen3VL额外选项节点 |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| 处理结果 | STRING | — |