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

jax.interpreters.xla.DeviceArray deprecated in jax 0.4.11 #533

Closed
tisabe opened this issue Jun 2, 2023 · 7 comments
Closed

jax.interpreters.xla.DeviceArray deprecated in jax 0.4.11 #533

tisabe opened this issue Jun 2, 2023 · 7 comments

Comments

@tisabe
Copy link

tisabe commented Jun 2, 2023

Hi all,
I noticed after updating jax to the newest version (0.4.11) I get an error during import of optax:

AttributeError: module 'jax.interpreters.xla' has no attribute 'DeviceArray'

After looking into the changelog of jax, it seems jax.interpreters.xla.DeviceArray is now deprecated and jax.Array should be used.

Edit: Seems hard to reproduce, I installed optax in a new virtual environment where it works fine. Still not working in the old venv.

@hbq1
Copy link
Collaborator

hbq1 commented Jun 6, 2023

Hi @tisabe, it must have been resolved in the latest versions of the optax's dependencies.
Let me close this issue for now, but feel free to re-open if you encounter this error again.

@hbq1 hbq1 closed this as completed Jun 6, 2023
@davzuliani
Copy link

Hi,
I'm sorry for reopening this issue, but I just encountered it.
What is the solution?

Thanks!

@tisabe
Copy link
Author

tisabe commented Jun 7, 2023

Hi @davzuliani
For me creating a fresh venv and installing the newest versions of jax and optax worked.

@davzuliani
Copy link

Hi @tisabe, thanks for the tip.
I guess I should go with venv, I just tried with conda env and it's still failing

@tisabe
Copy link
Author

tisabe commented Jun 7, 2023

Okay, I tracked down where the issue actually came from. Looks like the chex requirement should be updated to >=v0.1.6 or >=v0.1.7. After updating chex, this error should be fixed. @hbq1 should this be opened in a new issue?

@louieworth
Copy link

Hi, I also meet the same error when I am trying to save my model. Do you know how to solve it?

def save(self, save_path: str):
    os.makedirs(os.path.dirname(save_path), exist_ok=True)
    with open(save_path, 'wb') as f:
        f.write(flax.serialization.to_bytes(self.params))

JAX version: 0.4.12
JAXlib: 0.4.12

error track:

module 'jax.interpreters.xla' has no attribute 'DeviceArray'
  File "common.py", line 95, in save
    f.write(flax.serialization.to_bytes(self.params))
AttributeError: module 'jax.interpreters.xla' has no attribute 'DeviceArray'

@hbq1 hbq1 reopened this Jun 28, 2023
copybara-service bot pushed a commit that referenced this issue Dec 10, 2023
Fixes: #533
PiperOrigin-RevId: 589585670
copybara-service bot pushed a commit that referenced this issue Dec 11, 2023
Fixes: #533
PiperOrigin-RevId: 589585670
copybara-service bot pushed a commit that referenced this issue Dec 11, 2023
Fixes: #533
PiperOrigin-RevId: 589585670
copybara-service bot pushed a commit that referenced this issue Dec 11, 2023
Fixes: #533
PiperOrigin-RevId: 589585670
@bainro
Copy link

bainro commented Dec 30, 2023

pip install chex==0.1.7 --force-reinstall worked for me!

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 a pull request may close this issue.

5 participants