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

Problem with serialization #236

Open
keyvan-amiri opened this issue Aug 30, 2024 · 1 comment
Open

Problem with serialization #236

keyvan-amiri opened this issue Aug 30, 2024 · 1 comment

Comments

@keyvan-amiri
Copy link

Hello everyone and thank you for your great work on Laplace library.
Based on the documentation for sharing of a fitted Laplace() instance, it is better to use state_dict():
torch.save(la.state_dict(), "model_state_dict.bin")
but unfortunately, it results to thies error:
AttributeError: 'FullLLLaplace' object has no attribute 'state_dict'
Context information:

  • It is also the same for other classes like KronLLLaplace.
  • I have installed Laplace using 'pip install .' after cloning https://github.com/runame/laplace-redux
  • In another experiment I used 'pip install laplace-torch' but the error is still there :( .
    That would be perfect if you could help me to resolve this issue in my implementation.
    Regards,
    Keyvan
@wiseodd
Copy link
Collaborator

wiseodd commented Sep 2, 2024

Thanks for opening this issue. This shouldn't be the case since both FullLLLaplace and KronLLLaplace inherit LLLaplace which has state_dict defined.

Moreover, this functionality is also well-tested https://github.com/aleximmer/Laplace/blob/main/tests/test_serialization.py.

Could you please check the installed laplace-torch version?

pip freeze | grep laplace-torch

It should be >= 0.2. If it's not then please do:

pip install --upgrade laplace-torch

and try again.

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

2 participants