Skip to content

Commit 647bdce

Browse files
committed
test: dynamically scale LTX2 sequence length based on device count
1 parent 51fe554 commit 647bdce

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

src/maxdiffusion/tests/ltx2/test_transformer_ltx2.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -173,14 +173,15 @@ def test_kv_cache_rejects_timestep_modulated_prompt_embeddings(self):
173173
def test_kv_cache_matches_uncached_output_with_and_without_layer_scan(self):
174174
"""Layer-scanned KV inputs must be equivalent to normal cross-attention projections."""
175175
batch_size = 1
176-
num_frames, height, width = 2, 2, 2
177-
audio_num_frames = 4
176+
seq_len = jax.device_count()
177+
num_frames, height, width = seq_len, 2, 2
178+
audio_num_frames = seq_len
178179
video_dim, audio_dim, caption_dim = 64, 64, 32
179180
hidden_states = jnp.ones((batch_size, num_frames * height * width, 8), dtype=jnp.float32)
180181
audio_hidden_states = jnp.ones((batch_size, audio_num_frames, 4), dtype=jnp.float32)
181-
encoder_hidden_states = jnp.ones((batch_size, 4, caption_dim), dtype=jnp.float32)
182-
audio_encoder_hidden_states = jnp.ones((batch_size, 4, caption_dim), dtype=jnp.float32)
183-
attention_mask = jnp.ones((batch_size, 4), dtype=jnp.float32)
182+
encoder_hidden_states = jnp.ones((batch_size, seq_len, caption_dim), dtype=jnp.float32)
183+
audio_encoder_hidden_states = jnp.ones((batch_size, seq_len, caption_dim), dtype=jnp.float32)
184+
attention_mask = jnp.ones((batch_size, seq_len), dtype=jnp.float32)
184185

185186
for scan_layers in (False, True):
186187
with self.subTest(scan_layers=scan_layers), self.mesh, nn_partitioning.axis_rules(self.config.logical_axis_rules):

0 commit comments

Comments
 (0)