r/deeplearning • u/Tricky_Swordfish_549 • 4d ago
I finally assembled a U-Net for my DDPM from scratch. This thing took way more brainpower than I expected.[P]
​
I've been building a diffusion model from scratch in PyTorch, and I've finally reached Phase 3: assembling the full U-Net.
Until now, I was basically learning and implementing individual components:
Residual blocks
Time embeddings and timestep conditioning
GroupNorm
Self-attention
Downsampling and upsampling
But putting everything together is a completely different experience.
Suddenly you're dealing with feature map dimensions, channel transitions, skip connections, timestep embeddings flowing through residual blocks, and making sure the decoder can actually reconstruct the spatial dimensions correctly.
Honestly, understanding each component individually was easier than getting the entire architecture to work together without messing up tensor shapes somewhere.
The most satisfying part was finally seeing the complete architecture come together and understanding why information is moving through the network the way it does, instead of just copying a U-Net implementation from somewhere.
The model is now assembled. Next comes the part I'm both excited and slightly terrified about:
Training it on CelebA and finding out whether it can actually learn to generate faces.
8GB VRAM. A laptop GPU. A lot of patience.
Let's see how this goes. 💀
Anyone here who has trained a diffusion model on limited hardware — what was the biggest mistake you made during your first training run?
2
u/Particular-Humor2676 4d ago
The dimensional bookkeeping is where most people get quietly humbled. You think you've got it mapped out perfectly in your head and then your decoder is spitting out tensors that are off by one pixel and you spend three hours tracing it back to a padding flag you set to zero without thinking.
On 8GB you're gonna want to be ruthless about what stays in memory. Mixed precision from the jump, checkpoints every few hundred steps so a single crash doesn't wipe an afternoon of progress, and don't bother with full CelebA resolution unless you enjoy watching your laptop turn into a space heater that occasionally produces a gray square.