LR Finder for Pytorch Models

(Avhirup Chakraborty) #1

How can i use fastai’s lr_finder to use it for my pytorch module? Seeing the docs it seems i would have to make a lot of changes. Similar to how we could use fit method for any pytorch module.if lr_find could work that way that be really helpful.

1 Like

(Avhirup Chakraborty) #3

1 Like

(Jeremy Howard (Admin)) #4

Check the cifar10 thread to see how to use custom models with a learner - which gets you this functionality for free.

0 Likes

(Shikhar Gupta) #5

@jeremy I’m trying to build a learning rate finder for a small network. The logic is very similar to how it’s in fastai. In my case the number of training images are ~640 which is very less. This results in less number of iterations for learning rate finder. Also my loss vs LR is not showing any clear pattern.
My first question is should we have some minimum number of iterations for LR finder so that it can show some regular pattern (decreasing)? Secondly if you have less number of images then should we run LR finder for multiple epochs or should we reduce the batch size to increase the number of iterations? And does reducing the batch size affect the performance of LR finder?

Below is my loss (y-axis) vs LR plot. I have varied the LR from 1e-5 to 1e-1. Batch size =32 and it ran for 176 iterations.
image

0 Likes

(Xu Dong) #6

Can you please provide a link to your reference?

1 Like

(Rahul Somani) #7

This might be helpful:

0 Likes