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

AttributeError: module 'jax._src.random' has no attribute 'KeyArray' #388

Open
dominikstrb opened this issue Jan 10, 2025 · 2 comments
Open

Comments

@dominikstrb
Copy link
Contributor

dominikstrb commented Jan 10, 2025

After pip-installing dynamax into a fresh virtualenv with Python 3.12.7, I get an AttributeError: module 'jax._src.random' has no attribute 'KeyArray' when importing LinearGaussianSSM from dynamax.linear_gaussian_ssm.

The reason seems to be that dynamax.types defines PRNGKey = prng.KeyArray and jax.random has removed KeyArray in version 0.4.24.

I have not been able to find a constellation of jax versions that works because version 0.4.23 does not seem to be compatible with scipy>=1.6.0 because 'scipy.linalg' has no attribute 'tril'.

Proposed solution:
Either the requirements for dynamax need to define concrete versions of jax, scipy (and possibly other dependencies) that work with the current codebase, or the type PRNGKey needs to be redefined in dynamax.types (although I cannot judge to what extent what part of dynamax relies on that type.

@dominikstrb
Copy link
Contributor Author

I was able to get it working by installing the following versions:

  • scipy <=1.12.0,>= 1.6.0
  • jax==0.4.23
  • jaxlib==0.4.23
  • optax==0.2.2
  • chex==0.1.86

@gileshd
Copy link
Collaborator

gileshd commented Jan 10, 2025

Hi @dominikstrb!

Apologies for this problem. There is actually an open PR, #379, which updates the PRNGKey code to work with the JAX updates - we are hoping to get this merged soon.

In the meantime installing directly from that branch should do the trick and avoid having to pin jax==0.4.23.

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