From 254c722942d18cb68ee409019ca04aab9350afe9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gongjie=20Zhang=20=28=E5=BC=A0=E5=8A=9F=E6=9D=B0=29?= Date: Wed, 12 Sep 2018 19:21:08 +0800 Subject: [PATCH] update model.py - Fixed set_trainble bug Fixed a bug in set_trainable. We need to set new parameters to train trainable. --- model.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/model.py b/model.py index 302e111..ea9a54e 100644 --- a/model.py +++ b/model.py @@ -1491,6 +1491,8 @@ def set_trainable(self, layer_regex, model=None, indent=0, verbose=1): trainable = bool(re.fullmatch(layer_regex, layer_name)) if not trainable: param[1].requires_grad = False + else: # Fixed this bug. We need to set new parameters to train trainable. + param[1].requires_grad = True def set_log_dir(self, model_path=None): """Sets the model log directory and epoch counter.