|
25 | 25 | import candle
|
26 | 26 | import nt3 as bmk
|
27 | 27 |
|
28 |
| -""" Import Tensorflow Modules """ |
| 28 | +# Import Tensorflow Modules |
29 | 29 | import tensorflow as tf
|
30 | 30 | from tensorflow.core.protobuf import saver_pb2
|
31 | 31 | from tensorflow.python.framework import graph_io
|
|
44 | 44 | # P = 60483 # 60483
|
45 | 45 | # DR = 0.1 # Dropout rate
|
46 | 46 |
|
47 |
| -""" |
48 |
| -def common_parser(parser): |
49 |
| -
|
50 |
| - parser.add_argument("--config_file", dest='config_file', type=str, |
51 |
| - default=os.path.join(file_path, 'nt3_default_model.txt'), |
52 |
| - help="specify model configuration file") |
53 |
| -
|
54 |
| - # Parse has been split between arguments that are common with the default neon parser |
55 |
| - # and all the other options |
56 |
| - parser = p1_common.get_default_neon_parse(parser) |
57 |
| - parser = p1_common.get_p1_common_parser(parser) |
58 |
| -
|
59 |
| - return parser |
60 |
| -
|
61 |
| -def get_nt3_parser(): |
62 |
| -
|
63 |
| - parser = argparse.ArgumentParser(prog='nt3_baseline', formatter_class=argparse.ArgumentDefaultsHelpFormatter, |
64 |
| - description='Train Autoencoder - Pilot 1 Benchmark NT3') |
65 |
| -
|
66 |
| - return common_parser(parser) |
67 |
| -
|
68 |
| -def read_config_file(file): |
69 |
| - config = configparser.ConfigParser() |
70 |
| - config.read(file) |
71 |
| - section = config.sections() |
72 |
| - fileParams = {} |
73 |
| -
|
74 |
| - fileParams['data_url'] = eval(config.get(section[0],'data_url')) |
75 |
| - fileParams['train_data'] = eval(config.get(section[0],'train_data')) |
76 |
| - fileParams['test_data'] = eval(config.get(section[0],'test_data')) |
77 |
| - fileParams['model_name'] = eval(config.get(section[0],'model_name')) |
78 |
| - fileParams['conv'] = eval(config.get(section[0],'conv')) |
79 |
| - fileParams['dense'] = eval(config.get(section[0],'dense')) |
80 |
| - fileParams['activation'] = eval(config.get(section[0],'activation')) |
81 |
| - fileParams['out_activation'] = eval(config.get(section[0],'out_activation')) |
82 |
| - fileParams['loss'] = eval(config.get(section[0],'loss')) |
83 |
| - fileParams['optimizer'] = eval(config.get(section[0],'optimizer')) |
84 |
| - fileParams['metrics'] = eval(config.get(section[0],'metrics')) |
85 |
| - fileParams['epochs'] = eval(config.get(section[0],'epochs')) |
86 |
| - fileParams['batch_size'] = eval(config.get(section[0],'batch_size')) |
87 |
| - fileParams['learning_rate'] = eval(config.get(section[0], 'learning_rate')) |
88 |
| - fileParams['dropout'] = eval(config.get(section[0],'dropout')) |
89 |
| - fileParams['classes'] = eval(config.get(section[0],'classes')) |
90 |
| - fileParams['pool'] = eval(config.get(section[0],'pool')) |
91 |
| - fileParams['save_path'] = eval(config.get(section[0], 'save_path')) |
92 |
| -
|
93 |
| - # parse the remaining values |
94 |
| - for k,v in config.items(section[0]): |
95 |
| - if not k in fileParams: |
96 |
| - fileParams[k] = eval(v) |
97 |
| -
|
98 |
| - return fileParams |
99 |
| -
|
100 |
| -def initialize_parameters(): |
101 |
| - # Get command-line parameters |
102 |
| - parser = get_nt3_parser() |
103 |
| - args = parser.parse_args() |
104 |
| - #print('Args:', args) |
105 |
| - # Get parameters from configuration file |
106 |
| - fileParameters = read_config_file(args.config_file) |
107 |
| - #print ('Params:', fileParameters) |
108 |
| - # Consolidate parameter set. Command-line parameters overwrite file configuration |
109 |
| - gParameters = p1_common.args_overwrite_config(args, fileParameters) |
110 |
| - return gParameters |
111 |
| - """ |
| 47 | + |
| 48 | +# def common_parser(parser): |
| 49 | + |
| 50 | +# parser.add_argument("--config_file", dest='config_file', type=str, |
| 51 | +# default=os.path.join(file_path, 'nt3_default_model.txt'), |
| 52 | +# help="specify model configuration file") |
| 53 | + |
| 54 | +# # Parse has been split between arguments that are common with the default neon parser |
| 55 | +# # and all the other options |
| 56 | +# parser = p1_common.get_default_neon_parse(parser) |
| 57 | +# parser = p1_common.get_p1_common_parser(parser) |
| 58 | + |
| 59 | +# return parser |
| 60 | + |
| 61 | +# def get_nt3_parser(): |
| 62 | + |
| 63 | +# parser = argparse.ArgumentParser(prog='nt3_baseline', formatter_class=argparse.ArgumentDefaultsHelpFormatter, |
| 64 | +# description='Train Autoencoder - Pilot 1 Benchmark NT3') |
| 65 | + |
| 66 | +# return common_parser(parser) |
| 67 | + |
| 68 | +# def read_config_file(file): |
| 69 | +# config = configparser.ConfigParser() |
| 70 | +# config.read(file) |
| 71 | +# section = config.sections() |
| 72 | +# fileParams = {} |
| 73 | + |
| 74 | +# fileParams['data_url'] = eval(config.get(section[0],'data_url')) |
| 75 | +# fileParams['train_data'] = eval(config.get(section[0],'train_data')) |
| 76 | +# fileParams['test_data'] = eval(config.get(section[0],'test_data')) |
| 77 | +# fileParams['model_name'] = eval(config.get(section[0],'model_name')) |
| 78 | +# fileParams['conv'] = eval(config.get(section[0],'conv')) |
| 79 | +# fileParams['dense'] = eval(config.get(section[0],'dense')) |
| 80 | +# fileParams['activation'] = eval(config.get(section[0],'activation')) |
| 81 | +# fileParams['out_activation'] = eval(config.get(section[0],'out_activation')) |
| 82 | +# fileParams['loss'] = eval(config.get(section[0],'loss')) |
| 83 | +# fileParams['optimizer'] = eval(config.get(section[0],'optimizer')) |
| 84 | +# fileParams['metrics'] = eval(config.get(section[0],'metrics')) |
| 85 | +# fileParams['epochs'] = eval(config.get(section[0],'epochs')) |
| 86 | +# fileParams['batch_size'] = eval(config.get(section[0],'batch_size')) |
| 87 | +# fileParams['learning_rate'] = eval(config.get(section[0], 'learning_rate')) |
| 88 | +# fileParams['dropout'] = eval(config.get(section[0],'dropout')) |
| 89 | +# fileParams['classes'] = eval(config.get(section[0],'classes')) |
| 90 | +# fileParams['pool'] = eval(config.get(section[0],'pool')) |
| 91 | +# fileParams['save_path'] = eval(config.get(section[0], 'save_path')) |
| 92 | + |
| 93 | +# # parse the remaining values |
| 94 | +# for k,v in config.items(section[0]): |
| 95 | +# if not k in fileParams: |
| 96 | +# fileParams[k] = eval(v) |
| 97 | + |
| 98 | +# return fileParams |
| 99 | + |
| 100 | +# def initialize_parameters(): |
| 101 | +# # Get command-line parameters |
| 102 | +# parser = get_nt3_parser() |
| 103 | +# args = parser.parse_args() |
| 104 | +# #print('Args:', args) |
| 105 | +# # Get parameters from configuration file |
| 106 | +# fileParameters = read_config_file(args.config_file) |
| 107 | +# #print ('Params:', fileParameters) |
| 108 | +# # Consolidate parameter set. Command-line parameters overwrite file configuration |
| 109 | +# gParameters = p1_common.args_overwrite_config(args, fileParameters) |
| 110 | +# return gParameters |
112 | 111 |
|
113 | 112 |
|
114 | 113 | def initialize_parameters(default_model="nt3_default_model.txt"):
|
|
0 commit comments