Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions configs/vae.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,6 @@ logging_params:
save_dir: "logs/"
name: "VanillaVAE"

custom_params:
resume_training: false
resume_chkpt_path: ""
10 changes: 10 additions & 0 deletions run.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import argparse
import numpy as np
from pathlib import Path
from collections import OrderedDict
from models import *
from experiment import VAEXperiment
import torch.backends.cudnn as cudnn
Expand Down Expand Up @@ -36,6 +37,15 @@
seed_everything(config['exp_params']['manual_seed'], True)

model = vae_models[config['model_params']['name']](**config['model_params'])
if 'custom_params' in config:
if config['custom_params']['resume_training']:
checkpoint = torch.load(config['custom_params']['resume_chkpt_path'])
state_dict = checkpoint['state_dict']
new_state_dict = OrderedDict()
for k, v in state_dict.items():
new_state_dict[k.replace("model.", "")] = v
model.load_state_dict(new_state_dict)

experiment = VAEXperiment(model,
config['exp_params'])

Expand Down