Created
March 11, 2020 10:04
-
-
Save gurucharanmk/0d5fa4941b0be8ed6f45faec489fe4c4 to your computer and use it in GitHub Desktop.
Code snippet for medium article
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
#Mixed precision model to train | |
learn = cnn_learner(dls, resnet18, pretrained=True, metrics=[accuracy_multi]).to_fp16() | |
#Train only the classifier using one cycle policy, with default optimizer(ADAM) and learning rate. | |
learn.fit_one_cycle(4) | |
#Save the trained model | |
learn.save('stage_1') | |
#Unfreeze the model, now entire model is available for training | |
learn.unfreeze() | |
#Find optimal leaning rate | |
learn.lr_find() | |
#Train the entire model with variable learning rate across the layers | |
learn.fit_one_cycle(4, slice(1e-6, 1e-4)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment