Nodes/ComfyUI-Qwen3VL-DP/🍭大炮-Qwen3VL批量打标@炮老师的小课堂
ComfyUI Node

🍭大炮-Qwen3VL批量打标@炮老师的小课堂

Caption an entire folder to .txt with Qwen3-VL — the dataset workhorse

By paolaoshi·Created 9 months ago·Updated 7 months ago· 117
🍭大炮-Qwen3VL批量打标@炮老师的小课堂
  • 🎯 Qwen3VL额外选项
  • 处理结果
🤖 模型选择Qwen3-VL-4B-Instruct
⚙️ 量化级别None (FP16)
🖼️ 最大长边768
📁 输入文件夹
📂 输出文件夹
💭 预设提示词提示词风格 - 详细
✏️ 自定义提示词
🔢 最大令牌数1024
🌡️ 采样温度0.6
🎯 核采样参数0.90
🚀 开启TF32加速false
🔄 保持模型加载false
🎲 随机种子-1
🎯 种子控制随机
📝 前缀文本
📌 后缀文本
🔄 重命名文件false
🏷️ 文件名前缀image_
🔢 起始编号1
🔄 强制覆盖false

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 .txt files 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.txt style 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.

Category🍭大炮-Qwen3VL

Inputs (21)

NameTypeDefaultDescription
🤖 模型选择COMBOQwen3-VL-4B-Instruct20 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
⚙️ 量化级别COMBONone (FP16)3 options: 4-bit (节省显存), 8-bit (平衡), None (FP16)
🖼️ 最大长边INT768256–2048
📁 输入文件夹STRING
📂 输出文件夹STRING
💭 预设提示词COMBO提示词风格 - 详细5 options: 提示词风格 - 标签, 提示词风格 - 简单, 提示词风格 - 详细, 提示词风格 - 极致详细, 提示词风格 - 电影感
✏️ 自定义提示词STRING
🔢 最大令牌数INT102464–4096
🌡️ 采样温度FLOAT0.60.1–1
🎯 核采样参数FLOAT0.900–1
🚀 开启TF32加速BOOLEANfalse启用TF32加速(仅支持Ampere及以上架构显卡,如30/40/50系,能显著提升速度)
🔄 保持模型加载BOOLEANfalse
🎲 随机种子INT-1-1–18446744073709550000随机种子,-1为随机
🎯 种子控制COMBO随机3 options: 随机, 固定, 递增
📝 前缀文本STRING
📌 后缀文本STRING
🔄 重命名文件BOOLEANfalse
🏷️ 文件名前缀STRINGimage_
🔢 起始编号INT10–9999999
🔄 强制覆盖BOOLEANfalse启用后会覆盖已存在的txt文件,用于重新生成不同风格的描述
🎯 Qwen3VL额外选项optQWEN3VL_EXTRA_OPTIONS可选的Qwen3VL额外选项,连接Qwen3VL额外选项节点

Outputs (1)

NameTypeDescription
处理结果STRING