◀ 上一页
1 / 5
下一页 ▶
Stable Diffusion 1.5 Inpainting 宏观架构
从条件编码、完整 denoiser 到 VAE 解码;关键 shape 均取自 SD15-INPAINT-FULL 的实测记录。
1. Stable Diffusion 1.5 Inpainting 宏观架构
从条件编码、完整 denoiser 到 VAE 解码;关键 shape 均取自 SD15-INPAINT-FULL 的实测记录。
SD15-INPAINT-FULL
Prompt
token IDs
CLIP-L
完整文本编码器
[1, 77, 768]
Noisy latent / tokens
batch = 1
[1, 9, 64, 64]
Inpaint Condition
masked latent [1, 4, 64, 64]
mask [1, 1, 64, 64]
UNet2DConditionModel
9-channel Inpainting
完整生产层数,未折叠
[1, 4, 64, 64]
VAE Decoder
latent → pixels
[1, 3, 512, 512]
Final image
[1, 3, 512, 512]
ACTUAL-CUDA-FULL-TOPOLOGY
BF16 · NVIDIA A100-SXM4-40GB · native 512² · 1 shape-equivalent denoiser timestep
条件编码与分支组装
保留所有实际执行的文本与图像条件分支;输出 shape 与 merge 方式分别标注。
2. 条件编码与分支组装
保留所有实际执行的文本与图像条件分支;输出 shape 与 merge 方式分别标注。
SD15-INPAINT-FULL
CLIP-L
Layers ×12
hidden 768 · heads 12
[1, 77, 768]
Prompt condition
cross-attention / joint-attention context
[1, 77, 768]
Inpaint Condition
masked latent [1, 4, 64, 64]
mask [1, 1, 64, 64]
ACTUAL-CUDA-FULL-TOPOLOGY
BF16 · NVIDIA A100-SXM4-40GB · native 512² · 1 shape-equivalent denoiser timestep
完整 U-Net 多尺度拓扑
Down / Mid / Up 全部生产层均执行;橙色虚线表示 skip connection,shape 为 batch 1。
3. 完整 U-Net 多尺度拓扑
Down / Mid / Up 全部生产层均执行;橙色虚线表示 skip connection,shape 为 batch 1。
SD15-INPAINT-FULL
Down 0
ResNet×2
CrossAttn
320×64×64
Down 1
ResNet×2
CrossAttn
640×32×32
Down 2
ResNet×2
CrossAttn
1280×16×16
Down 3
ResNet×2
ResNet only
1280×8×8
Mid
ResNet
CrossAttn
1280×8×8
Up 0
ResNet×3
ResNet only
1280×8×8
Up 1
ResNet×3
CrossAttn
1280×16×16
Up 2
ResNet×3
CrossAttn
640×32×32
Up 3
ResNet×3
CrossAttn
320×64×64
skip 0: 320×64²
skip 1: 640×32²
skip 2: 1280×16²
skip 3: 1280×8²
input [1, 9, 64, 64]
output [1, 4, 64, 64]
Conv_in 9→320 · Conv_out 320→4 · layers_per_block=2
ACTUAL-CUDA-FULL-TOPOLOGY
BF16 · NVIDIA A100-SXM4-40GB · native 512² · 1 shape-equivalent denoiser timestep
核心算子与任务差异
ResNet、时间步注入、空间自注意力与文本交叉注意力;分支差异单独说明。
4. 核心算子与任务差异
ResNet、时间步注入、空间自注意力与文本交叉注意力;分支差异单独说明。
SD15-INPAINT-FULL
ResnetBlock2D
GroupNorm + SiLU + Conv
Add time embedding
GroupNorm + Dropout + Conv
Residual / shortcut add
Transformer2DModel
Norm → Self Attention
Q=K=V=image tokens
Norm → Cross Attention
K=V=context [1, 77, 768]
Norm → GEGLU / MLP
residual after every sublayer
首层 Conv_in 接收 [1, 9, 64, 64],之后进入相同完整 U-Net 主干。
ACTUAL-CUDA-FULL-TOPOLOGY
BF16 · NVIDIA A100-SXM4-40GB · native 512² · 1 shape-equivalent denoiser timestep
VAE 边界与运行证据
VAE 仅把运行中真实执行的 Encode/Decode 标为 ACTUAL-CUDA;中间通道阶梯来自固定配置。
5. VAE 边界与运行证据
VAE 仅把运行中真实执行的 Encode/Decode 标为 ACTUAL-CUDA;中间通道阶梯来自固定配置。
SD15-INPAINT-FULL
Source / reference image
VAE Encode 已执行
[1, 3, 512, 512]
VAE Encoder
Down blocks ×4
[1, 4, 64, 64]
Denoised latent
actual denoiser output
[1, 4, 64, 64]
VAE Decoder
MidBlock + UpDecoder ×4
spatial upsample ×8
[1, 3, 512, 512]
Pixel output
native 512²
[1, 3, 512, 512]
STATIC-CONFIG 通道阶梯:512 → 512 → 256 → 128;latent_channels=4
Trace evidence
实例化参数合计
1.066B
峰值 CUDA allocated
1.86 GiB
行级 shape
4,466 rows / 35,708 hits
模块级 shape
1,029 rows / 1,057 hits
运行边界
native 512² · batch 1
随机初始化 BF16
结构/shape 学习证据;不代表生成质量
ACTUAL-CUDA-FULL-TOPOLOGY
BF16 · NVIDIA A100-SXM4-40GB · native 512² · 1 shape-equivalent denoiser timestep