feat: config-driven sampling step count for cosmos3 worker#24
Merged
Conversation
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>
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a configurable denoising-step count to the Cosmos3 videogen worker:
COSMOS3_NUM_STEPSenv (set via model-configextra_env) → default step count, tunable without an image rebuild.nvext.num_steps→ per-request override.Wired into all three payload paths (dynamo
_generate_blocking, standalonecreate_video, and theOmniSampleOverridespassthrough).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:
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