summaryrefslogtreecommitdiff
path: root/training/conf/experiment/vqgan.yaml
blob: 572c3203a009c09d7d5be71b933147622b1ec066 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# @package _global_

defaults:
  - override /network: vqvae
  - override /criterion: null
  - override /model: lit_vqgan
  - override /callbacks: wandb_vae
  - override /optimizers: null
  - override /lr_schedulers: null

criterion:
  _target_: text_recognizer.criterions.vqgan_loss.VQGANLoss
  reconstruction_loss:
    _target_: torch.nn.BCEWithLogitsLoss
    reduction: mean
  discriminator:
    _target_: text_recognizer.criterions.n_layer_discriminator.NLayerDiscriminator
    in_channels: 1
    num_channels: 64
    num_layers: 3
  commitment_weight: 0.25
  discriminator_weight: 0.8
  discriminator_factor: 1.0
  discriminator_iter_start: 8.0e4

datamodule:
  batch_size: 12
  # resize: [288, 320]
  augment: false

lr_schedulers:
  generator:
    _target_: torch.optim.lr_scheduler.OneCycleLR
    max_lr: 3.0e-4
    total_steps: null
    epochs: 64
    steps_per_epoch: 1685
    pct_start: 0.3
    anneal_strategy: cos
    cycle_momentum: true
    base_momentum: 0.85
    max_momentum: 0.95
    div_factor: 25.0
    final_div_factor: 10000.0
    three_phase: true
    last_epoch: -1
    verbose: false
    interval: step
    monitor: val/loss
 
#   discriminator:
#     _target_: torch.optim.lr_scheduler.CosineAnnealingLR
#     T_max: 64
#     eta_min: 0.0
#     last_epoch: -1
# 
#     interval: epoch
#     monitor: val/loss

optimizers:
  generator:
    _target_: madgrad.MADGRAD
    lr: 1.0e-4
    momentum: 0.5
    weight_decay: 0
    eps: 1.0e-7

    parameters: network

  discriminator:
    _target_: madgrad.MADGRAD
    lr: 4.5e-6
    momentum: 0.5
    weight_decay: 0
    eps: 1.0e-6

    parameters: loss_fn.discriminator

trainer:
  max_epochs: 64
  # limit_train_batches: 0.1
  # limit_val_batches: 0.1
  # gradient_clip_val: 100

# tune: false
# train: true
# test: false