Skip to content

[bugfix] Wire Cosmos-Predict2.5 2B to its sampling preset#1468

Open
Mister-Raggs wants to merge 1 commit into
hao-ai-lab:mainfrom
Mister-Raggs:fix/cosmos25-2b-sampling-preset
Open

[bugfix] Wire Cosmos-Predict2.5 2B to its sampling preset#1468
Mister-Raggs wants to merge 1 commit into
hao-ai-lab:mainfrom
Mister-Raggs:fix/cosmos25-2b-sampling-preset

Conversation

@Mister-Raggs

Copy link
Copy Markdown
Contributor

Summary

The Cosmos-Predict2.5 2B registry entry (KyleShao/Cosmos-Predict2.5-2B-Diffusers) was missing model_family / default_preset, so SamplingParam.from_pretrained found no preset and fell back to the generic default (guidance_scale=1.0, i.e. no CFG) — producing blurry output. This points it at the existing cosmos25_predict2_2b preset (guidance_scale=7.0, num_inference_steps=35) — the same wiring the 14B entry already uses.

Root cause

In fastvideo/registry.py, the 14B Cosmos-2.5 entry sets model_family="cosmos25" and default_preset="cosmos25_predict2_2b", but the 2B entry set neither. So get_preset_selection() returned no preset for the 2B path and from_pretrained silently used library defaults (guidance_scale=1.0). The correct preset already existed in fastvideo/pipelines/basic/cosmos/presets.py — it just wasn't connected for the 2B model.

Fix

Two lines: add model_family="cosmos25" + default_preset="cosmos25_predict2_2b" to the 2B entry. Pure registry config — platform-independent.

Test

  • Adds test_cosmos25_2b_path_resolves_to_preset to fastvideo/tests/api/test_presets.py, asserting the 2B model path resolves to guidance_scale=7.0 / num_inference_steps=35 (runs in the existing fastvideo/tests/api unit suite). The prior tests covered preset existence but not model-path resolution, which is the gap that allowed this.
  • Empirical: on an NVIDIA GB10, the default guidance_scale=1.0 produced blurry text-to-world output (mean per-frame Laplacian-variance sharpness ~92). Re-running with guidance_scale=7.0 restored sharpness to ~431, matching known-good Wan clips. This change makes 7.0 the default, so no manual override is needed.

Copilot AI review requested due to automatic review settings June 16, 2026 22:25
@mergify mergify Bot added type: bugfix Bug fix scope: infra CI, tests, Docker, build labels Jun 16, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Fixes Cosmos-Predict2.5 2B Hugging Face path resolution so it selects the cosmos25 default preset (ensuring expected sampling params) instead of falling back to generic defaults.

Changes:

  • Assign model_family="cosmos25" and default_preset="cosmos25_predict2_2b" for the Cosmos 2.5 (2B) detector registration.
  • Add a regression test asserting SamplingParam.from_pretrained() resolves the 2B path to the expected cosmos25 preset values.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
fastvideo/tests/api/test_presets.py Adds regression coverage ensuring the 2B model path resolves to the cosmos25 preset.
fastvideo/registry.py Sets the cosmos25 model family and default preset for Cosmos 2.5 (2B) model detection.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread fastvideo/tests/api/test_presets.py Outdated
Comment on lines +468 to +470
"""Regression: the Cosmos-Predict2.5 2B model path must select the
cosmos25 preset (guidance_scale=7.0), not fall back to the generic
default (guidance_scale=1.0) which produced blurry output."""

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request configures the Cosmos 2.5 (2B) model in the registry by specifying its model family as "cosmos25" and its default preset as "cosmos25_predict2_2b". It also adds a regression test to ensure that the Cosmos-Predict2.5 2B model path correctly resolves to the expected preset instead of falling back to a generic default. There are no review comments, and I have no feedback to provide.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@mergify

mergify Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Merge Protections

Your pull request matches the following merge protections and will not be merged until they are valid.

🟠 PR merge requirements

Waiting for

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

The 2B registry entry (KyleShao/Cosmos-Predict2.5-2B-Diffusers) was missing
`model_family` / `default_preset`, so `SamplingParam.from_pretrained` found no
preset and fell back to the generic default (guidance_scale=1.0, no CFG),
producing blurry output. Point it at the existing `cosmos25_predict2_2b` preset
(guidance_scale=7.0, num_inference_steps=35) — the same wiring the 14B entry
already uses. Add a regression test asserting the 2B path resolves to the preset.

Verified on an NVIDIA GB10: the default guidance_scale=1.0 produced blurry
text-to-world output (mean frame Laplacian-variance sharpness ~92); rerunning
with guidance_scale=7.0 restored sharpness to ~431, matching known-good Wan
clips. This fix makes that the default, so no manual override is needed.
@Mister-Raggs Mister-Raggs force-pushed the fix/cosmos25-2b-sampling-preset branch from e96c300 to 0e62620 Compare June 17, 2026 20:16

@SolitaryThinker SolitaryThinker left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @Mister-Raggs — automated review from Gob, one of @SolitaryThinker's AI reviewers. Findings aren't all human-verified; ping @SolitaryThinker if anything looks off.

Verdict: APPROVE — correct, minimal, tested. Open PR, +14/-0.

Verified the fix end-to-end:

  • Bug is real on main. The 2B register_configs(...) (fastvideo/registry.py:602-618 on base) ended at model_detectors with no model_family/default_preset, so get_preset_selection returned (None, None) and from_pretrained fell back to cls() defaults (guidance_scale=1.0, num_inference_steps=50) — matching the "blurry, no CFG" symptom.
  • Fix routes correctly. KyleShao/Cosmos-Predict2.5-2B-Diffusers is in hf_model_paths, so _get_config_info returns the 2B entry via the exact-path match (registry.py:180-183) — no detector/network — now carrying model_family="cosmos25" + default_preset="cosmos25_predict2_2b".
  • Preset values match intent. cosmos25_predict2_2b = guidance_scale=7.0, num_inference_steps=35 (fastvideo/pipelines/basic/cosmos/presets.py:78-79); identical to the test asserts. __post_init__ only sets data_type, so it doesn't clobber them.
  • No other variant affected. The 2B detector excludes "14b"; the 14B path is exact-matched by its own entry and already had both kwargs — unchanged.
  • Test runs in CI (not just collected). run_unit_test runs pytest ./fastvideo/tests/api/ ...; the microscope-unit-tests leg is green, so test_cosmos25_2b_path_resolves_to_preset passed. It's offline-safe (exact-path match short-circuits before any download).

The regression test closes the actual gap (prior tests checked preset existence, not model-path resolution).

NIT (non-blocking, pre-commit owns it): fastvideo/tests/api/test_presets.py:472 — docstring closing """ shares the last line (copilot noted this too).

Context for a maintainer, not a finding against this PR: the 14B entry's default_preset is also cosmos25_predict2_2b (a 2B-named preset on the 14B model) — pre-existing on main, untouched here; may be intentional preset sharing or a latent naming smell.

— Gob (@SolitaryThinker's AI reviewer).

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

Labels

scope: infra CI, tests, Docker, build type: bugfix Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants