Skip to content

[CI] Fix torchvision::nms error in RL integration tests - #2959

Merged
weifengpy merged 1 commit into
pytorch:mainfrom
weifengpy:fix-rl-ci-torchvision
Apr 14, 2026
Merged

weifengpy merged 1 commit into
pytorch:mainfrom
weifengpy:fix-rl-ci-torchvision

Conversation

@weifengpy

@weifengpy weifengpy commented Apr 14, 2026 •

Copy link
Copy Markdown
Contributor

fix https://github.com/pytorch/torchtitan/actions/runs/24377404846/job/71193671209?pr=2741

Summary

  • vllm pulls in torchvision transitively via transformers, but the PyPI torchvision doesn't match the nightly torch ABI, causing operator torchvision::nms does not exist at import time.
  • Install torchvision explicitly from the nightly channel alongside torch in both RL CI workflows (A10G and H100).

Test plan

  • RL integration tests pass on A10G (integration_test_4gpu_rl.yaml)
  • RL integration tests pass on H100 (integration_test_4gpu_rl_h100.yaml)
+ python -m torchtitan.experiments.rl.tests.integration_tests /home/ec2-user/actions-runner/_work/_temp/artifacts-to-be-uploaded --ngpu 4 --hf_assets_path /var/lib/ci-user/.cache/huggingface/hub/models--Qwen--Qwen3-0.6B/snapshots/c1899de289a04d12100db370d81485cdf75e47ca
Traceback (most recent call last):
  File "<frozen runpy>", line 189, in _run_module_as_main
  File "<frozen runpy>", line 112, in _get_module_details
  File "/pytorch/torchtitan/torchtitan/experiments/rl/__init__.py", line 15, in <module>
    from torchtitan.experiments.rl.models.vllm_wrapper import TorchTitanVLLMModelWrapper
  File "/pytorch/torchtitan/torchtitan/experiments/rl/models/vllm_wrapper.py", line 27, in <module>
    from torchtitan.experiments.rl.models.attention import VLLMAttentionWrapper
  File "/pytorch/torchtitan/torchtitan/experiments/rl/models/attention.py", line 20, in <module>
    from vllm.model_executor.layers.attention import Attention
  File "/opt/conda/envs/py_3.12/lib/python3.12/site-packages/vllm/model_executor/layers/attention/__init__.py", line 4, in <module>
    from vllm.model_executor.layers.attention.attention import Attention
  File "/opt/conda/envs/py_3.12/lib/python3.12/site-packages/vllm/model_executor/layers/attention/attention.py", line 10, in <module>
    from vllm.config import CacheConfig, get_current_vllm_config
  File "/opt/conda/envs/py_3.12/lib/python3.12/site-packages/vllm/config/__init__.py", line 19, in <module>
    from vllm.config.model import (
  File "/opt/conda/envs/py_3.12/lib/python3.12/site-packages/vllm/config/model.py", line 30, in <module>
    from vllm.transformers_utils.config import (
  File "/opt/conda/envs/py_3.12/lib/python3.12/site-packages/vllm/transformers_utils/config.py", line 19, in <module>
    from transformers.models.auto.image_processing_auto import get_image_processor_config
  File "/opt/conda/envs/py_3.12/lib/python3.12/site-packages/transformers/models/auto/image_processing_auto.py", line 27, in <module>
    from ...image_processing_utils import ImageProcessingMixin
  File "/opt/conda/envs/py_3.12/lib/python3.12/site-packages/transformers/image_processing_utils.py", line 21, in <module>
    from .image_processing_base import BatchFeature, ImageProcessingMixin
  File "/opt/conda/envs/py_3.12/lib/python3.12/site-packages/transformers/image_processing_base.py", line 26, in <module>
    from .image_utils import is_valid_image, load_image
  File "/opt/conda/envs/py_3.12/lib/python3.12/site-packages/transformers/image_utils.py", line 55, in <module>
    from torchvision.transforms import InterpolationMode
  File "/opt/conda/envs/py_3.12/lib/python3.12/site-packages/torchvision/__init__.py", line 8, in <module>
    from torchvision import _meta_registrations, datasets, io, models, ops, transforms, utils  # usort:skip
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/envs/py_3.12/lib/python3.12/site-packages/torchvision/_meta_registrations.py", line 163, in <module>
    @torch.library.register_fake("torchvision::nms")
     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/envs/py_3.12/lib/python3.12/site-packages/torch/library.py", line 1085, in register
    use_lib._register_fake(
  File "/opt/conda/envs/py_3.12/lib/python3.12/site-packages/torch/library.py", line 202, in _register_fake
    handle = entry.fake_impl.register(
             ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/envs/py_3.12/lib/python3.12/site-packages/torch/_library/fake_impl.py", line 50, in register
    if torch._C._dispatch_has_kernel_for_dispatch_key(self.qualname, "Meta"):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: operator torchvision::nms does not exist

vllm pulls in torchvision transitively via transformers, but the PyPI
torchvision doesn't match the nightly torch ABI, causing
"operator torchvision::nms does not exist" at import time. Install
torchvision explicitly from the nightly channel alongside torch.
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Apr 14, 2026
@weifengpy
weifengpy requested a review from shuhuayu April 14, 2026 05:21

@shuhuayu shuhuayu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. But curious where is the previous torchvision installed?

@tianyu-l tianyu-l left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shuhuayu

But curious where is the previous torchvision installed?

as mentioned in PR summary:

vllm pulls in torchvision transitively via transformers

@weifengpy

Copy link
Copy Markdown
Contributor Author

thanks for the prompt review. RL Integration Tests are back to normal. I am landing this

RL Integration Tests / build-test (cuda, linux.g5.48xlarge.nvidia.gpu, cuda, 12.8, torchtitan-ubuntu-20.04-clang12, http... / linux-job (pull_request)Successful in 20m
RL Integration Tests / set-matrix / set (pull_request)
RL Integration Tests / set-matrix / set (pull_request)Successful in 3s

@weifengpy
weifengpy merged commit 6f7a6a7 into pytorch:main Apr 14, 2026
18 of 30 checks passed
jemitche1 pushed a commit to jemitche1/torchtitan that referenced this pull request Apr 14, 2026
fix
https://github.com/pytorch/torchtitan/actions/runs/24377404846/job/71193671209?pr=2741

## Summary
- vllm pulls in torchvision transitively via transformers, but the PyPI
torchvision doesn't match the nightly torch ABI, causing `operator
torchvision::nms does not exist` at import time.
- Install torchvision explicitly from the nightly channel alongside
torch in both RL CI workflows (A10G and H100).

## Test plan
- [ ] RL integration tests pass on A10G
(`integration_test_4gpu_rl.yaml`)
- [ ] RL integration tests pass on H100
(`integration_test_4gpu_rl_h100.yaml`)


```
+ python -m torchtitan.experiments.rl.tests.integration_tests /home/ec2-user/actions-runner/_work/_temp/artifacts-to-be-uploaded --ngpu 4 --hf_assets_path /var/lib/ci-user/.cache/huggingface/hub/models--Qwen--Qwen3-0.6B/snapshots/c1899de289a04d12100db370d81485cdf75e47ca
Traceback (most recent call last):
  File "<frozen runpy>", line 189, in _run_module_as_main
  File "<frozen runpy>", line 112, in _get_module_details
  File "/pytorch/torchtitan/torchtitan/experiments/rl/__init__.py", line 15, in <module>
    from torchtitan.experiments.rl.models.vllm_wrapper import TorchTitanVLLMModelWrapper
  File "/pytorch/torchtitan/torchtitan/experiments/rl/models/vllm_wrapper.py", line 27, in <module>
    from torchtitan.experiments.rl.models.attention import VLLMAttentionWrapper
  File "/pytorch/torchtitan/torchtitan/experiments/rl/models/attention.py", line 20, in <module>
    from vllm.model_executor.layers.attention import Attention
  File "/opt/conda/envs/py_3.12/lib/python3.12/site-packages/vllm/model_executor/layers/attention/__init__.py", line 4, in <module>
    from vllm.model_executor.layers.attention.attention import Attention
  File "/opt/conda/envs/py_3.12/lib/python3.12/site-packages/vllm/model_executor/layers/attention/attention.py", line 10, in <module>
    from vllm.config import CacheConfig, get_current_vllm_config
  File "/opt/conda/envs/py_3.12/lib/python3.12/site-packages/vllm/config/__init__.py", line 19, in <module>
    from vllm.config.model import (
  File "/opt/conda/envs/py_3.12/lib/python3.12/site-packages/vllm/config/model.py", line 30, in <module>
    from vllm.transformers_utils.config import (
  File "/opt/conda/envs/py_3.12/lib/python3.12/site-packages/vllm/transformers_utils/config.py", line 19, in <module>
    from transformers.models.auto.image_processing_auto import get_image_processor_config
  File "/opt/conda/envs/py_3.12/lib/python3.12/site-packages/transformers/models/auto/image_processing_auto.py", line 27, in <module>
    from ...image_processing_utils import ImageProcessingMixin
  File "/opt/conda/envs/py_3.12/lib/python3.12/site-packages/transformers/image_processing_utils.py", line 21, in <module>
    from .image_processing_base import BatchFeature, ImageProcessingMixin
  File "/opt/conda/envs/py_3.12/lib/python3.12/site-packages/transformers/image_processing_base.py", line 26, in <module>
    from .image_utils import is_valid_image, load_image
  File "/opt/conda/envs/py_3.12/lib/python3.12/site-packages/transformers/image_utils.py", line 55, in <module>
    from torchvision.transforms import InterpolationMode
  File "/opt/conda/envs/py_3.12/lib/python3.12/site-packages/torchvision/__init__.py", line 8, in <module>
    from torchvision import _meta_registrations, datasets, io, models, ops, transforms, utils  # usort:skip
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/envs/py_3.12/lib/python3.12/site-packages/torchvision/_meta_registrations.py", line 163, in <module>
    @torch.library.register_fake("torchvision::nms")
     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/envs/py_3.12/lib/python3.12/site-packages/torch/library.py", line 1085, in register
    use_lib._register_fake(
  File "/opt/conda/envs/py_3.12/lib/python3.12/site-packages/torch/library.py", line 202, in _register_fake
    handle = entry.fake_impl.register(
             ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/envs/py_3.12/lib/python3.12/site-packages/torch/_library/fake_impl.py", line 50, in register
    if torch._C._dispatch_has_kernel_for_dispatch_key(self.qualname, "Meta"):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: operator torchvision::nms does not exist
```
mreso added a commit to mreso/torchtitan that referenced this pull request Apr 14, 2026
…ests

transformers pulls in torchvision transitively via image_utils, but the
PyPI torchvision doesn't match the nightly torch ABI, causing
`operator torchvision::nms does not exist` at import time.

Install torchvision from the nightly channel alongside torch, matching
the fix in pytorch#2959 for RL integration tests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/8gpu CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants