Compatibility with other PyTorch optimizers
See original GitHub issueHi Amir, AdaHessian sounds really promising! Is this talk still happening?
Anyways, I noticed the signature of the step method in AdaHessian is different from other optimizers, because it requires the list of parameters and gradients as an argument. I wonder if you could not do it directly using the .grad
property of the parameters. I think in the loss you just need to have loss.backward(retain_graph=True, create_graph=True)
instead of only loss.backward()
. Then, to make sure the user actually did this when backpropagating the loss gradient, you could check if each .grad
property had a .grad_fn
property, and if not issue an error and asking the user to use loss.backward(retain_graph=True, create_graph=True)
.
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
SGD compatibility with other frameworks - PyTorch Forums
I am trying to write a SGD that would be more similar to other frameworks. ... just add those parameters to a different...
Read more >L12.5 Choosing Different Optimizers in PyTorch - YouTube
Slides: https://sebastianraschka.com/pdf/lecture-notes/stat453ss21/L12_optim__slides.pdfLink to the code referenced in this video:- ...
Read more >GitHub - jettify/pytorch-optimizer: torch-optimizer
torch-optimizer -- collection of optimizers for PyTorch compatible with optim ... It is very easy to extend script and tune other optimizer parameters....
Read more >Writing Your Own Optimizers in PyTorch - Daniel McNeela
All optimizers in PyTorch need to inherit from torch.optim.Optimizer . This is a base class which handles all general optimization machinery.
Read more >Optimization — PyTorch Lightning 1.8.6 documentation
Lightning offers two modes for managing the optimization process: ... For the majority of research cases, automatic optimization will do the right thing...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi Amir,
I tried using AdaHessian on a problem of mine (it worked very well by the way, much better than Adam) and decided to implement my suggestion above (make the signature of optimizer.step() the same as other optimizers). I’m sending the code below if you want to implement this here as well. I could also create a fork and submit a merge request but that would mean that I would have to change the AdaHessian signature in all test files it is used, and I could miss something.
Thanks for the help João. I merged the PR and closed the issue now.