Skip to content

[feat]: Add Cosmos Predict (Cosmos 2.5) Model Port and Staged Pipeline - #1773

Draft
techverve wants to merge 8 commits into
hao-ai-lab:mainfrom
techverve:feat/cosmos-predict-pipeline
Draft

[feat]: Add Cosmos Predict (Cosmos 2.5) Model Port and Staged Pipeline#1773
techverve wants to merge 8 commits into
hao-ai-lab:mainfrom
techverve:feat/cosmos-predict-pipeline

Conversation

@techverve

Copy link
Copy Markdown

Purpose

Fixes #

Changes

Test Plan

# Commands you ran

Test Results

Test output
# Paste output here

Checklist

  • I ran pre-commit run --all-files and fixed all issues
  • I added or updated tests for my changes
  • I updated documentation if needed
  • I considered GPU memory impact of my changes

For model/pipeline changes, also check:

  • I verified SSIM regression tests pass
  • I updated the support matrix if adding a new model

@mergify mergify Bot added type: feat New feature or capability scope: inference Inference pipeline, serving, CLI scope: infra CI, tests, Docker, build scope: model Model architecture (DiTs, encoders, VAEs) labels Aug 28, 2026
@mergify

mergify Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Merge Protections

🔴 1 of 1 protections blocking · waiting on 👀 reviews and 🤖 CI

Protection Waiting on
🔴 PR merge requirements 👀 reviews and 🤖 CI

🔴 PR merge requirements

Waiting for

  • #approved-reviews-by>=1
  • check-success=fastcheck-passed
  • check-success=full-suite-passed
  • check-success~=pre-commit
This rule is failing.
  • #approved-reviews-by>=1
  • check-success=fastcheck-passed
  • check-success=full-suite-passed
  • check-success~=pre-commit
  • title~=(?i)^\[(feat|feature|bugfix|fix|refactor|perf|ci|doc|docs|misc|chore|kernel|new.?model|skill|skills|infra)\]

@Satyam-53

Copy link
Copy Markdown
Collaborator

Summary

This ports NVIDIA's Cosmos Predict (Cosmos 2.5) T2V/I2V model into FastVideo: a new VAE (cosmos25_official_vae.py), a Qwen2.5-VL-based text encoder wrapper, a small extension to Cosmos25Transformer3DModel (optional condition-mask channel), a new CosmosPredictPipeline, configs/presets, registry wiring for two checkpoints (7B/14B), and a set of local parity tests + PORT_STATUS.md.

Nice groundwork on the component-level parity tests (VAE/text-encoder/transformer), but I don't think this is mergeable as-is — I found three bugs that mean the pipeline can't have been run end-to-end yet (and the PR's own PORT_STATUS.md confirms that: Full Pipeline Integration, Checkpoint Conversion, and SSIM/E2E are all unchecked).


🔴 Blocking issues

1. presets.py imports a class that doesn't exist

# fastvideo/pipelines/basic/cosmos_predict/presets.py
from fastvideo.configs.pipelines.base import PipelinePreset

fastvideo/configs/pipelines/base.py only defines PipelineConfig. PipelinePreset doesn't exist anywhere in the repo (confirmed via full grep). Importing this module raises ImportError.

2. The new presets are never registered, so lookups fail at runtime

registry.py::_register_presets() populates the real preset registry (fastvideo.api.presets._PRESET_REGISTRY) from a hard-coded list of per-family ALL_PRESETS imports. This PR never adds cosmos_predict to that list, and the new presets.py doesn't even export an ALL_PRESETS (which is also why bug #1 hasn't blown up yet — it's dead code).

Meanwhile _register_configs() wires up:

default_preset="cosmos_predict_preset",     # never registered
default_preset="cosmos_predict_14b_preset", # never registered

So SamplingParam.from_pretrained("nvidia/Cosmos-1.0-Prompt2World-7B-Video")get_preset("cosmos_predict_preset", "cosmos_predict")ConfigValidationError: unknown preset.... This is the very first call made in test_cosmos_predict_pipeline_parity.py.

3. Latent temporal dimension isn't downsampled

# CosmosPredictLatentPreparationStage.forward()
b, c, t, h, w = batch.batch_size, 16, batch.num_frames, batch.height, batch.width
# Patching size downsampling
t = t
h = h // 8
w = w // 8

The ported VAE declares temporal_compression_ratio: int = 8 (the "CV8x8x8" tokenizer), same as spatial_compression_ratio: int = 8 which is applied to h/w. t = t is a no-op — with num_frames = 93 from the preset, the latent temporal dim ends up ~8x too large vs. what the transformer/decoder expect.

These three together strongly suggest the pipeline has never been run end-to-end. Supporting evidence:

  • test_cosmos_predict_pipeline_parity.py is unconditionally @pytest.mark.skip(reason="Needs Cosmos Predict 7B weights...").
  • test_cosmos_predict_pipeline_smoke.py's entire body is an unused FastVideoArgs(...), a comment saying "we would load the pipeline and run 1 step, but... since this is just a smoke test for architecture, we pass", and a trivial assert CosmosPredictPipeline is not None.
  • PORT_STATUS.md: strict_load_status: not_run, Full Pipeline Integration / Checkpoint Conversion / SSIM-E2E all unchecked.

🟠 Scope / process concerns

Unrelated registry entry bundled in. Right above the Cosmos Predict block, this PR also adds:

register_configs(
    pipeline_config_cls=CosmosConfig,
    hf_model_paths=["nvidia/Cosmos-1.0-Autoregression-7B-Video"],
    ...
    default_preset="cosmos_ar_7b",
)

"cosmos_ar_7b" isn't defined anywhere either (cosmos/presets.py only has cosmos_predict2_2b / cosmos25_predict2_2b), and reusing the diffusion CosmosConfig for an autoregressive model seems off architecturally. Looks like stray/leftover code — worth dropping or explaining in a separate PR.

New SSIM test has no reference assets and isn't skip-gated. fastvideo/tests/ssim/test_cosmos_predict_similarity.py (the CI-tracked SSIM dir, not tests/local_tests/) isn't skip-marked, but there's no reference_videos/.../cosmos_predict checked in anywhere in this diff. If CI runs this on GPU it looks like it'll fail (setting aside that the preset bug kills it first).

Framing mismatch. This reads as output of an automated "add-model" agent workflow (PORT_STATUS.md's owner: parity / handoff-notes format, README.md's reference to .agents/skills/add-model-01-prep/...), which is fine, but it's wired into the global registry with real HF paths as if ready for use while its own status doc says integration/E2E/checkpoint-conversion aren't done. Suggest marking draft or scoping down to the parity-verified components until the pipeline runs once successfully.


🟡 Nits

  • fastvideo/models/encoders/cosmos_predict_text_encoder.py is missing the # SPDX-License-Identifier: Apache-2.0 header present in the other new files.
  • No __init__.py in fastvideo/pipelines/basic/cosmos_predict/, unlike sibling pipeline packages.
  • In CosmosPredictTextEncodingStage.forward():
  subfolder="tokenizer" if "tokenizer" in fastvideo_args.model_paths else None

Since fastvideo_args.model_paths["tokenizer"] is already used on the line above (so the key must exist), the else branch is dead — this doesn't do what it looks like it's meant to do.

  • Trailing whitespace on several lines in pipeline_cosmos_predict.py (likely to trip pre-commit/ruff).
  • torch.randn(..., dtype=target_dtype) generates noise directly in bf16 rather than fp32-then-cast; may not match reference numerics exactly.
  • CosmosPredictLatentPreparationStage builds batch.cond_mask even though CosmosPredictConfig sets use_condition_mask=False (so the DiT never consumes it) — harmless but confusing given the accompanying comment.

✅ What's solid

  • Cosmos25Transformer3DModel's new use_condition_mask toggle (defaulting True) is a clean, backward-compatible extension for existing Cosmos-2.5 usage.
  • VAE port retains proper NVIDIA/HuggingFace attribution.
  • The component-level parity tests (VAE, text encoder, transformer block) are real GPU-gated comparisons against the official implementation, not placeholders — good groundwork, just not yet wired together correctly.

Requesting changes:

  1. Fix the PipelinePreset import and actually register cosmos_predict presets in _register_presets().
  2. Fix the temporal latent-shape bug in CosmosPredictLatentPreparationStage.
  3. Drop (or justify in a separate PR) the unrelated cosmos_ar_7b / Autoregression registry entry.
  4. Get the smoke/pipeline-parity tests to actually execute (even at low res) before merge, or explicitly mark this draft until they do.

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

Labels

scope: inference Inference pipeline, serving, CLI scope: infra CI, tests, Docker, build scope: model Model architecture (DiTs, encoders, VAEs) type: feat New feature or capability

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants