fix(video): only send output_dtype to TorchCodec when it is not the default - #232
Merged
lfengad merged 1 commit intoSep 3, 2026
Merged
Conversation
…efault
_build_decoder passed output_dtype=torch.uint8 into VideoDecoder(...) on every
call. That parameter does not exist on the pinned cu128/cu130 TorchCodec
(0.10.0) -- it first appears in 0.14.0, and cu128 wheels stop at 0.11.1, so no
pin bump can make the code as written work on cu128 -- and every decoder
construction raised
TypeError: VideoDecoder.__init__() got an unexpected keyword argument
'output_dtype'
including plain metadata probes through probe_video(). uint8 is already
TorchCodec's own default, so the keyword carried no information and only broke
the call.
This took down generator-inference-smoke, and did so expensively: in
test_nano_inference_omni it was rank 1 that raised, so the other three ranks sat
in an ALLREDUCE until the 1800s NCCL watchdog fired and ProcessGroupNCCL aborted
them (SIGABRT, no Python traceback). The real one-line TypeError was ~950 lines
above the reported failure.
Send output_dtype only when it differs from the uint8 default, and translate a
rejected output_dtype/transforms keyword into a message naming the knob and the
installed version, so a genuine request on an old build fails legibly instead of
as a bare TypeError deep inside a rank.
No caller passes output_dtype or resize_size, so the default path is restored to
its pre-regression behaviour. transforms does exist on 0.10.0 and is unaffected;
it is covered by the same guard for older builds.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
lfengad
force-pushed
the
liangf/fix-torchcodec-output-dtype
branch
from
September 3, 2026 14:33
55fffa1 to
54e2e8b
Compare
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
Fixes the
generator-inference-smokefailure on #231._build_decoderforwardsoutput_dtype=torch.uint8intoVideoDecoder(...)on every call:output_dtypedoes not exist on the pinned TorchCodec.pyproject.tomlresolvescu128andcu130totorchcodec==0.10.0, whoseVideoDecoder.__init__is:Only the
cu130-torch213group pins a release new enough (0.14.0). Every CI job runs--group=cu128-train, so every decoder construction — including plain metadata probes viaprobe_video()— raised:uint8 is already 0.10's native output, so the default carried no information and only broke the call.
Why the failure was so expensive to read
In
test_nano_inference_omniit was rank 1 that raised. The other three ranks carried on into anALLREDUCEand sat there until the 1800s NCCL watchdog fired, at which pointProcessGroupNCCLtook them down withSIGABRT(exitcode-6,traceback: NoneType: None). 30 of the job's 36 minutes were the timeout, and the real one-lineTypeErrorwas ~950 lines above the reported failure.The same bug in
test_nano_inference_multi_control_transferhit rank 0 and failed cleanly in ~14 seconds — same root cause, completely different-looking failure, decided purely by which rank got there first.The fix
output_dtypeonly when it differs from theuint8default, restoring the default path to its pre-regression behaviour.output_dtype/transformskeyword into a message naming the knob and the installed version, so a genuine request on an old build fails legibly instead of as a bareTypeErrordeep inside a rank.No caller anywhere in the repo passes
output_dtypeorresize_size, so nothing loses functionality.transformsdoes exist on 0.10.0 and is unaffected; it is covered by the same guard for older builds.interleaved_video_parsing.pyalready carries this exact defensive pattern (_SUPPORTS_VIDEO_DECODER_OUTPUT_DTYPE, the cachedTypeErrorprobe). It just was not applied totorchcodec_video.py.Tests
torchcodec_video.pyhad no test file at all — which is why a pure-Python signature mismatch had to be caught by a 4-GPU inference smoke test instead of a unit test.Adds
torchcodec_video_test.py(6 tests). The decoders in it mirror the real 0.10.0 and newer signatures rather than whatever CI resolved, so the behaviour is pinned on both. Verified red→green: the 3 compatibility tests fail against the current code with the exact production error (torchcodec_video.py:59) and pass after the fix.ruff checkandruff format --checkare clean on both files.Base
Targets
release/2026-09-03-3f2febdbso #231 can go green.🤖 Generated with Claude Code