README.md 1.53 KB
Newer Older
Anton Lozhkov's avatar
Anton Lozhkov committed
1
2
## Training examples

anton-l's avatar
anton-l committed
3
4
5
6
7
8
9
10
### Installing the dependencies

Before running the scipts, make sure to install the library's training dependencies:

```bash
pip install diffusers[training] accelerate datasets
```

anton-l's avatar
anton-l committed
11
### Unconditional Flowers  
Anton Lozhkov's avatar
Anton Lozhkov committed
12
13
14
15

The command to train a DDPM UNet model on the Oxford Flowers dataset:

```bash
16
accelerate launch train_unconditional.py \
Anton Lozhkov's avatar
Anton Lozhkov committed
17
18
  --dataset="huggan/flowers-102-categories" \
  --resolution=64 \
19
20
  --output_dir="ddpm-ema-flowers-64" \
  --train_batch_size=16 \
Anton Lozhkov's avatar
Anton Lozhkov committed
21
22
  --num_epochs=100 \
  --gradient_accumulation_steps=1 \
23
24
25
26
  --learning_rate=1e-4 \
  --lr_warmup_steps=500 \
  --mixed_precision=no \
  --push_to_hub
Anton Lozhkov's avatar
Anton Lozhkov committed
27
```
Anton Lozhkov's avatar
Anton Lozhkov committed
28
An example trained model: https://huggingface.co/anton-l/ddpm-ema-flowers-64
Anton Lozhkov's avatar
Anton Lozhkov committed
29

anton-l's avatar
anton-l committed
30
A full training run takes 2 hours on 4xV100 GPUs.
Anton Lozhkov's avatar
Anton Lozhkov committed
31

Anton Lozhkov's avatar
Anton Lozhkov committed
32
<img src="https://user-images.githubusercontent.com/26864830/180248660-a0b143d0-b89a-42c5-8656-2ebf6ece7e52.png" width="700" />
Anton Lozhkov's avatar
Anton Lozhkov committed
33
34


anton-l's avatar
anton-l committed
35
### Unconditional Pokemon 
Anton Lozhkov's avatar
Anton Lozhkov committed
36
37
38
39

The command to train a DDPM UNet model on the Pokemon dataset:

```bash
40
accelerate launch train_unconditional.py \
Anton Lozhkov's avatar
Anton Lozhkov committed
41
42
  --dataset="huggan/pokemon" \
  --resolution=64 \
43
44
  --output_dir="ddpm-ema-pokemon-64" \
  --train_batch_size=16 \
Anton Lozhkov's avatar
Anton Lozhkov committed
45
46
  --num_epochs=100 \
  --gradient_accumulation_steps=1 \
47
48
49
50
  --learning_rate=1e-4 \
  --lr_warmup_steps=500 \
  --mixed_precision=no \
  --push_to_hub
Anton Lozhkov's avatar
Anton Lozhkov committed
51
```
Anton Lozhkov's avatar
Anton Lozhkov committed
52
An example trained model: https://huggingface.co/anton-l/ddpm-ema-pokemon-64
Anton Lozhkov's avatar
Anton Lozhkov committed
53

anton-l's avatar
anton-l committed
54
A full training run takes 2 hours on 4xV100 GPUs.
Anton Lozhkov's avatar
Anton Lozhkov committed
55

Anton Lozhkov's avatar
Anton Lozhkov committed
56
<img src="https://user-images.githubusercontent.com/26864830/180248200-928953b4-db38-48db-b0c6-8b740fe6786f.png" width="700" />