perf(inference): skip the generation tower and video guardrail for reasoner-only runs - #146
Open
lfengad wants to merge 4 commits into
Open
perf(inference): skip the generation tower and video guardrail for reasoner-only runs#146lfengad wants to merge 4 commits into
lfengad wants to merge 4 commits into
Conversation
Reasoner-only inference never runs the MoT generation tower, so it can leave the ten *_moe_gen modules unbuilt. dcp.load is pull-based, so a model built without them also never reads their tensors off disk. The flag defaults to True at every level, leaving all existing callers and the training path unchanged. _impl_forward asserts the pathway is present so a misconfigured generative run fails loudly instead of on a missing attribute. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Signed-off-by: liang.feng <liangf@nvidia.com>
The video runner only holds RetinaFace (~109 MB, fp32) and is only reached by generative samples, so reasoner-only runs can skip building it entirely. video_guardrail lives on GuardrailArgs rather than GuardrailOverrides so it never becomes a CLI flag: a user-facing switch that disables face blurring on generative runs would be a safety footgun. It is excluded from model_dump() because SetupArgs dumps must round-trip through SetupOverrides, which forbids extra keys. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Signed-off-by: liang.feng <liangf@nvidia.com>
…runs Extends the reasoner-only hook added in #132 from the generation VAE to the whole generation side: the MoT generation tower (include_gen_pathway), the VFM-level generation heads (vision_gen), and the video guardrail runner. On Cosmos3-Edge this leaves ~3.4 GiB/GPU unallocated (VAE 1.31 + MoT tower 1.97 + VFM heads 0.03 + RetinaFace 0.10) and avoids a ~2.6 GiB cold-cache download of Wan2.2_VAE.pth. The three config flags are orthogonal and each defaults to the generation-enabled value, so dropping any one entry from reasoner_only_overrides degrades to the previous behaviour for that module alone. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Signed-off-by: liang.feng <liangf@nvidia.com>
…tion
Cosmos3VFMNetworkConfig asserts that action and sound generation each imply
vision generation. Edge checkpoints ship with action_gen=true, so overriding
vision_gen alone aborted model construction:
AssertionError('Action generation requires visual generation!
We do NOT support action only training!')
Found by the first real reasoner run on GB200; unit tests could not catch it
because they assert on module construction, not on config-invariant coherence.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: liang.feng <liangf@nvidia.com>
lfengad
marked this pull request as ready for review
July 30, 2026 10:24
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.
Extends the reasoner-only hook added in #132 from the generation VAE to the rest of
the generation side. On Cosmos3-Edge this leaves 2.757 GiB/GPU (−36%) unallocated
for reasoner inference, with byte-identical output.
What is skipped
*_moe_genmodules (newinclude_gen_pathway)time_embedder,proj_in/out,action_*(existingvision_gen/action_gen/sound_gen)include_video)Measured residency audit accounts for the full delta: 2.65 (net) + 0.10 (RetinaFace)
= 2.75 GiB, matching the 2.757 GiB observed end-to-end.
Why no weight-loading changes were needed
dcp.loadis pull-based — it requests only the keys the live model exposes(
get_model_state_dict(model.model)), so a model built without the*_moe_genmodules never reads their tensors off disk. Verified on a real Edge checkpoint: no
missing/unexpected key errors. This was an assumption at design time; it was
confirmed on hardware before relying on it.
Defaults are inert
All four flags default to the generation-enabled value (
load_vision_tokenizer,vision_gen/action_gen/sound_gen,include_gen_pathway,video_guardrail).The only behavioural trigger is
is_reasoner_only(...)inscripts/inference.py,which requires a non-empty, all-reasoner sample list. Mixed batches, empty lists,
Ray serve, and the action policy servers are unaffected.
In the default path the only executed change is two always-true assertions (one in
_impl_forward, one in_run_video_guardrail) that turn a would-beAttributeErroron a misconfigured run into an explanatory failure.The three model-config overrides are orthogonal and each degrades gracefully:
dropping any one entry from
reasoner_only_overrides()restores the previousbehaviour for that module alone.
Verification (4× GB200, Cosmos3-Edge)
31165084…), 7.624 → 4.867 GiB995e67f1…), 10.343 → 7.586 GiBlibnppicc.so.13, downstream of anything touched here48d22c11…)just lintThe t2i comparison was run only after confirming the path is bit-reproducible at a
fixed seed (two runs of the same code produced identical bytes). With the default
seed=Nonethe path is not reproducible run-to-run, so a naive byte diff there ismeaningless — noted in case anyone else tries to regression-test image output.
Not covered
unified_mot.pyis imported by the nano/edge/super SFTmodel configs. The change is default-inert there and the generative t2i run
exercises the same construction path, but no training run was performed. The
task="vlm"reasoner SFT buildsVLMModel, which does not referenceunified_motat all; the recipe that would exercise it (vision_sft_edge) needsa dataset, VAE and 8 GPUs that were not available.
classes, which the flag also threads through (default
True, so unchanged), butno inference was run on them.
Note
include_gen_pathwaydoes not leak into exported checkpoint configs: the LazyDictonly carries kwargs the experiment config passes explicitly, so the
Truedefaultstays in
_MoTConfigBase.__init__. Confirmed by dumpingload_model_config_dict()on both branches — byte-identical, key absent in both.
🤖 Generated with Claude Code