forked from AntixK/PyTorch-VAE
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.py
45 lines (36 loc) · 1.23 KB
/
run.py
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
import torch
from models import VanillaVAE, WAE_MMD, CVAE
from experiment import VAEXperiment
from pytorch_lightning import Trainer
from pytorch_lightning.logging import TestTubeLogger
tt_logger = TestTubeLogger(
save_dir="logs/",
name="WassersteinVAE",
debug=False,
create_git_tag=False,
)
class hparams(object):
def __init__(self):
self.LR = 5e-3
self.scheduler_gamma = 0.95
self.gpus = 1
self.data_path = "../../shared/Data/"
self.batch_size = 144
self.img_size = 64
self.manual_seed = 1256
hyper_params = hparams()
torch.manual_seed = hyper_params.manual_seed
# model = VanillaVAE(in_channels=3, latent_dim=128)
# model = CVAE(in_channels=3, latent_dim=128, num_classes=40, img_size=64)
model = WAE_MMD(in_channels=3, latent_dim=128, reg_weight=100)
experiment = VAEXperiment(model,
hyper_params)
runner = Trainer(gpus=hyper_params.gpus,
default_save_path=f"{tt_logger.save_dir}",
min_nb_epochs=1,
max_nb_epochs= 50,
logger=tt_logger,
log_save_interval=100,
train_percent_check=1.,
val_percent_check=1.)
runner.fit(experiment)