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

Why L-BFGS performs different in tensorflow.compat.v1 and pytorch #1698

Open
gaohuizhang opened this issue Apr 1, 2024 · 3 comments
Open

Comments

@gaohuizhang
Copy link

gaohuizhang commented Apr 1, 2024

Hi,

I tried to train the model with L-BFGS after 15000 iterations of Adam, but I got different results from tensorflow.compat.v1 and PyTorch, even if I use the exact same code, just a different backend.
This is the loss history using tensorflow.compat.v1
tensorflow
This is the loss history using Pytorch
pytorch

Does anyone have any idea why this happens? Does this mean we have to use TensorFlow if we want to use the L-BFGS optimizer?

Thanks a lot

@bakhtiyar-k
Copy link

Hello, try to use the same seed for both cases dde.config.set_random_seed(1). Maybe the results are different due to different initialization

@gaohuizhang
Copy link
Author

Thanks for your advice, but I tried several times and got similar results. I don't think it is caused by randomness of initialization.

@praksharma
Copy link
Contributor

Because LBFGS is implemented differently in both libraries. You find the link the the particular implementation (papers) in the source code of tf and torch.

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

No branches or pull requests

3 participants