Doggie Diffusion
Teaching a model to turn random noise into pictures of dogs on a budget graphics card (RTX 2080).

I wanted to see if I could train an image generator from scratch on my own graphics card. I picked one job for it: make a 64×64 picture of a dog. There’s no prompt to write. The model starts with random pixels and changes them a little at a time until a dog takes shape.
Press play to watch one dog take shape in 20 seconds, or generate a dog in your browser. Then I’ll walk through how I built the model and what I saw as it learned.
View the Doggie Diffusion source on GitHub
Generate a dog
The first run in this tab downloads about 64 MB of model weights plus the runtime. You can generate more dogs without downloading the weights again. The model runs on your GPU using WebGPU. Nothing is uploaded.
Why I chose a U-Net
I wanted to try a different kind of model. Transformers are common in newer image generators, but I was curious about a U-Net, a network that looks at an image at several sizes. I could build one small enough to work directly on the pixels.
How the U-Net works
The diagram shows where the U-Net gets its name. On the way down, the encoder turns a noisy 64×64 image into smaller and smaller grids of features until it reaches 8×8. A feature is a clue the network picks up from the pixels. Early layers might notice an edge around an ear, and deeper layers can piece together clues from farther apart.
The second half, the decoder, works back up to 64×64. By the time the encoder reaches 8×8, fine detail like the exact position of an edge is harder to recover, so the decoder also gets a copy of the features from the matching stage on the way down. Those are the dashed lines in the diagram. There are six of these shortcuts, two at each size before the 8×8 bottleneck.
At 16×16 and 8×8, I added attention. It lets one part of the grid look at other parts, so a clue near one ear can inform a prediction across the image. Attention compares positions in pairs. At 64×64 there would be 4,096 positions, so I kept it on the smaller grids.
During training I add a known amount of random noise to a dog photo and ask the U-Net to guess the noise I added. An image that looks like TV static needs a different prediction from one where you can already see a dog’s face, so I give every block the timestep, which tells it where the image sits on the noise schedule.
To generate a dog, I start with pure noise. The sampler uses the U-Net’s guess to estimate the clean image, takes a step toward it, then asks for another prediction. It does this 1,000 times.
Denoising a single image
Pick an earlier step to see how much noise was left on the way to each dog.
These are two 1,000-step denoising runs captured at training step 50,000. Both used seed 42, so they started with the same static and drew the same random noise along the way. Only the weights changed.
The top row uses the weights at training step 50,000. Weights are the numbers the model learns. The bottom row uses an exponential moving average (EMA), which smooths those numbers across training updates. With the same seed, the averaged model drew a dog on grass. The other drew a close-up.
Training progress
I resized 126,841 photos from the SDIP Dog dataset to 64×64 and trained in batches of 32. The first session got to about 48,500 batches. I picked up the next morning and stopped at 50,014.
The two sessions took about 3 hours 7 minutes according to the training log, including the time spent drawing previews. That leaves out the overnight break.
| Training setup | Size or measurement |
|---|---|
| Graphics card | RTX 2080 with 8 GB of video memory |
| Peak training memory | 2.35 GB of video memory reserved by PyTorch |
| Model parameters | 31.84 million |
| Model weights | 127 MB for one 32-bit copy |
| Training checkpoint | 510 MB, including the weights, their running average, and the optimizer state needed to resume |
| Prepared dataset | 1.09 GB |
For the memory figure I resumed the saved model for five training batches on the same card. It shows what PyTorch reserved during that check. The graphics driver and other apps use memory of their own.
Each image below shows the end of a 1,000-step denoising run. The seed stays at 42 while the model keeps training. Every 1,000 training batches, the terminal dashboard pauses to run the preview and saves the finished EMA image.
At 2,000 training steps there’s already a face, though the eyes are hard to make out. By 5,000 the close-up is gone. There’s grass behind the dog and you can see its legs.
- 1,000 steps

- 2,000 steps

- 5,000 steps

- 15,000 steps

- 30,000 steps

- 50,000 steps

Generation Examples
For the gallery I loaded the saved EMA weights at step 50,014 and drew 100 dogs. Each seed gives the sampler a different starting pattern of noise and its own sequence of random draws. Some dogs look straight at the camera. A few are hard to make out at all.
On my RTX 2080, eight images generated one at a time took about 7.6 seconds per image. This gallery took 6 minutes 14 seconds in batches of ten, about 3.7 seconds per image. Both timings include loading the checkpoint and writing the images to disk.