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

fixed order of parameters in stateless_apply in JAX distributed example #458

Merged
merged 5 commits into from
Jul 12, 2023
Merged
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
10 changes: 2 additions & 8 deletions examples/demo_jax_distributed.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,13 +157,7 @@ def make_model():
# data will be split along the batch axis
data_mesh = Mesh(devices, axis_names=("batch",)) # naming axes of the mesh
# naming axes of the sharded partition
data_sharding = NamedSharding(
data_mesh,
P(
"batch",
),
)

data_sharding = NamedSharding(data_mesh,P("batch",),)
# all variables will be replicated on all devices
var_mesh = Mesh(devices, axis_names=("_"))
# in NamedSharding, axes that are not mentioned are replicated (all axes here)
Expand Down Expand Up @@ -275,7 +269,7 @@ def train_step(train_state, x, y):
)

trainable_variables, optimizer_variables = optimizer.stateless_apply(
grads, train_state.trainable_variables, train_state.optimizer_variables
train_state.optimizer_variables, grads, train_state.trainable_variables
)

return loss_value, TrainingState(
Expand Down