Skip to content

Commit ac8f984

Browse files
committed
Sharding across width
1 parent c47d293 commit ac8f984

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/maxdiffusion/models/wan/autoencoder_kl_wan.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,9 @@ def __call__(self, x: jax.Array, cache_x: Optional[jax.Array] = None, idx=-1) ->
137137
if self.mesh is not None:
138138
# (B, D, H, W, C)
139139
if x_padded.shape[0] % self.mesh.shape['data'] == 0:
140-
x_padded = with_sharding_constraint(x_padded, PartitionSpec('data', None, None, None, None))
140+
x_padded = with_sharding_constraint(x_padded, PartitionSpec('data', None, None, 'fsdp', None))
141+
else:
142+
x_padded = with_sharding_constraint(x_padded, PartitionSpec(None, None, None, 'fsdp', None))
141143

142144
out = self.conv(x_padded)
143145
return out

0 commit comments

Comments
 (0)