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

change LBFGS's default tolerance_grad to 1e-7 #25240

Closed
wants to merge 1 commit into from
Closed

change LBFGS's default tolerance_grad to 1e-7 #25240

wants to merge 1 commit into from

Conversation

li012589
Copy link

Hi,

I noticed after v1.2.0 the implement of LBFGS optimizer has been changed. In this new implement, the return condition has been changed from the sum of the gradients to the max value in the gradients (see:

opt_cond = flat_grad.abs().max() <= tolerance_grad
). But the default tolerance_grad parameter has not been changed (which is too large for max of gradients), so this result in lots of my old codes not optimizing or only optimizing for one or two steps.

So, I came up this pull request to suggest that changing this tolerance_grad to a smaller value

@pytorchbot pytorchbot added the module: optimizer Related to torch.optim label Aug 27, 2019
@soumith soumith requested a review from vincentqb August 27, 2019 14:55
@vincentqb
Copy link
Contributor

vincentqb commented Aug 28, 2019

For reference: comment explaining change to max here in #8824.

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vincentqb has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

Copy link
Contributor

@vincentqb vincentqb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

@facebook-github-bot
Copy link
Contributor

@vincentqb merged this pull request in 1b7f7aa.

pytorchmergebot pushed a commit that referenced this pull request Apr 22, 2023
LBFGS' `tolerance_grad` parameter has had a default value of `1e-7` since #25240. The doc string wasn't updated in that PR to match the change https://github.com/pytorch/pytorch/blob/main/torch/optim/lbfgs.py#L207.

no open issue for it, just happened to set it to 1e-7 and was surprised my results didn't change :-) eventually noticed inconsistency in the doc and seemed like an easy opportunity to figure out how to contribute.

Pull Request resolved: #99792
Approved by: https://github.com/janeyx99
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Merged module: optimizer Related to torch.optim
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants