From df646aaedaa9765d145e0a1fbbd4e327ab6d8467 Mon Sep 17 00:00:00 2001 From: healess Date: Tue, 4 Dec 2018 07:07:57 +0000 Subject: [PATCH] Fix runtime exception --- README.md | 2 +- model.py | 5 ++++- train.py | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index a12a9ce..a036360 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ This issue was discussed here: [Support Channel groups in convolutional layers # ### Main Dependencies ``` Python 3 or above - tensorflow 1.3.0 + tensorflow 1.3.0 or above (~1.12) numpy 1.13.1 tqdm 4.15.0 easydict 1.7 diff --git a/model.py b/model.py index 1150830..c100cda 100644 --- a/model.py +++ b/model.py @@ -88,7 +88,10 @@ def __init_output(self): self.optimizer = tf.train.AdamOptimizer(learning_rate=self.args.learning_rate) self.train_op = self.optimizer.minimize(self.loss) # This is for debugging NaNs. Check TensorFlow documentation. - self.check_op = tf.add_check_numerics_ops() + try: + self.check_op = tf.add_check_numerics_ops() + except Exception as e: + print('tf.add_check_numerics_ops() is not compatible with TensorFlow') # Output and Metrics self.y_out_softmax = tf.nn.softmax(self.logits) diff --git a/train.py b/train.py index fbaf5bf..0285213 100644 --- a/train.py +++ b/train.py @@ -67,7 +67,7 @@ def __load_imagenet_weights(self): run_list.append(tf.assign(variable, value)) self.sess.run(run_list) print("Weights loaded\n\n") - except KeyboardInterrupt: + except Exception as e: print("No pretrained ImageNet weights exist. Skipping...\n\n") ############################################################################################################