While following the Jupyter notebooks for the course
I hit upon an error when these lines are run.
I know that the cnn_learner
line has got no errors whatsoever, The problem lies in the lr_find()
part
It seems that learn.lr_find()
does not want to return two values! Although its documentation says that it returns a tuple. That is my problem.
These are the lines of code:
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)
for the second line.
Also, I get this graph with one 'marker' which I suppose is either one of the values of lr_min
or lr_steep
This is the graph
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 (which is really important for me)
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 of the learning rates after every run, which is perfectly fine.
I was having the same problem and I found that the lr_find()
output's has updated. You can substitute the second line to lrs = learn.lr_find(suggest_funcs=(minimum, steep, valley, slide))
, and then you just substitute where you using lr_min
and lr_steep
to lrs.minimum
and lrs.steep
respectively, this should work fine and solve your problem.
If you wanna read more about it, you can see this post that is in the fastai's forum.