forked from carpedm20/simulated-unsupervised-tensorflow
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
29 lines (22 loc) · 678 Bytes
/
Copy pathmain.py
File metadata and controls
29 lines (22 loc) · 678 Bytes
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
import sys
import numpy as np
import tensorflow as tf
from trainer import Trainer
from config import get_config
from utils import prepare_dirs, save_config
config = None
def main(_):
prepare_dirs(config)
rng = np.random.RandomState(config.random_seed)
tf.set_random_seed(config.random_seed)
trainer = Trainer(config, rng)
save_config(config.model_dir, config)
if config.is_train:
trainer.train()
else:
if not config.load_path:
raise Exception("[!] You should specify `load_path` to load a pretrained model")
trainer.test()
if __name__ == "__main__":
config, unparsed = get_config()
tf.app.run(main=main, argv=[sys.argv[0]] + unparsed)