-
Notifications
You must be signed in to change notification settings - Fork 10
/
main_celeba.py
49 lines (39 loc) · 1.41 KB
/
main_celeba.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
46
47
48
import sys
import os
import json
import torch
from run_epochs import run_epochs
from utils.filehandling import create_dir_structure
from utils.filehandling import create_dir_structure_testing
from celeba.flags import parser
from celeba.experiment import CelebaExperiment
if __name__ == '__main__':
FLAGS = parser.parse_args()
use_cuda = torch.cuda.is_available();
FLAGS.device = torch.device('cuda' if use_cuda else 'cpu');
if FLAGS.method == 'poe':
FLAGS.modality_poe=True;
FLAGS.poe_unimodal_elbos=True;
elif FLAGS.method == 'moe':
FLAGS.modality_moe=True;
elif FLAGS.method == 'jsd':
FLAGS.modality_jsd=True;
elif FLAGS.method == 'joint_elbo':
FLAGS.joint_elbo=True;
else:
print('method implemented...exit!')
sys.exit();
print(FLAGS.modality_poe)
print(FLAGS.modality_moe)
print(FLAGS.modality_jsd)
print(FLAGS.joint_elbo)
FLAGS.alpha_modalities = [FLAGS.div_weight_uniform_content, FLAGS.div_weight_m1_content,
FLAGS.div_weight_m2_content];
FLAGS = create_dir_structure(FLAGS)
alphabet_path = os.path.join(os.getcwd(), 'alphabet.json');
with open(alphabet_path) as alphabet_file:
alphabet = str(''.join(json.load(alphabet_file)))
celeb = CelebaExperiment(FLAGS, alphabet);
create_dir_structure_testing(celeb)
celeb.set_optimizer();
run_epochs(celeb);