-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcodeformer_finetune.yml
executable file
·109 lines (91 loc) · 2.35 KB
/
codeformer_finetune.yml
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# general settings
name: codeformer_finetune # name tag of the experiments
model_type: CodeFormerModel
num_gpu: 1
manual_seed: 0
# dataset and data loader settings
datasets:
train:
name: CelebA-raw-noise-512
type: PairedImageDataset
dataroot_lq: ../data/celeba-raw-noise-4x-iso-3000/train_lq # low-quality inputs directory
dataroot_gt: ../data/celeba-raw-noise-4x-iso-3000/train_targets_codeformer # pseudo targets directory
io_backend:
type: disk
mean: [0.5, 0.5, 0.5]
std: [0.5, 0.5, 0.5]
scale: 1
# data loader
num_worker_per_gpu: 1
batch_size_per_gpu: 8
dataset_enlarge_ratio: 1
prefetch_mode: ~
use_flip: true
use_rot: false
# network structures
# network structures
network_g:
type: CodeFormer
dim_embd: 512
n_head: 8
n_layers: 9
codebook_size: 1024
connect_list: ['32', '64', '128', '256']
fix_modules: ['quantize','generator','fuse_convs_dict']
network_vqgan: # this config is needed if no pre-calculated latent
type: VQAutoEncoder
img_size: 512
nf: 64
ch_mult: [1, 2, 2, 4, 4, 8]
quantizer: 'nearest'
codebook_size: 1024
# path
path:
pretrain_network_g: './weights/CodeFormer/codeformer.pth' # pretrained codeformer model from stage 3
param_key_g: params_ema
strict_load_g: true
pretrain_network_d: ~
strict_load_d: true
resume_state: ~
# base_lr(4.5e-6)*bach_size(4)
train:
use_hq_feat_loss: true
feat_loss_weight: 1.0
cross_entropy_loss: true
entropy_loss_weight: 0.5
fidelity_weight: 0
optim_g:
type: Adam
lr: !!float 1e-4
weight_decay: 0
betas: [0.9, 0.99]
scheduler:
type: MultiStepLR
milestones: [35000, 38000]
gamma: 0.5
# scheduler:
# type: CosineAnnealingRestartLR
# periods: [500000]
# restart_weights: [1]
# eta_min: !!float 2e-5 # no lr reduce in official vqgan code
total_iter: 40000
warmup_iter: -1 # no warm up
ema_decay: 0.995
use_adaptive_weight: true
net_g_start_iter: 0
net_d_iters: 1
net_d_start_iter: 0
manual_seed: 0
# logging settings
logger:
print_freq: 50
save_checkpoint_freq: !!float 1e4
use_tb_logger: true
wandb:
project: ~
resume_id: ~
# dist training settings
dist_params:
backend: nccl
port: 29412
find_unused_parameters: true