chore: replace decord2 with torchvision/torchaudio for media loading - #3107
Merged
Conversation
decord2 bundles libx264, libx265, libopenh264, and libmp3lame as hard dynamic dependencies of its core shared library. These codec libs carry MPEG LA / HEVC Advance royalty obligations on distribution. Replace the two decord usages in multimodal_utils.py: - Video loading: load_video backend="decord" → backend="torchvision" (torchvision==0.26.0 is already a project dependency) - Audio fallback: decord.AudioReader → torchaudio.load + functional.resample (torchaudio==2.11.0 is already a project dependency) Remove decord2 from pyproject.toml dependencies. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Kajal Jain <kajalj@nvidia.com>
|
Auto-sync is disabled for ready for review pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Kajal Jain <kajalj@nvidia.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Kajal Jain <kajalj@nvidia.com>
Contributor
Author
|
/ok to test 25b19e2 |
- Replace decord.AudioReader in load_audio_from_file with torchaudio - Add torchaudio.* to pyrefly replace-imports-with-any to suppress import-error for the lazy torchaudio import in multimodal_utils.py Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Kajal Jain <kajalj@nvidia.com>
Contributor
Author
|
/ok to test 029b9ee |
av bundles libx264, libx265, libopenh264, and libmp3lame — the same royalty-obligating codec libs we removed with decord2. It is pulled in transitively by qwen-vl-utils (a megatron-bridge dep) but is only actually needed by megatron-bridge's optional WAN diffusion path, which installs it at test time via scripts/install_diffusion_deps.sh. Add "av; sys_platform == 'never'" to override-dependencies, mirroring the same approach already taken in Megatron-Bridge's own pyproject.toml (commit f4b34b4). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Kajal Jain <kajalj@nvidia.com>
…d2 via uv override - Switch processors.py video loading from backend="decord" to backend="torchvision" (missed in the initial decord→torchvision pass) - Add decord2 to override-dependencies with sys_platform=='never' so sglang's transitive pull of qwen-vl-utils[decord] on aarch64 Linux doesn't land it in the container Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Kajal Jain <kajalj@nvidia.com>
Contributor
Author
|
/ok to test 3e21f62 |
chtruong814
previously approved these changes
Jul 9, 2026
torchaudio was only in override-dependencies (which pins version but doesn't install the package). Moving it to [project.dependencies] alongside torchvision so it's actually installed in the container. Without this, load_audio_from_file raises ModuleNotFoundError on torchaudio. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Kajal Jain <kajalj@nvidia.com>
torchaudio 2.11.0 defaults to torchcodec as its first audio backend. torchcodec's native .so files were already present in the container (via ray worker venvs) but the Python package wasn't in the main venv, causing ModuleNotFoundError when load_audio_from_file is called from the dataloader. torchcodec links against system FFmpeg (LGPL-only) rather than bundling its own copy, so it carries no royalty-bearing codec libs (no libx264/ libx265/libmp3lame). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Kajal Jain <kajalj@nvidia.com>
…ll script - Remove torchaudio and torchcodec from [project.dependencies] and drop the pytorch-cu130 sources entry so the container receives only the PyPI torchaudio stub (~1.7 MB, no bundled FFmpeg) via sglang/vllm transitive deps. The pytorch-cu130 build (bundled FFmpeg with H.264/AAC decoders) is no longer shipped. - Add scripts/install_audio_deps.sh: installs torchaudio==2.11.0 (pytorch-cu130, with FFmpeg) + torchcodec at test time. Uses --reinstall-package torchaudio to upgrade from the PyPI stub. Check is idempotent (looks for bundled libav* in torchaudio/lib/, not just import success, so the PyPI stub does not falsely suppress the install). - Hook install_audio_deps.sh into all audio/omni test scripts (tests/test_suites/vlm/*omni*.sh, tests/functional/audio_grpo_megatron.sh, eval_audio.sh, eval_daily_omni.sh). LLM tests are unaffected. - Add prerequisite callout to docs/guides/grpo-audio.md. Signed-off-by: Kajal Jain <kajalj@nvidia.com>
Contributor
Author
|
/ok to test 2fe5480 |
chtruong814
previously approved these changes
Jul 16, 2026
Contributor
|
@kajalj22 Could you help update the audio dependency install methods in https://github.com/NVIDIA-NeMo/RL/blob/main/docs/guides/grpo-audio-visual.md and the related nightly tests? |
… guide Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Kajal Jain <kajalj@nvidia.com>
Contributor
Author
|
/ok to test bf18ead |
kajalj22
enabled auto-merge (squash)
July 16, 2026 07:38
terrykong
reviewed
Jul 16, 2026
terrykong
reviewed
Jul 16, 2026
yuki-97
reviewed
Jul 16, 2026
Also fix two stale comments in pyproject.toml: - drop torchaudio from the uv.sources index comment - update script path reference from scripts/ to tools/ Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Kajal Jain <kajalj@nvidia.com>
terrykong
approved these changes
Jul 16, 2026
Contributor
Author
|
/ok to test 3a0d641 |
Contributor
|
/ok to test |
@chtruong814, there was an error processing your request: See the following link for more information: https://docs.gha-runners.nvidia.com/cpr/e/1/ |
Contributor
|
/ok to test 0af12fe |
4 tasks
ashors1
pushed a commit
that referenced
this pull request
Jul 22, 2026
…3107) Signed-off-by: Kajal Jain <kajalj@nvidia.com> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
15 tasks
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.
Summary
Replaces `decord2` with `torchvision`/`torchaudio` and removes bundled codec libraries from the shipped container.
Video/audio decoding
Container changes
Audio install script
Motivation
`decord2` and `av` (PyAV) bundle codec libraries as hard dynamic link dependencies that cannot be stripped without breaking the import.
Supersedes #2922, which attempted to delete codec `.so` files at Docker build time but broke `import decord`.
Test plan
🤖 Generated with Claude Code