From e1573440ba9c8aa247fa0dbc524244d3cdc3de14 Mon Sep 17 00:00:00 2001 From: Eren Golge Date: Fri, 29 Mar 2019 17:03:29 +0100 Subject: [PATCH] if reinit option is used run runtime rrror to partially iniot the model --- train.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/train.py b/train.py index 6a7f2ebd..97eec378 100644 --- a/train.py +++ b/train.py @@ -392,6 +392,8 @@ def main(args): # TODO: fix optimizer init, model.cuda() needs to be called before # optimizer restore # optimizer.load_state_dict(checkpoint['optimizer']) + if len(c.reinit_layers) > 0: + raise RuntimeError model.load_state_dict(checkpoint['model']) except: print(" > Partial model initialization.")