{ "

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": "

\u964d\u566a\u6269\u6563\u6982\u7387\u6a21\u578b (DDPM) \u8bad\u7ec3

\n

_^_0_^_

\n

\u8fd9\u5c06\u57fa\u4e8e CeleBA HQ \u6570\u636e\u96c6\u8bad\u7ec3\u57fa\u4e8e DDPM \u7684\u6a21\u578b\u3002\u4f60\u53ef\u4ee5\u5728 fast.ai \u7684\u8ba8\u8bba\u4e2d\u627e\u5230\u4e0b\u8f7d\u8bf4\u660e\u3002\u5c06\u56fe\u50cf\u4fdd\u5b58\u5728_^_1_^_\u6587\u4ef6\u5939\u4e2d\u3002

\n

\u8be5\u8bba\u6587\u4f7f\u7528\u4e86\u8be5\u6a21\u578b\u7684\u6307\u6570\u79fb\u52a8\u5e73\u5747\u7ebf\uff0c\u5176\u8870\u51cf\u91cf\u4e3a_^_2_^_\u3002\u4e3a\u7b80\u5355\u8d77\u89c1\uff0c\u6211\u4eec\u8df3\u8fc7\u4e86\u8fd9\u4e2a\u3002

\n", "

Configurations

\n": "

\u914d\u7f6e

\n", "

CelebA HQ dataset

\n": "

CeleBA HQ \u6570\u636e\u96c6

\n", "

MNIST dataset

\n": "

MNIST \u6570\u636e\u96c6

\n", "

Sample images

\n": "

\u6837\u672c\u56fe\u7247

\n", "

Train

\n": "

\u706b\u8f66

\n", "

Training loop

\n": "

\u8bad\u7ec3\u5faa\u73af

\n", "

\n": "

\n", "

Create CelebA dataset

\n": "

\u521b\u5efa CeleBA \u6570\u636e\u96c6

\n", "

Create MNIST dataset

\n": "

\u521b\u5efa MNIST \u6570\u636e\u96c6

\n", "

Get an image

\n": "

\u83b7\u53d6\u4e00\u5f20\u56fe\u7247

\n", "

Size of the dataset

\n": "

\u6570\u636e\u96c6\u7684\u5927\u5c0f

\n", "

DDPM algorithm

\n": "

DDPM \u7b97\u6cd5

\n", "

_^_0_^_

\n": "

_^_0_^_

\n", "

Adam optimizer

\n": "

Adam \u4f18\u5316\u5668

\n", "

Batch size

\n": "

\u6279\u91cf\u5927\u5c0f

\n", "

Calculate loss

\n": "

\u8ba1\u7b97\u635f\u5931

\n", "

CelebA images folder

\n": "

CeleBA \u56fe\u7247\u6587\u4ef6\u5939

\n", "

Compute gradients

\n": "

\u8ba1\u7b97\u68af\u5ea6

\n", "

Create DDPM class

\n": "

\u521b\u5efa DDPM \u7c7b

\n", "

Create _^_0_^_ model

\n": "

\u521b\u5efa_^_0_^_\u6a21\u578b

\n", "

Create configurations

\n": "

\u521b\u5efa\u914d\u7f6e

\n", "

Create dataloader

\n": "

\u521b\u5efa\u6570\u636e\u52a0\u8f7d\u5668

\n", "

Create experiment

\n": "

\u521b\u5efa\u5b9e\u9a8c

\n", "

Create optimizer

\n": "

\u521b\u5efa\u4f18\u5316\u5668

\n", "

Dataloader

\n": "

\u6570\u636e\u52a0\u8f7d\u5668

\n", "

Dataset

\n": "

\u6570\u636e\u96c6

\n", "

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

\n": "

\u7528\u4e8e\u8bad\u7ec3\u6a21\u578b\u7684\u8bbe\u5907\u3002_^_0_^_\u9009\u62e9\u53ef\u7528\u7684 CUDA \u8bbe\u5907\u6216\u9ed8\u8ba4\u4e3a CPU\u3002

\n", "

Image logging

\n": "

\u56fe\u50cf\u65e5\u5fd7\u8bb0\u5f55

\n", "

Image size

\n": "

\u56fe\u50cf\u5927\u5c0f

\n", "

Increment global step

\n": "

\u9012\u589e\u5168\u5c40\u6b65\u957f

\n", "

Initialize

\n": "

\u521d\u59cb\u5316

\n", "

Iterate through the dataset

\n": "

\u904d\u5386\u6570\u636e\u96c6

\n", "

Learning rate

\n": "

\u5b66\u4e60\u7387

\n", "

List of files

\n": "

\u6587\u4ef6\u6e05\u5355

\n", "

Log samples

\n": "

\u65e5\u5fd7\u6837\u672c

\n", "

Make the gradients zero

\n": "

\u5c06\u6e10\u53d8\u8bbe\u4e3a\u96f6

\n", "

Move data to device

\n": "

\u5c06\u6570\u636e\u79fb\u52a8\u5230\u8bbe\u5907

\n", "

New line in the console

\n": "

\u63a7\u5236\u53f0\u4e2d\u7684\u65b0\u884c

\n", "

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

\n": "

\u56fe\u50cf\u4e2d\u7684\u901a\u9053\u6570\u3002_^_0_^_\u5bf9\u4e8e RGB\u3002

\n", "

Number of channels in the initial feature map

\n": "

\u521d\u59cb\u7279\u5f81\u56fe\u4e2d\u7684\u9891\u9053\u6570\u91cf

\n", "

Number of samples to generate

\n": "

\u8981\u751f\u6210\u7684\u6837\u672c\u6570

\n", "

Number of time steps _^_0_^_

\n": "

\u65f6\u95f4\u6b65\u6570_^_0_^_

\n", "

Number of training epochs

\n": "

\u8bad\u7ec3\u5468\u671f\u7684\u6570\u91cf

\n", "

Remove noise for _^_0_^_ steps

\n": "

\u6d88\u9664_^_0_^_\u53f0\u9636\u566a\u97f3

\n", "

Sample from _^_0_^_

\n": "

\u6837\u672c\u6765\u81ea_^_0_^_

\n", "

Sample some images

\n": "

\u5bf9\u4e00\u4e9b\u56fe\u50cf\u8fdb\u884c\u91c7\u6837

\n", "

Save the model

\n": "

\u4fdd\u5b58\u6a21\u578b

\n", "

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

\n": "

\u8bbe\u7f6e\u914d\u7f6e\u3002\u60a8\u53ef\u4ee5\u901a\u8fc7\u5728\u5b57\u5178\u4e2d\u4f20\u9012\u503c\u6765\u8986\u76d6\u9ed8\u8ba4\u503c\u3002

\n", "

Set models for saving and loading

\n": "

\u8bbe\u7f6e\u7528\u4e8e\u4fdd\u5b58\u548c\u52a0\u8f7d\u7684\u6a21\u578b

\n", "

Start and run the training loop

\n": "

\u542f\u52a8\u5e76\u8fd0\u884c\u8bad\u7ec3\u5faa\u73af

\n", "

Take an optimization step

\n": "

\u91c7\u53d6\u4f18\u5316\u6b65\u9aa4

\n", "

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

\n": "

\u6307\u793a\u662f\u5426\u5728\u6bcf\u4e2a\u5206\u8fa8\u7387\u4e0b\u4f7f\u7528\u6ce8\u610f\u529b\u7684\u5e03\u5c14\u503c\u5217\u8868

\n", "

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

\n": "

\u6bcf\u79cd\u5206\u8fa8\u7387\u4e0b\u7684\u901a\u9053\u7f16\u53f7\u5217\u8868\u3002\u9891\u9053\u7684\u6570\u91cf\u662f_^_0_^_

\n", "

Track the loss

\n": "

\u8ffd\u8e2a\u635f\u5931

\n", "

Train the model

\n": "

\u8bad\u7ec3\u6a21\u578b

\n", "

Transformations to resize the image and convert to tensor

\n": "

\u7528\u4e8e\u8c03\u6574\u56fe\u50cf\u5927\u5c0f\u5e76\u8f6c\u6362\u4e3a\u5f20\u91cf\u7684\u8f6c\u6362

\n", "

U-Net model for _^_0_^_

\n": "

U-Net \u6a21\u578b\u7528\u4e8e_^_0_^_

\n", "Denoising Diffusion Probabilistic Models (DDPM) training": "\u53bb\u566a\u6269\u6563\u6982\u7387\u6a21\u578b (DDPM) \u8bad\u7ec3", "Training code for Denoising Diffusion Probabilistic Model.": "\u964d\u566a\u6269\u6563\u6982\u7387\u6a21\u578b\u7684\u8bad\u7ec3\u4ee3\u7801\u3002" }