From 97edba0b7adb780071f28138a795080521d6f6ec Mon Sep 17 00:00:00 2001 From: Yonghye Kwon Date: Wed, 31 Jul 2019 21:05:43 +0900 Subject: [PATCH 1/2] Remove Unused Argument of parser : --var (#408) Remove Unused Argument of parser : --var --- train.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/train.py b/train.py index 8ca4aadc..1a264e95 100644 --- a/train.py +++ b/train.py @@ -350,7 +350,7 @@ if __name__ == '__main__': parser.add_argument('--evolve', action='store_true', help='evolve hyperparameters') parser.add_argument('--bucket', type=str, default='', help='gsutil bucket') parser.add_argument('--img-weights', action='store_true', help='select training images by weight') - parser.add_argument('--var', default=0, type=int, help='debug variable') + opt = parser.parse_args() print(opt) From 7b3d9f02ec4abfd1ad9b5c492d5672e3f3584995 Mon Sep 17 00:00:00 2001 From: idow09 Date: Wed, 31 Jul 2019 15:12:27 +0300 Subject: [PATCH 2/2] prevent failure when no training_results available (#409) Use `chkpt.get('training_results')` instead of `chkpt.get('training_results')` so if the dict doesn't contain this key it won't throw a `KeyError --- train.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/train.py b/train.py index 1a264e95..ad86edbb 100644 --- a/train.py +++ b/train.py @@ -131,7 +131,7 @@ def train(cfg, optimizer.load_state_dict(chkpt['optimizer']) best_fitness = chkpt['best_fitness'] - if chkpt['training_results'] is not None: + if chkpt.get('training_results') is not None: with open('results.txt', 'w') as file: file.write(chkpt['training_results']) # write results.txt