File tree 2 files changed +17
-3
lines changed
2 files changed +17
-3
lines changed Original file line number Diff line number Diff line change 10
10
import c3 .utils .parsers as parsers
11
11
import c3 .utils .tf_utils as tf_utils
12
12
import tensorflow as tf
13
+ from c3 .parametermap import ParameterMap
14
+ from c3 .experiment import Experiment
15
+ from c3 .system import Model
16
+ from c3 .generator .generator import Generator
13
17
14
18
logging .getLogger ('tensorflow' ).disabled = True
15
19
if __name__ == '__main__' :
26
30
with open (opt_config , "r" ) as cfg_file :
27
31
try :
28
32
cfg = hjson .loads (cfg_file .read ())
29
- except hjson .decoder .hjsonDecodeError :
33
+ except hjson .decoder .HjsonDecodeError :
30
34
raise Exception (f"Config { opt_config } is invalid." )
31
35
optim_type = cfg ['optim_type' ]
32
36
exp_setup = cfg ['exp_setup' ]
33
37
34
38
tf_utils .tf_setup ()
35
39
with tf .device ('/CPU:0' ):
36
- exp = parsers .create_experiment (exp_setup )
40
+ model = None
41
+ gen = None
42
+ if "model" in cfg :
43
+ model = Model ()
44
+ model .read_config (cfg ["model" ])
45
+ if "generator" in cfg :
46
+ gen = Generator ()
47
+ gen .read_config (cfg ["generator" ])
48
+ pmap = ParameterMap (model = model , generator = gen )
49
+ pmap .read_config (cfg ["instructions" ])
50
+ exp = Experiment (pmap )
37
51
38
52
if optim_type == "C1" :
39
53
opt = parsers .create_c1_opt (opt_config , exp )
Original file line number Diff line number Diff line change @@ -124,7 +124,7 @@ def test_parser_integration() -> None:
124
124
"""
125
125
Check that an Experiment can be initialized.
126
126
"""
127
- exp = Exp (pmap = pmap )
127
+ Exp (pmap = pmap )
128
128
129
129
130
130
def test_model_writer () -> None :
You can’t perform that action at this time.
0 commit comments