Skip to content

Commit

Permalink
ENH: model path as cmdline arg, verbose mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Sudnya Diamos committed Mar 29, 2017
1 parent a6bb29e commit 07de73c
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 16 deletions.
20 changes: 10 additions & 10 deletions configs/explore.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
},

"optimizer" : {
"name": "adam",
"epochs" : 100,
"name": "momentum",
"epochs" : 50,
"learning_rate" : 1e-2,
"momentum" : 0.95,
"decay_rate" : 1.0,
Expand All @@ -19,21 +19,21 @@
},

"model" : {
"dropout" : 0.0,
"dropout" : 0.5,
"batch_size" : 32,
"conv_layers" : [
{ "filter_size" : 512,
"num_filters" : 512,
"stride" : 2
},
{ "filter_size" : 256,
"num_filters" : 512,
"stride" : 2
"num_filters" : 64,
"stride" : 7
},
{ "filter_size" : 128,
"num_filters" : 64,
"stride" : 7
}
]
},

"io" : {
"output_save_path" : "/deep/group/sudnya/experiments/cnn2-size512_256-num512_512_adam"
"output_save_path" : "/deep/group/sudnya/repro/cnn2-size256_128-num64_64_dp0_5_str7"
}
}
13 changes: 9 additions & 4 deletions score.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,22 @@ def print_scores(labels, predictions, classes):

def main():
parser = argparse.ArgumentParser(description="Evaluater Script")
parser.add_argument("model_path")
parser.add_argument("-m", "--model_path", default="~/")
parser.add_argument("-v", "--verbose", default=False, action="store_true")

args = parser.parse_args()
parsed_arguments = parser.parse_args()
arguments = vars(parsed_arguments)

is_verbose = arguments['verbose']
model_path = arguments['model_path']

batch_size = 8
evaler = test.Evaler(args.model_path,
evaler = test.Evaler(model_path, is_verbose,
batch_size=batch_size)

# TODO, (awni), would be good to simplify loading and
# not rely on random seed for validation set.
config_file = os.path.join(args.model_path, "config.json")
config_file = os.path.join(model_path, "config.json")
with open(config_file, 'r') as fid:
config = json.load(fid)
data_conf = config['data']
Expand Down
4 changes: 2 additions & 2 deletions test.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@

class Evaler:

def __init__(self, save_path, batch_size=1):
def __init__(self, save_path, is_verbose, batch_size=1):
config_file = os.path.join(save_path, "config.json")

with open(config_file, 'r') as fid:
config = json.load(fid)
config['model']['batch_size'] = batch_size

self.model = network.Network()
self.model = network.Network(is_verbose)
self.graph = tf.Graph()
self.session = sess = tf.Session(graph=self.graph)
with self.graph.as_default():
Expand Down

0 comments on commit 07de73c

Please sign in to comment.