Commit 1c07d497 authored by Shreyan Chowdhury's avatar Shreyan Chowdhury

refactoring - shorten file names

parent c524e4ca
......@@ -37,10 +37,10 @@ def run(hparams):
# callbacks
early_stop = EarlyStopping(
monitor='val_loss',
monitor='prauc',
patience=20,
verbose=True,
mode='min'
mode='max'
)
checkpoint_callback = ModelCheckpoint(
......@@ -68,22 +68,28 @@ def run(hparams):
try:
trainer.fit(model)
test_metrics = trainer.test()
logger.info(test_metrics)
except KeyboardInterrupt:
logger.info("Training interrupted")
except:
logger.exception(msg="Error occurred during train!")
exit_experiment('failed', exp)
try:
logger.info("Starting test...")
trainer.test()
except KeyboardInterrupt:
logger.info("Exiting...")
exit_experiment('stopped', exp)
except:
logger.info("Run interrupted")
except Exception as e:
logger.exception(msg="Error occurred during test!")
exit_experiment('failed', exp)
# try:
# trainer.fit(model)
# except KeyboardInterrupt:
# logger.info("Training interrupted")
# except:
# logger.exception(msg="Error occurred during train!")
#
# try:
# logger.info("Starting test...")
# test_metrics = trainer.test()
# logger.info(test_metrics)
# except KeyboardInterrupt:
# logger.info("Test interrupted...")
# except:
# logger.exception(msg="Error occurred during test!")
if __name__ == '__main__':
parent_parser = HyperOptArgumentParser(strategy='grid_search', add_help=False)
......@@ -93,14 +99,13 @@ if __name__ == '__main__':
default=1.0, help='how much train data to use')
parent_parser.add_argument('--max_epochs', type=int,
default=10, help='maximum number of epochs')
# parent_parser.add_argument('--gpus', type=list, default=[0,1],
# help='how many gpus to use in the node.'
# ' value -1 uses all the gpus on the node')
parser = Network.add_model_specific_args(parent_parser)
hyperparams = parser.parse_args()
# run(hyperparams)
# gpus = ['cuda:0', 'cuda:1']
# hyperparams.optimize_parallel_gpu(run, gpus, 5)
run(hyperparams)
# for hparam_trial in hyperparams.trials(20):
# run(hparam_trial)
for hparam_trial in hyperparams.trials(3):
run(hparam_trial)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment