训练采样器配置(开发版)
Schedule validation images while training runs
- sampler_config
A multi-hour training run that produces nothing you can look at until the end is a gamble. TrainingSamplerConfig is the node that removes the blindfold: it schedules the trainer to generate sample images from your model at set intervals, so you can watch the concept actually forming - or detect a collapsed run before you've wasted six hours. The display name is honest about its status: "训练采样器配置(开发版)", the dev-version training sampler.
How it works
This node produces a sampler_config - in practice a JSON string of sampling settings - that GeneralConfig (or AdvancedTrainConfig) folds into the training config. When the trainer hits the interval you set, it pauses briefly, runs the model on a validation prompt at your chosen resolution, and saves the result into the output directory where your TensorBoard dashboard picks it up.
Two knobs control when sampling happens, and they're mutually independent:
sample_every_n_steps- sample every N training steps.0disables step-based sampling.sample_every_n_epochs- sample every N epochs. Default1, which is why you'll get periodic samples even if you never touch this node.
Everything else controls what the sample looks like.
The inputs that matter
sample_every_n_steps/sample_every_n_epochs- the two scheduling knobs above.num_inference_steps- default20, how many denoising steps each sample gets. Lower = faster previews, rougher images.guidance_scale- default5.0, the CFG strength for the sample.height/width- default1024×1024, sample resolution. Match your training resolution or the previews won't represent what the model is learning.sample_prompt- the prompt used for samples. Leave it empty and it falls back to a caption from your training data, which is often better for seeing what the LoRA has learned - your trigger-word captions are what it's actually training on.
Install
The usual: ComfyUI Manager → search "Diffusion_pipe_in_ComfyUI", or:
cd ComfyUI/custom_nodes
git clone --recurse-submodules https://github.com/TianDongL/Diffusion_pipe_in_ComfyUI.git
cd Diffusion_pipe_in_ComfyUI
git submodule init && git submodule update
pip install -r requirements.txt
Linux/WSL2 only, as always with this pack.
Where people get burned
Sampling costs VRAM and time inside an already-expensive run. If your run keeps dying right after a "sample" appears in the logs, the sampler is likely the culprit - drop sample_every_n_steps to 0 and sample only per-epoch. Also note it's a dev-version node, so don't be shocked if behavior shifts between pack updates. And the preview resolution trap: leave the sample at 1024×1024 while training at 512 and the previews will look "wrong" even though the training is fine. Match them.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| sample_every_n_stepsopt | INT | 00–10000 | 每N步采样一次图片,0表示禁用按步数采样 |
| sample_every_n_epochsopt | INT | 10–100 | 每N个epoch采样一次图片,0表示禁用按epoch采样 |
| num_inference_stepsopt | INT | 201–100 | 推理采样步数 |
| guidance_scaleopt | FLOAT | 5.00–20 | CFG引导强度 (Classifier-Free Guidance Scale) |
| guidance_valueopt | FLOAT | 4.00–10 | 模型内部的guidance参数值 |
| heightopt | INT | 1024256–4096 | 采样图片高度 |
| widthopt | INT | 1024256–4096 | 采样图片宽度 |
| sample_promptopt | STRING | 采样时使用的提示词(留空则使用训练数据的caption) |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| sampler_config | SAMPLER_CONFIG | — |