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

Added How To use FastaiLRFinder Guide #11

Merged
merged 10 commits into from
Aug 1, 2021
Merged

Conversation

Priyansi
Copy link
Collaborator

@Priyansi Priyansi commented Jul 28, 2021

Fixes #5
Moved FastaiLRFinder_MNIST.ipynb notebook to how-to guides.
Changes in the flow of the notebook, explanation, comments and code were made. ProgressBar handler was removed to avoid unnecessary code.

@Priyansi Priyansi changed the title Add howto fastai lrfinder Add ed How To use FastaiLRFinder Guide Jul 28, 2021
@Priyansi Priyansi changed the title Add ed How To use FastaiLRFinder Guide Added How To use FastaiLRFinder Guide Jul 28, 2021
@sdesrozis
Copy link
Contributor

@Priyansi it looks good to me !

Copy link
Collaborator

@KickItLikeShika KickItLikeShika left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for the PR @Priyansi, very nice work! I just have one comment.

{
"cell_type": "markdown",
"source": [
"When attached to the `trainer`, this handler follows the same procedure used by [fastai](https://docs.fast.ai/callback.schedule.html#LRFinder). The model is trained for `num_iter` iterations while the learning rate is increased from its initial value specified by the optimizer to the upper bound called `end_lr`. This increase can be linear (`step_mode=\"linear\"`) or exponential (`step_mode=\"exp\"`). The default `step_mode` is exponential which is recommended for larger learning rate ranges while linear provides good results for small ranges."
Copy link
Collaborator

@KickItLikeShika KickItLikeShika Jul 29, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

learning rate is increased from its initial value specified by the optimizer to the upper bound called end_lr

That's not 100% true anymore, we recently added the start_lr option, see here pytorch/ignite#2111
, so I think saying it will increase from start_lr to end_lr and if start_lr is None it will start from LR with optimizer be default would be better.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for pointing that out! I'll make the change.

Copy link
Member

@trsvchn trsvchn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Priyansi ! Good work! I left some comments

how-to-guides/fastai-lr-finder.ipynb Outdated Show resolved Hide resolved
how-to-guides/fastai-lr-finder.ipynb Show resolved Hide resolved
@trsvchn
Copy link
Member

trsvchn commented Jul 29, 2021

Maybe we can Add more headers: E.g: ## w/o LR Finder, LR Finder or alternatively remove ## Basic Setup, because we have just one related to setup and that's weird

@Priyansi
Copy link
Collaborator Author

Thank you for the comments @trsvchn ! I updated the notebook.

"sidebar: true\n",
"tags:\n",
" - lr finder\n",
" - fastai lr finder\n",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
" - fastai lr finder\n",

"\n",
" self.model = resnet18(num_classes=10)\n",
" self.model.conv1 = nn.Conv2d(\n",
" 1, 64, kernel_size=(3, 3), stride=(2, 2), padding=(3, 3), bias=False\n",
Copy link
Member

@vfdev-5 vfdev-5 Jul 29, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to pad as 3 if kernel size is 3, should be padding 1.
Let's remove stride as well.

{
"cell_type": "markdown",
"source": [
"Let's see how we can achieve better results by using the `FastAILRFinder` handler. But first, let's restore the initial state of the model and optimizer so we can re-train them from scratch. "
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"Let's see how we can achieve better results by using the `FastAILRFinder` handler. But first, let's restore the initial state of the model and optimizer so we can re-train them from scratch. "
"Let's see how we can achieve better results by using the `FastaiLRFinder` handler. But first, let's restore the initial state of the model and optimizer so we can re-train them from scratch. "

And let's add a link to our docs of FastaiLRFinder

@Priyansi
Copy link
Collaborator Author

Priyansi commented Aug 1, 2021

Thank you @vfdev-5 for the review, I have made the suggested changes.

Copy link
Member

@vfdev-5 vfdev-5 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@vfdev-5 vfdev-5 merged commit 1144101 into main Aug 1, 2021
@vfdev-5 vfdev-5 deleted the add-howto-fastai-lrfinder branch August 1, 2021 12:34
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

Successfully merging this pull request may close these issues.

Create new how-to guide for FastAI LRFinder
5 participants