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

Stop when we reach end_lr even if the loss did not diverge #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Stop when we reach end_lr even if the loss did not diverge #5

wants to merge 1 commit into from

Conversation

Vermeille
Copy link

Stop when we reach end_lr even if the loss did not diverge.
In some cases, the loss will not increase and diverge, so make sure we stop at end_lr (as the user asked anyway)

Stop when we reach end_lr even if the loss did not diverge.
In some cases, the loss will not increase and diverge, so make sure we stop at end_lr (as the user asked anyway)
@surmenok
Copy link
Owner

Thanks for the pull request!

Why does this situation happen? The finder uses start_lr and end_lr to calculate the rate of lr increase:

        num_batches = epochs * x_train.shape[0] / batch_size
        self.lr_mult = (end_lr / start_lr) ** (1 / num_batches)
        lr *= self.lr_mult

So, after going through all epochs, we should end up roughly with end_lr. If it doesn't happen, it might be better to fix calculation of lr_mult.

@Vermeille
Copy link
Author

HA!

You're 100% correct. I was a bit too negligent with that one. I actually saw a very similar piece of code on another repo (like, almost line-by-line similar), and that one did not call fit() itself, hence not calculating correctly the good amount of batches etc.

So, when I saw yours, I immediately thought you'd have the same issue, but you actually don't :)

Sorry for the inconvenience!

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.

2 participants