{ "

Denoising Diffusion Probabilistic Models (DDPM) training

\n

_^_0_^_

\n

This trains a DDPM based model on CelebA HQ dataset. You can find the download instruction in this discussion on fast.ai. Save the images inside _^_1_^_ folder.

\n

The paper had used a exponential moving average of the model with a decay of _^_2_^_. We have skipped this for simplicity.

\n": "

\u30ce\u30a4\u30ba\u9664\u53bb\u62e1\u6563\u78ba\u7387\u30e2\u30c7\u30eb (DDPM) \u30c8\u30ec\u30fc\u30cb\u30f3\u30b0

\n

_^_0_^_

\n

\u3053\u308c\u306b\u3088\u308a\u3001CeleBA HQ \u30c7\u30fc\u30bf\u30bb\u30c3\u30c8\u3067 DDPM \u30d9\u30fc\u30b9\u306e\u30e2\u30c7\u30eb\u304c\u30c8\u30ec\u30fc\u30cb\u30f3\u30b0\u3055\u308c\u307e\u3059\u3002\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u306e\u8aac\u660e\u306f\u3001fast.ai \u306e\u3053\u306e\u30c7\u30a3\u30b9\u30ab\u30c3\u30b7\u30e7\u30f3\u306b\u3042\u308a\u307e\u3059\u3002_^_1_^_\u753b\u50cf\u3092\u30d5\u30a9\u30eb\u30c0\u30fc\u306b\u4fdd\u5b58\u3057\u307e\u3059\u3002

\n

\u3053\u306e\u8ad6\u6587\u3067\u306f\u3001\u30e2\u30c7\u30eb\u306e\u6307\u6570\u79fb\u52d5\u5e73\u5747\u3092\u6e1b\u8870\u3055\u305b\u3066\u4f7f\u7528\u3057\u3066\u3044\u307e\u3057\u305f\u3002_^_2_^_\u7c21\u7565\u5316\u306e\u305f\u3081\u3001\u3053\u3053\u3067\u306f\u7701\u7565\u3057\u3066\u3044\u307e\u3059

\u3002\n", "

Configurations

\n": "

\u30b3\u30f3\u30d5\u30a3\u30ae\u30e5\u30ec\u30fc\u30b7\u30e7\u30f3

\n", "

CelebA HQ dataset

\n": "

CeleBA \u672c\u793e\u30c7\u30fc\u30bf\u30bb\u30c3\u30c8

\n", "

MNIST dataset

\n": "

MNIST \u30c7\u30fc\u30bf\u30bb\u30c3\u30c8

\n", "

Sample images

\n": "

\u30b5\u30f3\u30d7\u30eb\u753b\u50cf

\n", "

Train

\n": "

\u5217\u8eca

\n", "

Training loop

\n": "

\u30c8\u30ec\u30fc\u30cb\u30f3\u30b0\u30eb\u30fc\u30d7

\n", "

\n": "

\n", "

Create CelebA dataset

\n": "

CeleBA \u30c7\u30fc\u30bf\u30bb\u30c3\u30c8\u306e\u4f5c\u6210

\n", "

Create MNIST dataset

\n": "

MNIST \u30c7\u30fc\u30bf\u30bb\u30c3\u30c8\u306e\u4f5c\u6210

\n", "

Get an image

\n": "

\u753b\u50cf\u3092\u53d6\u5f97

\n", "

Size of the dataset

\n": "

\u30c7\u30fc\u30bf\u30bb\u30c3\u30c8\u306e\u30b5\u30a4\u30ba

\n", "

DDPM algorithm

\n": "

DDPM \u30a2\u30eb\u30b4\u30ea\u30ba\u30e0

\n", "

_^_0_^_

\n": "

_^_0_^_

\n", "

Adam optimizer

\n": "

\u30a2\u30c0\u30e0\u30fb\u30aa\u30d7\u30c6\u30a3\u30de\u30a4\u30b6\u30fc

\n", "

Batch size

\n": "

\u30d0\u30c3\u30c1\u30b5\u30a4\u30ba

\n", "

Calculate loss

\n": "

\u640d\u5931\u306e\u8a08\u7b97

\n", "

CelebA images folder

\n": "

\u30bb\u30ec\u30d0\u753b\u50cf\u30d5\u30a9\u30eb\u30c0\u30fc

\n", "

Compute gradients

\n": "

\u52fe\u914d\u306e\u8a08\u7b97

\n", "

Create DDPM class

\n": "

DDPM \u30af\u30e9\u30b9\u306e\u4f5c\u6210

\n", "

Create _^_0_^_ model

\n": "

_^_0_^_\u30e2\u30c7\u30eb\u4f5c\u6210

\n", "

Create configurations

\n": "

\u69cb\u6210\u306e\u4f5c\u6210

\n", "

Create dataloader

\n": "

\u30c7\u30fc\u30bf\u30ed\u30fc\u30c0\u30fc\u306e\u4f5c\u6210

\n", "

Create experiment

\n": "

\u5b9f\u9a13\u3092\u4f5c\u6210

\n", "

Create optimizer

\n": "

\u30aa\u30d7\u30c6\u30a3\u30de\u30a4\u30b6\u30fc\u3092\u4f5c\u6210

\n", "

Dataloader

\n": "

\u30c7\u30fc\u30bf\u30ed\u30fc\u30c0\u30fc

\n", "

Dataset

\n": "

\u30c7\u30fc\u30bf\u30bb\u30c3\u30c8

\n", "

Device to train the model on. _^_0_^_ picks up an available CUDA device or defaults to CPU.

\n": "

\u30e2\u30c7\u30eb\u3092\u30c8\u30ec\u30fc\u30cb\u30f3\u30b0\u3059\u308b\u30c7\u30d0\u30a4\u30b9\u3002_^_0_^_\u4f7f\u7528\u53ef\u80fd\u306a CUDA \u30c7\u30d0\u30a4\u30b9\u3092\u9078\u629e\u3059\u308b\u304b\u3001\u30c7\u30d5\u30a9\u30eb\u30c8\u3067 CPU \u306b\u8a2d\u5b9a\u3057\u307e\u3059

\u3002\n", "

Image logging

\n": "

\u753b\u50cf\u30ed\u30ae\u30f3\u30b0

\n", "

Image size

\n": "

\u753b\u50cf\u30b5\u30a4\u30ba

\n", "

Increment global step

\n": "

\u30b0\u30ed\u30fc\u30d0\u30eb\u30b9\u30c6\u30c3\u30d7\u3092\u30a4\u30f3\u30af\u30ea\u30e1\u30f3\u30c8

\n", "

Initialize

\n": "

[\u521d\u671f\u5316]

\n", "

Iterate through the dataset

\n": "

\u30c7\u30fc\u30bf\u30bb\u30c3\u30c8\u306e\u53cd\u5fa9\u51e6\u7406

\n", "

Learning rate

\n": "

\u5b66\u7fd2\u7387

\n", "

List of files

\n": "

\u30d5\u30a1\u30a4\u30eb\u30ea\u30b9\u30c8

\n", "

Log samples

\n": "

\u30ed\u30b0\u30b5\u30f3\u30d7\u30eb

\n", "

Make the gradients zero

\n": "

\u30b0\u30e9\u30c7\u30fc\u30b7\u30e7\u30f3\u3092\u30bc\u30ed\u306b\u3059\u308b

\n", "

Move data to device

\n": "

\u30c7\u30fc\u30bf\u3092\u30c7\u30d0\u30a4\u30b9\u306b\u79fb\u52d5

\n", "

New line in the console

\n": "

\u30b3\u30f3\u30bd\u30fc\u30eb\u306e\u65b0\u3057\u3044\u884c

\n", "

Number of channels in the image. _^_0_^_ for RGB.

\n": "

\u753b\u50cf\u5185\u306e\u30c1\u30e3\u30f3\u30cd\u30eb\u6570\u3002_^_0_^_RGB \u7528\u3067\u3059\u3002

\n", "

Number of channels in the initial feature map

\n": "

\u521d\u671f\u6a5f\u80fd\u30de\u30c3\u30d7\u306e\u30c1\u30e3\u30f3\u30cd\u30eb\u6570

\n", "

Number of samples to generate

\n": "

\u751f\u6210\u3059\u308b\u30b5\u30f3\u30d7\u30eb\u306e\u6570

\n", "

Number of time steps _^_0_^_

\n": "

\u30bf\u30a4\u30e0\u30b9\u30c6\u30c3\u30d7\u6570 _^_0_^_

\n", "

Number of training epochs

\n": "

\u30c8\u30ec\u30fc\u30cb\u30f3\u30b0\u30a8\u30dd\u30c3\u30af\u306e\u6570

\n", "

Remove noise for _^_0_^_ steps

\n": "

_^_0_^_\u30b9\u30c6\u30c3\u30d7\u306e\u30ce\u30a4\u30ba\u9664\u53bb

\n", "

Sample from _^_0_^_

\n": "

\u304b\u3089\u306e\u30b5\u30f3\u30d7\u30eb _^_0_^_

\n", "

Sample some images

\n": "

\u3044\u304f\u3064\u304b\u306e\u753b\u50cf\u306e\u30b5\u30f3\u30d7\u30eb

\n", "

Save the model

\n": "

\u30e2\u30c7\u30eb\u3092\u4fdd\u5b58\u3059\u308b

\n", "

Set configurations. You can override the defaults by passing the values in the dictionary.

\n": "

\u69cb\u6210\u3092\u8a2d\u5b9a\u3057\u307e\u3059\u3002\u30c7\u30a3\u30af\u30b7\u30e7\u30ca\u30ea\u306b\u5024\u3092\u6e21\u3059\u3053\u3068\u3067\u30c7\u30d5\u30a9\u30eb\u30c8\u3092\u30aa\u30fc\u30d0\u30fc\u30e9\u30a4\u30c9\u3067\u304d\u307e\u3059\u3002

\n", "

Set models for saving and loading

\n": "

\u4fdd\u5b58\u304a\u3088\u3073\u8aad\u307f\u8fbc\u307f\u7528\u306e\u30e2\u30c7\u30eb\u3092\u8a2d\u5b9a\u3059\u308b

\n", "

Start and run the training loop

\n": "

\u30c8\u30ec\u30fc\u30cb\u30f3\u30b0\u30eb\u30fc\u30d7\u3092\u958b\u59cb\u3057\u3066\u5b9f\u884c\u3059\u308b

\n", "

Take an optimization step

\n": "

\u6700\u9069\u5316\u306e\u4e00\u6b69\u3092\u8e0f\u307f\u51fa\u3059

\n", "

The list of booleans that indicate whether to use attention at each resolution

\n": "

\u5404\u89e3\u50cf\u5ea6\u3067\u6ce8\u610f\u3092\u5411\u3051\u308b\u304b\u3069\u3046\u304b\u3092\u793a\u3059\u30d6\u30fc\u30ea\u30a2\u30f3\u306e\u30ea\u30b9\u30c8

\n", "

The list of channel numbers at each resolution. The number of channels is _^_0_^_

\n": "

\u5404\u89e3\u50cf\u5ea6\u306e\u30c1\u30e3\u30f3\u30cd\u30eb\u756a\u53f7\u306e\u30ea\u30b9\u30c8\u3002\u30c1\u30e3\u30f3\u30cd\u30eb\u6570\u306f _^_0_^_

\n", "

Track the loss

\n": "

\u640d\u5931\u3092\u30c8\u30e9\u30c3\u30ad\u30f3\u30b0

\n", "

Train the model

\n": "

\u30e2\u30c7\u30eb\u306e\u30c8\u30ec\u30fc\u30cb\u30f3\u30b0

\n", "

Transformations to resize the image and convert to tensor

\n": "

\u753b\u50cf\u306e\u30b5\u30a4\u30ba\u3092\u5909\u66f4\u3057\u3066\u30c6\u30f3\u30bd\u30eb\u306b\u5909\u63db\u3059\u308b\u5909\u63db

\n", "

U-Net model for _^_0_^_

\n": "

\u7528\u306e U-Net \u30e2\u30c7\u30eb _^_0_^_

\n", "Denoising Diffusion Probabilistic Models (DDPM) training": "\u30ce\u30a4\u30ba\u9664\u53bb\u62e1\u6563\u78ba\u7387\u30e2\u30c7\u30eb (DDPM) \u30c8\u30ec\u30fc\u30cb\u30f3\u30b0", "Training code for Denoising Diffusion Probabilistic Model.": "\u30ce\u30a4\u30ba\u9664\u53bb\u62e1\u6563\u78ba\u7387\u30e2\u30c7\u30eb\u306e\u30c8\u30ec\u30fc\u30cb\u30f3\u30b0\u30b3\u30fc\u30c9" }