Closed manuel-munoz-aguirre closed 3 years ago
@manuel-munoz-aguirre You are right, the condition should be ... and min_grad_idx is not None:
which is the same as line 510 since it's a numerical value:
https://github.com/davidtvs/pytorch-lr-finder/blob/9cfcbecba35866711647a251b4527c6f29b9c9f5/torch_lr_finder/lr_finder.py#L508-L512
Thanks for the feedback! I'll send a patch for it.
Thanks for raising the issue @manuel-munoz-aguirre and thanks to @NaleRaphael for fixing it in #66
The fix has been merged, closing this issue.
When using the
plot
function in a situation like the following: where the first value inlrs[min_grad_idx]
is the suggested learning rate, even if the suggested learning rate is printed, it is not returned.Expected behavior: return ax, lrs[min_grad_idx] Observed behavior: return ax
These seem to be the relevant lines. Seems that
ax
is returned due to min_grad_idx evaluating to False (because it is 0): https://github.com/davidtvs/pytorch-lr-finder/blob/9cfcbecba35866711647a251b4527c6f29b9c9f5/torch_lr_finder/lr_finder.py#L535-L538