/ Модель

Характеристики

Лицензия
Своя лицензия
Библиотека
pytorch
Опубликована
6 авг 2026

mini-diffusion

Генерация изображенийТекст → изображение

Компактная диффузионная модель создаёт фронтальные портреты 64×64 безусловно или по шести атрибутам CelebA.

0скачиваний за 30 дней0лайковвеса обновлены6 авг 2026

Бенчмарки

Как модель справилась с задачами пользователей ailist и что о ней публикуют открытые лидерборды

Публичные оценки

Из открытых лидербордов. Сравнивайте результаты одного теста при одинаковых условиях — отсутствие оценки не значит, что модель хуже.

В подключённых источниках результатов для этой модели пока нет.

Что умеет модель

Описание составлено по карточке модели и метаданным Hugging Face

vous99 разработал mini-diffusion — компактную диффузионную модель на 18,5 млн параметров, обученную с нуля на CelebA. Это U-Net на PyTorch с четырьмя разрешениями, блоками остаточной связи и self-attention; модель создаёт изображения лиц размером 64×64 без текстового запроса и поддерживает условную генерацию по шести атрибутам CelebA: полу, улыбке, возрастной группе, очкам, светлым волосам и чёлке. Один набор весов работает в условном и безусловном режимах благодаря classifier-free guidance.

Для генерации доступны DDPM, DDIM, Karras sigma schedule с методом Heun, а также DDIM inversion для интерполяции между фотографиями. Модель обучалась на ноутбуке Apple с MPS за одну ночь; README приводит FID-tv 30,12, измеренный на 10 000 образцах. Эта метрика использует веса torchvision Inception-v3 и напрямую несопоставима с опубликованными значениями FID. Модель рассчитана на выровненные фронтальные портреты CelebA; она не принимает текстовые промпты, работает только в 64×64 и заметная доля образцов может оказаться шумом. Лицензия в метаданных указана как other, без уточнения условий.

Сценарии применения

  • генерация фронтальных портретов 64×64
  • создание портретов с заданной улыбкой или очками
  • генерация лиц со светлыми волосами или чёлкой
  • сравнение DDPM и DDIM на наборе CelebA
  • интерполяция между фотографиями лиц

Ограничения

Модель ограничена выровненными фронтальными портретами 64×64 и шестью бинарными атрибутами, без текстового управления; профили, группы людей и тела вне распределения обучения. По README, примерно 15–20% образцов схлопываются в шум, а FID-tv нельзя напрямую сравнивать с опубликованными значениями FID.

Карточка модели

README от автора на Hugging Face, как он его опубликовал

Открыть на Hugging Face

mini-diffusion — an 18.5M-parameter DDPM trained overnight on a laptop

A denoising diffusion model written from scratch in plain PyTorch. The U-Net, the noise schedule, four samplers and the training loop are all in the repository — diffusers is never imported.

Code: https://github.com/vous99/mini-diffusion

Trained on one MacBook Pro (M5 Pro, 24 GB, MPS) in a single overnight run. Every number below was measured on that run, not quoted from a paper.

Results

MetricValue
FID-tv30.12 (10,000 samples, DDIM-50, EMA weights)
Steps22,098
Images seen2.83M (17.4 epochs of CelebA train)
Best val loss0.0352 (L_simple, MSE on epsilon)
Training time~9 hours of compute at 87 images/s
Parameters18,538,371

FID over training: 73.35 (step 2,500) → 50.58 → 43.10 → 39.37 → 37.69 → 35.57 → 34.67 → 35.17 (step 20,000). Most of the gain lands in the first third of the run; the curve flattens after roughly step 15,000.

FID-tv is not the FID of the literature. It uses torchvision's Inception-v3 weights rather than the TensorFlow-ported weights every published FID is built on. The numbers here are internally consistent — valid for comparing checkpoints, samplers and guidance scales — but not directly comparable to a paper's "FID 3.5".

What the model does

  • Unconditional face generation at 64×64.
  • Conditional generation on six CelebA attributes: Male, Smiling, Young, Eyeglasses, Blond_Hair, Bangs.
  • Classifier-free guidance from the same weights — trained with 15% condition dropout against a learned null embedding, so one checkpoint serves both the conditional and unconditional branch.
  • Deterministic DDIM with an eta parameter that reproduces ancestral DDPM exactly at eta=1.
  • Karras sigma schedule with Heun's method.
  • DDIM inversion, and therefore spherical interpolation between two real photographs.

Usage

git clone https://github.com/vous99/mini-diffusion && cd mini-diffusion
pip install -r requirements.txt

python -c "
from huggingface_hub import hf_hub_download
import shutil, os
os.makedirs('ckpt', exist_ok=True)
shutil.copy(hf_hub_download('vous99/mini-diffusion', 'best.pt'), 'ckpt/best.pt')
"

python sample.py                                   # an 8x8 grid
python sample.py --attrs "Male=1,Eyeglasses=1"     # conditional
python sample.py --guidance-sweep                  # the guidance-scale figure
python sample.py --sampler-comparison              # DDPM / DDIM / Heun

Sampling needs no dataset. Retraining does — prepare_data.py rebuilds it from the HuggingFace CelebA shards.

Architecture

U-Net over four resolutions, base_ch=64, channel_mults=(1,2,2,4) → 64@64² 128@32² 128@16² 256@8². Two ResBlocks per level down, three up, self-attention at 16² and 8² and in the middle block, head_dim=32, GroupNorm with 32 groups.

Conditioning is a Linear(6, 256) projection added to the sinusoidal timestep embedding, plus a learned null vector. Stable Diffusion instead cross-attends to a sequence of text tokens; six fixed flags are not a sequence, so addition is the honest analogue — the same mechanism, a simpler carrier.

The output convolution is zero-initialised, so the loss at step 0 is exactly E||eps||² = 1.0000. That single number confirms the target is epsilon, the data is scaled to [-1,1], and the reduction is a mean.

Training details

Schedulecosine (Nichol & Dhariwal), T=1000
Prediction targetepsilon
Timestep samplingstratified over the batch, not i.i.d. uniform
OptimizerAdamW, lr 2e-4, betas (0.9, 0.999), weight decay 0, grad clip 1.0
LR schedulelinear warmup 500 steps → cosine decay to 2e-5
Batch64 × 2 gradient accumulation = 128 effective
EMA0.999 with warmup
Dropout0.0
Augmentationhorizontal flip, p=0.5
Precisionbfloat16 autocast (GroupNorm stays fp32)

Limitations

  • 64×64 only. Faces at higher resolution are out of scope for this budget.
  • No text conditioning. The condition is six binary flags, not a prompt.
  • Aligned frontal portraits only. CelebA is centred faces; profiles, multiple people and full bodies are out of distribution.
  • Roughly 15–20% of samples collapse into noise. This is the dominant remaining defect.
  • Colour casts. Even the cosine schedule ends at abar_T ≈ 2.4e-9 rather than 0, so the model never trains on pure noise but is handed pure noise at sampling time. With epsilon-prediction this shows up as a per-image brightness and colour bias. It receded substantially over training but has not disappeared; v-prediction with zero terminal SNR is the proper fix.
  • This is 4.4% of the compute budget of the DDIM paper's CelebA-64 run. The register is a good 2016 GAN, not "indistinguishable from a photograph".

Licence and intended use

The weights inherit the CelebA licence: non-commercial research use only. This is a study artifact for understanding how diffusion models work, not a product component.

It generates synthetic faces of people who do not exist. Do not use it to impersonate real people or to produce material presented as a genuine photograph of anyone.

Checkpoint contents

best.pt is a torch.save dict with model (raw weights), ema (averaged weights — what you should sample from), cfg (the UNetConfig), diffusion (the DiffusionConfig), attributes (the six conditioning names, in order), iter and val_loss. Load it with checkpoint.py from the GitHub repository.

Как запустить

На своей GPU в ailist. Цена — по текущим предложениям провайдеров

GPU в ailist

Универсальный рантайм · pytorch

Нельзя запустить

Безусловная генерация изображений пока не поддерживается.

Ревизия весов
fdeb032

0 моделей