--- license: mit tags: - diffusion - ddpm - ddim - from-scratch - pytorch - unconditional-image-generation pipeline_tag: unconditional-image-generation --- # diffusion-from-scratch — trained checkpoints Weights for [github.com/adimunot21/diffusion-from-scratch](https://github.com/adimunot21/diffusion-from-scratch), a DDPM/DDIM implementation written from scratch in PyTorch — forward process, noise schedules, U-Net denoiser, samplers and classifier-free guidance, no diffusers dependency. Three models. Each folder has `config.json` plus two weight files: - **`ema.safetensors`** — exponential moving average of the weights (`ema_decay=0.9999`). **Use these for sampling.** - **`model.safetensors`** — the raw final training weights, kept for completeness. | Folder | Model | Params | Schedule | Epochs | Final train loss | FID | |---|---|---|---|---|---|---| | `mnist/` | MNIST, unconditional | 9.53 M | linear, T=1000 | 50 | 0.0210 | 34.1 | | `cifar10_uncond/` | CIFAR-10, unconditional | 46.03 M | cosine, T=1000 | 100 | 0.0547 | 71.2 | | `cifar10_cond/` | CIFAR-10, class-conditional | 46.03 M | cosine, T=1000 | 100 | 0.0557 | 65.3 | The CIFAR-10 U-Nets use channels `[128, 256, 256, 512]`, 2 residual blocks per level and 4-head self-attention at the two middle resolutions. The conditional model was trained with classifier-free guidance (`uncond_prob=0.1`, 10 classes). ## Loading These are plain `state_dict`s for the `UNet` class in the source repo — not a `diffusers` pipeline. Build the model from the repo, then load: ```python from huggingface_hub import hf_hub_download from safetensors.torch import load_file path = hf_hub_download("adimunot/diffusion-from-scratch", "cifar10_uncond/ema.safetensors") model.load_state_dict(load_file(path)) # model = UNet(**config) from the repo model.eval() ``` `config.json` carries the exact architecture and training hyperparameters each checkpoint was produced with, so it can be fed straight into the constructor. ## Notes - FID was computed during the project's evaluation phase; treat the numbers as self-reported and comparable only within this repo. - These are learning-project models trained on a single GPU, not competitive baselines. CIFAR-10 FID in the 65–71 range reflects the small model and 100-epoch budget.