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

Failing tests: KFACLinearOperator object has no attribute _mapping #150

Closed
elcorto opened this issue Mar 12, 2024 · 4 comments
Closed

Failing tests: KFACLinearOperator object has no attribute _mapping #150

elcorto opened this issue Mar 12, 2024 · 4 comments

Comments

@elcorto
Copy link
Contributor

elcorto commented Mar 12, 2024

Hi

Thanks for this package. I have been testing the current main (fd4de8a) with support for curvlinops. While examples/regression_example.py runs, my code and many (all?) KronLaplace tests fail with

laplace/baselaplace.py:907: in fit
    super().fit(train_loader, override=override)
laplace/baselaplace.py:410: in fit
    loss_batch, H_batch = self._curv_closure(X, y, N)
laplace/baselaplace.py:887: in _curv_closure
    return self.backend.kron(X, y, N=N)
laplace/curvature/curvlinops.py:72: in kron
    kron = self._get_kron_factors(linop)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <laplace.curvature.curvlinops.CurvlinopsGGN object at 0x2aab7f54f850>
linop = <122x122 KFACLinearOperator with dtype=float32>

    def _get_kron_factors(self, linop):
        kfacs = list()
        for name, module in self.model.named_modules():
>           if name not in linop._mapping.keys():
E           AttributeError: 'KFACLinearOperator' object has no attribute '_mapping'

laplace/curvature/curvlinops.py:39: AttributeError

(full log attached).

System info:

  • asdfghjkl 0.1a2
  • backpack-for-pytorch 1.6.0
  • curvlinops-for-pytorch 1.2.0
  • torch 2.1.1

log.txt

@runame
Copy link
Collaborator

runame commented Mar 12, 2024

Hi Steve,

Can you clone the curvlinops repo and install it from the main branch? This should resolve the issue.

We depend on the latest version of curvlinops that is not available on pypi yet. Sorry for the confusion, we are currently making major upgrades to our library and the main branch might be unstable for bit (but you'll get many new features).

@elcorto
Copy link
Contributor Author

elcorto commented Mar 12, 2024

Hi Steve,

Can you clone the curvlinops repo and install it from the main branch? This should resolve the issue.

That works, thanks.

We depend on the latest version of curvlinops that is not available on pypi yet. Sorry for the confusion, we are currently making major upgrades to our library and the main branch might be unstable for bit (but you'll get many new features).

No worries, I wasn't using a released version so I don't expect things to be super stable. Having said that, since the latest tag 0.1a2 is quite old, I was using the previous main (f6af736) so far as quasi-stable version and after you updated that with new features, I gave it a shot.

Thanks for your work!

@wiseodd
Copy link
Collaborator

wiseodd commented Mar 12, 2024

Thanks for trying the new features so quickly! I created a fix for this confusion in #151.

Stay tuned for a new release later in several months! We'll do so once #144, #145, and #148 are merged to the master branch.

@elcorto
Copy link
Contributor Author

elcorto commented Mar 12, 2024

Thanks. I'm aware of the sharp edges and will test main along with main of all deps should problems arise.

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