Skip to content

feat: config-driven sampling step count for cosmos3 worker#24

Merged
Johan-de-R merged 3 commits into
mainfrom
johan/cosmos3-num-steps
Jul 15, 2026
Merged

feat: config-driven sampling step count for cosmos3 worker#24
Johan-de-R merged 3 commits into
mainfrom
johan/cosmos3-num-steps

Conversation

@Johan-de-R

Copy link
Copy Markdown

What

Adds a configurable denoising-step count to the Cosmos3 videogen worker:

  • COSMOS3_NUM_STEPS env (set via model-config extra_env) → default step count, tunable without an image rebuild.
  • nvext.num_steps → per-request override.
  • Unset → falls back to the framework's per-modality default (35).

Wired into all three payload paths (dynamo _generate_blocking, standalone create_video, and the OmniSampleOverrides passthrough).

Why

Fewer sampling steps is the one in-house, no-post-training cost lever for Cosmos3 video — the UniPC sampling loop is ~94% of per-clip latency. This makes step count a config knob so we can dial cost/quality per model without rebuilding.

Testing

Step-sweep on a reserved 1×B200 (720p / 5s, Nano), latency scaled cleanly and monotonically with steps:

steps 35 28 20 16 12 8
latency 64s 53s 40s 34s 27s 21s

Sampler logs confirmed the requested step count was applied per gen. 28 matches fal's API default and was visually indistinguishable from 35.

Rollout

Nano → fw-v6 (thin overlay = fw-v5 + this worker.py) + extra_env COSMOS3_NUM_STEPS=28, make-before-break. Super pending its own quality sweep.

🤖 Generated with Claude Code

Add COSMOS3_NUM_STEPS env (set via model-config extra_env) as the default
denoising-step count, plus a per-request nvext.num_steps override. Lets us tune
step count without an image rebuild. Falls back to the framework's per-modality
default (35) when unset.

Motivation: fewer steps is the one in-house, no-post-training cost lever for
Cosmos3 video (sampling loop is ~94% of latency). Step-sweep on a reserved B200
(720p/5s Nano) confirmed clean latency scaling: 35=64s, 28=53s, 20=40s, 16=34s,
12=27s, 8=21s. 28 matches fal's default and looked visually identical to 35.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions github-actions Bot added the feat label Jul 15, 2026
Johan-de-R and others added 2 commits July 15, 2026 21:44
Address adversarial review of the num_steps change:
- Apply the default step count to VIDEO only (num_frames > 1). text2image
  defaults to 50 steps; the previous version silently forced it to the video
  value, an unvalidated quality cut on a live t2i path. Image modes now keep
  their framework default; explicit nvext.num_steps still overrides either.
- Parse COSMOS3_NUM_STEPS defensively (non-int / <=0 -> warn + ignore) instead
  of int() at import, which would crash the worker fleet-wide on a bad value.
- Keep all lines within the repo's 88-char limit.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@Johan-de-R
Johan-de-R merged commit dbe7b91 into main Jul 15, 2026
13 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant