Skip to content
Open
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,10 @@ def __call__(
of [Imagen Paper](https://huggingface.co/papers/2205.11487). Guidance scale is enabled by setting
`guidance_scale > 1`.
fps (`int`, defaults to `16`):
The frames per second of the generated video.
The frames per second of the generated video. This is only a playback property used when saving the
output with e.g. [`export_to_video`]; it does not affect the denoising process. The released
Cosmos-Predict2 checkpoints were trained without FPS-conditioned RoPE, so `fps` is not passed to the
transformer.
num_videos_per_prompt (`int`, *optional*, defaults to 1):
The number of images to generate per prompt.
generator (`torch.Generator` or `list[torch.Generator]`, *optional*):
Expand Down Expand Up @@ -710,7 +713,6 @@ def __call__(
hidden_states=cond_latent,
timestep=cond_timestep,
encoder_hidden_states=prompt_embeds,
fps=fps,
condition_mask=cond_mask,
padding_mask=padding_mask,
return_dict=False,
Expand All @@ -729,7 +731,6 @@ def __call__(
hidden_states=uncond_latent,
timestep=uncond_timestep,
encoder_hidden_states=negative_prompt_embeds,
fps=fps,
condition_mask=uncond_mask,
padding_mask=padding_mask,
return_dict=False,
Expand Down
14 changes: 14 additions & 0 deletions tests/pipelines/cosmos/test_cosmos2_video2world.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,20 @@ def test_inference(self):
generated_slice = torch.cat([generated_slice[:8], generated_slice[-8:]])
assert_tensors_close(generated_slice, expected_slice, atol=1e-3)

def test_fps_does_not_change_generation(self):
# The released Cosmos-Predict2 checkpoints are trained without FPS RoPE modulation
# (`rope_enable_fps_modulation=False`), so the playback `fps` must not influence generation.
pipe = self.get_pipeline()

videos = []
for fps in (16, 24, 30):
inputs = self.get_dummy_inputs()
inputs["fps"] = fps
videos.append(pipe(**inputs).frames[0])

for video in videos[1:]:
assert (videos[0] - video).abs().max().item() == 0

def test_inference_batch_single_identical(self, batch_size=3, expected_max_diff=1e-2):
super().test_inference_batch_single_identical(batch_size=batch_size, expected_max_diff=expected_max_diff)

Expand Down
Loading