Skip to content

update model.py - Fixed set_trainble bug #48

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions model.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down