Repository navigation
Conversation
rwagwani
force-pushed
the
fix/seed-range
branch
from
October 30, 2026 06:55
cc2d68e to
7e7065f
Compare
`seed` accepted any integer, but the samplers cannot take all of them: the bidirectional sampler seeds NumPy's RandomState (0..2**32-1) and torch.Generator overflows at 2**64. A request with seed=2**64 therefore loaded the model and then failed with "Overflow when unpacking long long" when the first noise was drawn. Constrain `seed` to 0..2**32-1, the range every sampler accepts. An out-of-range seed is rejected when the request is parsed, before the model loads. num_outputs > 1 uses seed + i per output, so the built sample also checks the last per-output seed (this check runs when the sample is built, still before generation). Chunked bidirectional transfer and chunked multiview add the chunk index to the seed; those sums now wrap within the range, which changes nothing for any seed that runs today. A missing seed still falls back to the per-sample derived seed, which is within 31 bits. docs/inference.md states the range. Behaviour change: negative seeds currently run on the causal (Sim-Transfer) path, because torch.Generator accepts them. They are now rejected on every model, so one range holds for all of them. No seed in the repository's specs, docs, tests or notebooks is outside the range. Signed-off-by: rwagwani <rwagwani@nvidia.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
rwagwani
force-pushed
the
fix/seed-range
branch
from
November 3, 2026 08:39
7e7065f to
0c37d7a
Compare
This branch has not been deployed
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.
Related: #336 (same pattern: a value accepted at startup that fails only after the model has loaded).
Summary
seedwas a plainint | Nonewith no range, but the samplers accept only part of it: the bidirectional sampler seeds NumPy'sRandomState(0to2**32 - 1, viamisc.arch_invariant_rand), andtorch.Generatoroverflows at2**64. A request withseed: 18446744073709551616loaded the model and then failed withValueError: Overflow when unpacking long longwhen the first noise was drawn.Change
seedbecomesAnnotated[int, Field(ge=0, le=2**32 - 1)](MAX_SEED), the range every sampler accepts. An out-of-range seed is rejected when the request is parsed, before the model loads.num_outputs > 1usesseed + iper output, so the built sample also checks that the last per-output seed stays in range. This check runs when the sample is built, still before generation.transfer.py) and chunked multiview (multiview.py) add the chunk index to the seed. Those sums now wrap within the range, so a seed at the top of the range cannot fail on a later chunk. Nothing changes for any seed that runs today.docs/inference.mdstates the range and the fallback.Behaviour change: negative seeds currently run on the causal (Sim-Transfer) path, because
torch.Generatoraccepts them; on normal models they already fail after model load (Seed must be between 0 and 2**32 - 1, reproduced on Cosmos3-Nano with--seed -1). They are now rejected at startup on every model, so one range holds everywhere. No seed in the repository's specs, docs, tests or notebooks is outside the range.Not covered here: the action policy servers (
scripts/action_policy_server_*.py) take their ownseedargument and are unchanged.Verification
2**32 - 1accepted; -1,2**32and2**64rejected;seed = 2**32 - 1withnum_outputs = 2rejected, both directly and throughbuild_sample.args_test.py,common/args_test.py,transfer_test.py,multiview_test.py: 194 passed.-m L0, same command asgpu-tests.yml), replicated on a single GB300: 791 passed vs 784 on main 1a2f03a, with the same single failure that main shows on this machine (activation_marks_test.py).--seed -1and--seed 18446744073709551616are rejected at parse, before the model loads (Input should be greater than or equal to 0/less than or equal to 4294967295).--seed 2025gives the same video as main.🤖 Generated with Claude Code