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

feat: allow direct Hessian retrieval #17

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

iamgroot42
Copy link

Hey,

Greate codebase- well-written and nicely documented! I spent the last few days looking for good and efficient ways to compute the Hessian of a model in Pytorch but almost all answers are either outdated, do not work, or are too slow (straightforward double-loops). However with a few simple modifications, it can be easily computed using this codebase:

module = AutogradInfluenceModule(
  model=model,
  objective=MyObjective(),  
  train_loader=loader,
  test_loader=None,
  device=device,
  damp=0,
  store_as_hessian=True
)
H = module.get_hessian()

I figured it would be nice to have it as part of the repo itself! I can also add a short barebones example in the examples folder if that would be of value?

@iamgroot42 iamgroot42 changed the title Allow direct Hessian retrieval feat: allow direct Hessian retrieval Apr 22, 2024
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.

1 participant