Skip to content
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

How to freeze layer in this model!! #8

Closed
tks1998 opened this issue Aug 17, 2021 · 3 comments
Closed

How to freeze layer in this model!! #8

tks1998 opened this issue Aug 17, 2021 · 3 comments

Comments

@tks1998
Copy link

tks1998 commented Aug 17, 2021

No description provided.

@tks1998
Copy link
Author

tks1998 commented Aug 17, 2021

Additional question: How to load pretrained model!!!

@shijianjian
Copy link
Owner

Similar to other models, you may do something like:

for m in model.modules():
    m.requires_grad = False
for name, m in model._fc.modules():
    m.requires_grad = True

model.load_state_dict("path_to_state_dict")

@tks1998
Copy link
Author

tks1998 commented Aug 31, 2021

tks :D

@tks1998 tks1998 closed this as completed Aug 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants