Error in lr_find()

Hi everyone!
While following the Jupyter notebooks, on the pet_breeds chapter
I hit upon an error when these lines are run

learn = cnn_learner(dls, resnet34, metrics=error_rate)
lr_min,lr_steep = learn.lr_find()

The error says: not enough values to unpack (expected 2, got 1). Also, I get this graph with one ‘marker’ which I suppose is either one of the values of lr_min or lr_steep
Screenshot 2021-07-15 180552

When I run learn.lr_find() only, i.e. do not capture the output in lr_min, lr_steep; it runs well but then I do not get the min and steep learning rates.

I read through what lr_find does and it is clear that it returns a tuple. Its docstring says

Launch a mock training to find a good learning rate and return suggestions based on suggest_funcs as a named tuple

I had duplicated the original notebook, and when I hit this error, I ran the original notebook, with the same results. I update the notebooks as well, but no change!
Wherever I have searched for this online, any sort of error hasn’t popped up. The only relevant thing I found is that lr_find returns different results after every run, which is perfectly fine.

1 Like
1 Like

Hi @muellerzr
Thanks for your reply, would you let me know if you got any tuple returned or did you directly run lr_find()

Thanks!

im also seeing this error as well

Hey @sahil1234 @hiydavid

I think the lr_find() functionality was slightly changed later. You need to add a function parameter called suggest_funcs to get the desired tuple.

For example, if you want to make the chapter 5 notebook give you lr_min, lr_steep, you can try this:

lr_min, lr_steep = learn.lr_find(suggest_funcs=(minimum, steep)).

You can also try valley (which is what lr_find() returns by default; a tuple with only one item) and slide. You can check those details out here

You can also check out the lr_find() docs here.

5 Likes

Thanks a lot @dhruv.metha !!

thank you!

As a side note, the fast ai docs are recently updated, Site last generated: Jul 30, 2021.

This means that all the tutorials got updated and lr find examples are also updated. You may want to take a look at that.

2 Likes

Yup!
Great to know that :v: