@@ -1312,11 +1312,10 @@ def __call__(
13121312
13131313 def apply_block (block , context : LTX2BlockContext , mask ):
13141314 orig_perturbation_mask = context .perturbation_mask
1315- context = dataclasses .replace (context , perturbation_mask = mask )
1315+ context = context .replace (perturbation_mask = mask )
13161316 with jax .named_scope ("Transformer Layer" ):
13171317 hidden_states_out , audio_hidden_states_out = block (context )
1318- context = dataclasses .replace (
1319- context ,
1318+ context = context .replace (
13201319 hidden_states = hidden_states_out .astype (context .hidden_states .dtype ),
13211320 audio_hidden_states = audio_hidden_states_out .astype (context .audio_hidden_states .dtype ),
13221321 perturbation_mask = orig_perturbation_mask ,
@@ -1343,6 +1342,7 @@ def scan_fn_ltx2(carry, block):
13431342 length = self .num_layers ,
13441343 in_axes = (nnx .Carry , 0 ),
13451344 out_axes = (nnx .Carry , 0 ),
1345+ transform_metadata = {nnx .PARTITION_NAME : "layers" },
13461346 )(carry , self .transformer_blocks )
13471347 hidden_states = final_context .hidden_states
13481348 audio_hidden_states = final_context .audio_hidden_states
@@ -1378,6 +1378,7 @@ def scan_fn_ltx23(carry, block_and_mask):
13781378 length = self .num_layers ,
13791379 in_axes = (nnx .Carry , 0 ),
13801380 out_axes = (nnx .Carry , 0 ),
1381+ transform_metadata = {nnx .PARTITION_NAME : "layers" },
13811382 )(carry , (self .transformer_blocks , perturbation_mask_per_layer ))
13821383 hidden_states = final_context .hidden_states
13831384 audio_hidden_states = final_context .audio_hidden_states
0 commit comments