8000 Fix JAX deprecations by MarcBerneman · Pull Request #316 · jax-md/jax-md · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix JAX deprecations #316

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

Merged
merged 2 commits into from
Aug 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ pip install jax-md --upgrade
```
If you want to build the latest version then you can grab the most recent version from head,
```
git clone https://github.com/google/jax-md
git clone https://github.com/jax-md/jax-md
pip install -e jax-md
```
Or by using the following command,
Expand Down
11 changes: 5 additions & 6 deletions jax_md/tpu.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,8 @@
from jax import jit, vmap, grad, pmap
from jax import lax
from jax import random
from jax.experimental import maps
from jax.experimental import mesh_utils
from jax.sharding import PartitionSpec as P
from jax.experimental import mesh_utils, shard_map
from jax.sharding import PartitionSpec as P, Mesh

import jax.numpy as np
from jax.tree_util import tree_map, tree_flatten, tree_unflatten
Expand Down Expand Up @@ -448,7 +447,7 @@ def mesh_and_axes(topology):
labels = labels[:n]

devs = mesh_utils.create_device_mesh(topology)
mesh = maps.Mesh(devs, labels)
mesh = Mesh(devs, labels)
return mesh, P(*labels)


Expand All @@ -463,9 +462,9 @@ def parallelize(f: Callable, topology: Tuple[int]) -> Callable:
labels = labels[:n]

devs = mesh_utils.create_device_mesh(topology)
mesh = maps.Mesh(devs, labels)
mesh = Mesh(devs, labels)

return mesh(maps.xmap(
return mesh(shard_map(
f,
in_axes=labels + [...],
out_axes=labels + [...],
Expand Down
Loading
0