◀ 上一页
1 / 5
下一页 ▶
Stable Diffusion 2.1 Base 宏观架构
从条件编码、完整 denoiser 到 VAE 解码;关键 shape 均取自 SD21-BASE-FULL 的实测记录。
1. Stable Diffusion 2.1 Base 宏观架构
从条件编码、完整 denoiser 到 VAE 解码;关键 shape 均取自 SD21-BASE-FULL 的实测记录。
SD21-BASE-FULL
Prompt
token IDs
OpenCLIP ViT-H
完整文本编码器
[1, 77, 1024]
Noisy latent / tokens
batch = 1
[1, 4, 96, 96]
Timestep / Guidance
shape 等价 denoiser step
[1]
UNet2DConditionModel
Text-to-Image Base
完整生产层数,未折叠
[1, 4, 96, 96]
VAE Decoder
latent → pixels
[1, 3, 768, 768]
Final image
[1, 3, 768, 768]
ACTUAL-CUDA-FULL-TOPOLOGY
BF16 · NVIDIA A100-SXM4-40GB · native 768² · 1 shape-equivalent denoiser timestep
条件编码与分支组装
保留所有实际执行的文本与图像条件分支;输出 shape 与 merge 方式分别标注。
2. 条件编码与分支组装
保留所有实际执行的文本与图像条件分支;输出 shape 与 merge 方式分别标注。
SD21-BASE-FULL
OpenCLIP ViT-H
Layers ×23
hidden 1024 · heads 16
[1, 77, 1024]
Prompt condition
cross-attention / joint-attention context
[1, 77, 1024]
ACTUAL-CUDA-FULL-TOPOLOGY
BF16 · NVIDIA A100-SXM4-40GB · native 768² · 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。
SD21-BASE-FULL
Down 0
ResNet×2
CrossAttn
320×96×96
Down 1
ResNet×2
CrossAttn
640×48×48
Down 2
ResNet×2
CrossAttn
1280×24×24
Down 3
ResNet×2
ResNet only
1280×12×12
Mid
ResNet
CrossAttn
1280×12×12
Up 0
ResNet×3
ResNet only
1280×12×12
Up 1
ResNet×3
CrossAttn
1280×24×24
Up 2
ResNet×3
CrossAttn
640×48×48
Up 3
ResNet×3
CrossAttn
320×96×96
skip 0: 320×96²
skip 1: 640×48²
skip 2: 1280×24²
skip 3: 1280×12²
input [1, 4, 96, 96]
output [1, 4, 96, 96]
Conv_in 4→320 · Conv_out 320→4 · layers_per_block=2
ACTUAL-CUDA-FULL-TOPOLOGY
BF16 · NVIDIA A100-SXM4-40GB · native 768² · 1 shape-equivalent denoiser timestep
核心算子与任务差异
ResNet、时间步注入、空间自注意力与文本交叉注意力;分支差异单独说明。
4. 核心算子与任务差异
ResNet、时间步注入、空间自注意力与文本交叉注意力;分支差异单独说明。
SD21-BASE-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, 1024]
Norm → GEGLU / MLP
residual after every sublayer
主干输入输出 shape 不变;空间注意力把 H×W 展平为 token 序列。
ACTUAL-CUDA-FULL-TOPOLOGY
BF16 · NVIDIA A100-SXM4-40GB · native 768² · 1 shape-equivalent denoiser timestep
VAE 边界与运行证据
VAE 仅把运行中真实执行的 Encode/Decode 标为 ACTUAL-CUDA;中间通道阶梯来自固定配置。
5. VAE 边界与运行证据
VAE 仅把运行中真实执行的 Encode/Decode 标为 ACTUAL-CUDA;中间通道阶梯来自固定配置。
SD21-BASE-FULL
Denoised latent
actual denoiser output
[1, 4, 96, 96]
VAE Decoder
MidBlock + UpDecoder ×4
spatial upsample ×8
[1, 3, 768, 768]
Pixel output
native 768²
[1, 3, 768, 768]
STATIC-CONFIG 通道阶梯:512 → 512 → 256 → 128;latent_channels=4
Trace evidence
实例化参数合计
1.290B
峰值 CUDA allocated
1.78 GiB
行级 shape
4,088 rows / 36,925 hits
模块级 shape
1,063 rows / 1,083 hits
运行边界
native 768² · batch 1
随机初始化 BF16
结构/shape 学习证据;不代表生成质量
ACTUAL-CUDA-FULL-TOPOLOGY
BF16 · NVIDIA A100-SXM4-40GB · native 768² · 1 shape-equivalent denoiser timestep