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

Slightly update cookbook notebook to work with recent JAX versions. #288

Merged
merged 1 commit into from
Feb 17, 2024

Conversation

davmre
Copy link
Contributor

@davmre davmre commented Sep 14, 2023

The notebook raises exceptions with the current JAX version (0.4.14, as provided by Colab). This is fixed by making two trivial changes, after which the notebook runs without error:

  • Import stax and optimizers from jax.example_libraries instead of jax.experimental.
  • In plot_system, the color needs to be manually coerced to an onp.array (it is passed in the notebook as a list-of-DeviceArrays, which matplotlib chokes on).

(opening the notebook in Colab also seems to have removed some trailing whitespace, which clutters up the diff - apologies!)

The notebook raises exceptions with the current JAX version (0.4.14, as provided by Colab). This is fixed by making two trivial changes, after which the notebook runs without error:

- Import stax and optimizers from `jax.example_libraries` instead of `jax.experimental`.
- In `plot_system`, the color needs to be manually coerced to an `onp.array` (it is passed in the notebook as a list-of-DeviceArrays, which matplotlib chokes on).
@ekindogus
Copy link
Collaborator

Thank you!

@ekindogus ekindogus merged commit 03e6296 into jax-md:main Feb 17, 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.

None yet

2 participants