Created
October 16, 2022 22:18
-
-
Save Quetzalcohuatl/8b9477bfd00ba34df457ffdfcb6654c5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# View layers with model.children() | |
# Get params with module.parameters() | |
m = resnet50(pretrained=True) | |
_ = m.train() | |
for param in list(m.children())[0].parameters(): | |
param.requires_grad = False | |
_ = m.resnet50.eval() # disables dropout | |
Then: | |
optimizer = Adam(filter(lambda p: p.requires_grad, m.parameters()), lr=3e-4) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment