Skip to content

feat: allow direct Hessian retrieval - #17

Open
iamgroot42 wants to merge 5 commits into
alstonlo:mainfrom
iamgroot42:main
Open

feat: allow direct Hessian retrieval#17
iamgroot42 wants to merge 5 commits into
alstonlo:mainfrom
iamgroot42:main

Conversation

@iamgroot42

Copy link
Copy Markdown

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