Skip to content

Commit c47d293

Browse files
committed
Added back only batch sharding
1 parent d92bf1d commit c47d293

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/maxdiffusion/models/wan/autoencoder_kl_wan.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,10 @@ def __call__(self, x: jax.Array, cache_x: Optional[jax.Array] = None, idx=-1) ->
134134
else:
135135
x_padded = x
136136

137-
137+
if self.mesh is not None:
138+
# (B, D, H, W, C)
139+
if x_padded.shape[0] % self.mesh.shape['data'] == 0:
140+
x_padded = with_sharding_constraint(x_padded, PartitionSpec('data', None, None, None, None))
138141

139142
out = self.conv(x_padded)
140143
return out

0 commit comments

Comments
 (0)