模板概述
工作流结构
节点流程图(Mermaid)
graph TD
A[CheckpointLoaderSimple] -->|MODEL| B[KSampler]
A -->|CLIP| C[CLIPTextEncode]
A -->|CLIP| D[CLIPTextEncode]
A -->|VAE| E[VAEDecode]
C -->|CONDITIONING| B
D -->|CONDITIONING| B
F[EmptyLatentImage] -->|LATENT| B
B -->|LATENT| E
E -->|IMAGE| G[SaveImage]
style A fill:#e1f5ff
style B fill:#fff4e1
style C fill:#ffe1f5
style D fill:#ffe1f5
style E fill:#e1ffe1
style F fill:#e1ffe1
style G fill:#ffe1e1
批量生成流程
graph LR
A[设置batch_size=4] --> B[一次生成4张]
B --> C[自动编号保存]
style A fill:#e1ffe1
style B fill:#fff4e1
style C fill:#fff4e1
节点配置
1. CheckpointLoaderSimple
{
"inputs": {
"ckpt_name": "v1-5-pruned-emaonly.ckpt"
},
"class_type": "CheckpointLoaderSimple"
}
2. CLIPTextEncode (正向)
{
"inputs": {
"text": "beautiful landscape, mountains, sunset, 4k, detailed",
"clip": ["1", 1]
},
"class_type": "CLIPTextEncode"
}
3. CLIPTextEncode (负向)
{
"inputs": {
"text": "ugly, blurry, low quality",
"clip": ["1", 1]
},
"class_type": "CLIPTextEncode"
}
4. EmptyLatentImage(批量)
{
"inputs": {
"width": 512,
"height": 512,
"batch_size": 4
},
"class_type": "EmptyLatentImage"
}
5. KSampler
{
"inputs": {
"seed": 123456789,
"steps": 20,
"cfg": 7.5,
"sampler_name": "euler",
"scheduler": "normal",
"denoise": 1.0,
"model": ["1", 0],
"positive": ["2", 0],
"negative": ["3", 0],
"latent_image": ["4", 0]
},
"class_type": "KSampler"
}
6. VAEDecode
{
"inputs": {
"samples": ["5", 0],
"vae": ["1", 2]
},
"class_type": "VAEDecode"
}
7. SaveImage
{
"inputs": {
"filename_prefix": "batch_",
"images": ["6", 0]
},
"class_type": "SaveImage"
}
完整工作流JSON
{
"1": {
"inputs": {
"ckpt_name": "v1-5-pruned-emaonly.ckpt"
},
"class_type": "CheckpointLoaderSimple"
},
"2": {
"inputs": {
"text": "beautiful landscape, mountains, sunset, 4k, detailed",
"clip": ["1", 1]
},
"class_type": "CLIPTextEncode"
},
"3": {
"inputs": {
"text": "ugly, blurry, low quality",
"clip": ["1", 1]
},
"class_type": "CLIPTextEncode"
},
"4": {
"inputs": {
"width": 512,
"height": 512,
"batch_size": 4
},
"class_type": "EmptyLatentImage"
},
"5": {
"inputs": {
"seed": 123456789,
"steps": 20,
"cfg": 7.5,
"sampler_name": "euler",
"scheduler": "normal",
"denoise": 1.0,
"model": ["1", 0],
"positive": ["2", 0],
"negative": ["3", 0],
"latent_image": ["4", 0]
},
"class_type": "KSampler"
},
"6": {
"inputs": {
"samples": ["5", 0],
"vae": ["1", 2]
},
"class_type": "VAEDecode"
},
"7": {
"inputs": {
"filename_prefix": "batch_",
"images": ["6", 0]
},
"class_type": "SaveImage"
}
}
批量策略
策略1: 单次批量
graph TD
A[batch_size=4] --> B[一次生成4张]
B --> C[保存4张图像]
style A fill:#e1ffe1
style B fill:#fff4e1
style C fill:#fff4e1
策略2: 多次批量
graph TD
A[batch_size=2] --> B[第一次生成2张]
B --> C[第二次生成2张]
C --> D[共4张]
style A fill:#e1ffe1
style B fill:#fff4e1
style C fill:#fff4e1
style D fill:#fff4e1
参数说明
Batch Size设置
graph TD
A[Batch Size] --> B[1-2]
A --> C[2-4]
A --> D[4-8]
A --> E[8+]
B --> B1[低显存]
C --> C1[标准]
D --> D1[高显存]
E --> E1[大显存]
style A fill:#e1f5ff
style B fill:#fff4e1
style C fill:#ffe1f5
style D fill:#e1ffe1
style E fill:#ffe1e1
推荐配置
- 4GB显存: batch_size=1
- 8GB显存: batch_size=2-4
- 12GB+显存: batch_size=4-8
使用步骤
批量生成流程
graph LR
A[设置batch_size] --> B[生成图像]
B --> C[自动保存]
C --> D[查看结果]
style A fill:#e1ffe1
style B fill:#fff4e1
style C fill:#fff4e1
style D fill:#fff4e1
示例结果
示例1: 批量风景
- batch_size: 4
- 提示词: beautiful landscape, mountains, sunset
- 结果: 4张不同风景图像
示例2: 批量肖像
- batch_size: 2
- 提示词: portrait of beautiful woman, detailed
- 结果: 2张不同肖像图像
性能优化
优化策略
graph TD
A[性能优化] --> B[减少steps]
A --> C[使用快速采样器]
A --> D[降低分辨率]
A --> E[增加batch_size]
B --> B1[15-20步]
C --> C1[euler, euler_a]
D --> D1[512x512]
E --> E1[根据显存]
style A fill:#e1f5ff
style B fill:#fff4e1
style C fill:#ffe1f5
style D fill:#e1ffe1
style E fill:#ffe1e1
常见问题
Q1: batch_size设置多少?
A: 根据显存,通常2-4,大显存可以8+。
Q2: 显存不足怎么办?
A: 减小batch_size,降低分辨率。
Q3: 如何生成不同图像?
A: 使用随机seed,或修改提示词。
Q4: 批量生成速度慢?
A: 减少steps,使用快速采样器。
Q5: 如何自动编号?
A: SaveImage会自动编号,使用filename_prefix设置前缀。
相关模板
更新日志
- 2026-01-26: 初始版本创建