Skip to content

Cosmos2VideoToWorldPipeline applies FPS RoPE modulation that the released Cosmos-Predict2 checkpoints disable natively (default fps=16 → temporal RoPE ×1.5) #14768

Open

Description

@rebel-seinpark

Describe the bug

CosmosRotaryPosEmbed scales its temporal frequencies by FPS whenever fps is not None:

https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/transformers/transformer_cosmos.py#L505-L512

if fps is None:
    emb_t = torch.outer(seq[: pe_size[0]], temporal_freqs)
else:
    emb_t = torch.outer(seq[: pe_size[0]] / fps * self.base_fps, temporal_freqs)  # base_fps = 24

and Cosmos2VideoToWorldPipeline always feeds it — fps: int = 16 by default:

https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/cosmos/pipeline_cosmos2_video2world.py#L498
https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/cosmos/pipeline_cosmos2_video2world.py#L713

However, in the reference implementation this modulation sits behind an enable_fps_modulation
flag, and the released Cosmos-Predict2 checkpoints ship with it turned off:

So natively these models use raw integer temporal RoPE positions and ignore FPS entirely,
while the diffusers port has no such flag and, with the pipeline default fps=16 against
base_fps=24, runs every denoising step with temporal RoPE positions stretched by
24/16 = 1.5× relative to how the checkpoints were trained. We traced this while
investigating consistently odd motion in default Video2World outputs.

Consequences with the current defaults:

  • Every default Cosmos2VideoToWorldPipeline run diverges from the reference implementation.
  • The fps argument changes the generated content in diffusers, whereas natively it only
    affects the exported container framerate.

Not affected:

  • Cosmos2TextToImagePipeline — single frame, so the temporal position is 0 either way.
  • Cosmos2_5_PredictBasePipeline / Cosmos2_5_TransferPipeline — they don't take an fps
    argument, so the transformer sees fps=None and uses raw positions, matching the native
    configs (which also disable the modulation).
  • The Cosmos-Predict1 pipelines are out of scope here; this report is only about the
    Cosmos-Predict2 checkpoints.

Suggested fix

Either of:

  1. Port enable_fps_modulation into CosmosTransformer3DModel's config (default False for
    the converted Cosmos-Predict2 checkpoints), mirroring the reference nets — the faithful fix; or
  2. Stop passing fps to the transformer in Cosmos2VideoToWorldPipeline (or change the
    default to fps=24, which makes the scale factor 1), keeping fps for video export only.

Reproduction

import torch
from diffusers import Cosmos2VideoToWorldPipeline
from diffusers.utils import load_image

pipe = Cosmos2VideoToWorldPipeline.from_pretrained(
    "nvidia/Cosmos-Predict2-2B-Video2World", torch_dtype=torch.bfloat16
).to("cuda")

image = load_image(
    "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/yellow-scrubber.png"
)

# identical seeds, only fps differs — natively these would be identical, here they are not
common = dict(image=image, prompt="a yellow scrubber cleaning a plate")
video_16 = pipe(**common, fps=16, generator=torch.Generator().manual_seed(1)).frames[0]
video_24 = pipe(**common, fps=24, generator=torch.Generator().manual_seed(1)).frames[0]
# video_24 corresponds to the un-modulated (native) temporal RoPE; video_16 is the default

Logs

System Info

  • diffusers: main (also reproduces on 0.38.0)
  • the referenced code is identical on current main (line links above)

Who can help?

@a-r-r-o-w @yiyixuxu

Activity

  1. added
    bug
    on Sep 14, 2026
  2. L4XB commented on Sep 15, 2026

    @L4XB

    Reproduced, and I have a branch ready. Asking for an ack before opening a PR, per CONTRIBUTING.

    What I verified. The scale factor is real and it is exactly the 1.5x you describe.
    base_fps is 24 for every converted Cosmos checkpoint — scripts/convert_cosmos_to_diffusers.py
    never sets it, so they all take the class default — and fps reaches CosmosRotaryPosEmbed from
    Cosmos2VideoToWorldPipeline and nowhere else in that file. On the repo's own dummy components:

    |cos(fps=None) - cos(fps=16)| max = 0.573846      # embedding level, 3 latent temporal positions
    |cos(fps=None) - cos(fps=24)| max = 0.000000      # scale factor 1
    
    |frames(fps=16) - frames(fps=24)| max = 0.082353  # end to end, same seed, main @ 759164b
    |frames(fps=16) - frames(fps=30)| max = 0.082353
    

    So fps changes the generated content on main, which it should not.

    The strongest argument is one the issue does not make: within the Predict2 family this pipeline is
    the odd one out.
    Of the six pipelines that build a CosmosTransformer3DModel, exactly three pass
    fps into it:

    pipeline family passes fps=fps
    pipeline_cosmos_text2world.py Predict1 yes (x2)
    pipeline_cosmos_video2world.py Predict1 yes (x2)
    pipeline_cosmos2_video2world.py Predict2 yes (x2)
    pipeline_cosmos2_text2image.py Predict2 no
    pipeline_cosmos2_5_predict.py Predict2.5 no
    pipeline_cosmos2_5_transfer.py Predict2.5 no

    The split is clean along family lines everywhere except this one file. Predict1 is trained with the
    modulation and should keep it; the rest of Predict2 already does not apply it. That reads as an
    oversight carried over when the Predict2 pipeline was written from the Predict1 one, not as a
    deliberate choice.

    Scope I propose: option 2, and I would like to talk you out of option 1. Stop passing fps into
    the transformer from Cosmos2VideoToWorldPipeline; keep the argument as the playback property it is
    upstream. I do not think the enable_fps_modulation config flag can work here, for two reasons:

    1. No published nvidia/Cosmos-Predict2-* config can contain a key that does not exist in the class
      today, so register_to_config hands every released checkpoint the default. Whatever that default
      is, it is the only value any of them would ever see — the flag would carry no per-checkpoint
      information.
    2. CosmosTransformer3DModel is shared with Cosmos-Predict1, which needs the opposite value —
      cosmos-predict1's position_embedding.py has no such flag and always applies
      self.seq[:T] / fps * self.base_fps. Default True leaves this bug; default False silently
      breaks Predict1.

    To be fair to option 1: that flag does already exist in this repo, on
    CosmosTransformer3DModel's Cosmos3 sibling (transformer_cosmos3.py:404,
    enable_fps_modulation: bool = True, read by pipeline_cosmos3_omni.py). So the precedent is
    there, and I want to be explicit that I am arguing against it rather than pretending it does not
    exist. The difference is that Cosmos3 checkpoints ship a config that can set the key, and the
    already-published Predict2 checkpoints cannot: whatever default CosmosTransformer3DModel picked
    would be the only value any of them ever saw, on a class that also serves Predict1 with the
    opposite requirement.

    The pipeline class already encodes the model family, so that is where the difference belongs. This
    also stays on the right side of .ai/references/code_style.md, which says not to add "configuration
    options 'just in case'". (Changing the default to fps=24 fixes only the default and
    leaves an explicit fps=16 still stretching the RoPE.)

    Branch is ready. Two fps=fps lines removed, the parameter docstring rewritten, one test added.

    tests/pipelines/cosmos/…::test_fps_does_not_change_generation   # fps 16/24/30 must be identical
      main @ 759164b : FAILED — Max diff: 8.235294e-02 at index (8, 2, 17, 1)
      branch         : 1 passed
    
    pytest tests/pipelines/cosmos/ tests/models/transformers/test_models_transformer_cosmos.py
      main @ 759164b : 45 failed, 207 passed, 76 skipped, 4 xfailed, 10 errors
      branch         : 45 failed, 208 passed, 76 skipped, 4 xfailed, 10 errors
    

    Identical failure sets on both sides (55 entries, diffed); the extra pass is the new test.
    test_inference's golden slice still passes untouched — the 16 sampled elements happen to be
    unaffected, so please read that as coincidence rather than as the change being inert.

    Worth being explicit that this changes the output of every default Cosmos2VideoToWorldPipeline
    run
    : on the branch, fps=16 reproduces bit-for-bit what fps=24 produced before, which is the
    un-modulated temporal RoPE the checkpoints were trained with. I have no access to the gated
    Cosmos-Predict2 repos, so everything above is on dummy components and the RoPE embeddings directly.

    May I open it?

  3. rebel-seinpark commented on Sep 28, 2026

    @rebel-seinpark
    Author

    @L4XB Sure. Please open it.

  4. yiyixuxu commented on Dec 2, 2026

    @yiyixuxu
    Collaborator

    @L4XB @rebel-seinpark
    sorry i'm bit late to see this and thanks for waiting for our feedbacks
    feel free to open the PR if you're still interested in contributing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmodelsneeds-env-infopipelines

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions