module 'torchvision' has no attribute 'disable_beta_transforms_warning' (fix)

AttributeError: module 'torchvision' has no attribute 'disable_beta_transforms_warning' means the code expects a newer torchvision than you have. We reproduced it on 0.14.1, checked 0.24.0, and tested two fixes.

1. The error

import torchvision
print("torchvision", torchvision.__version__)
torchvision.disable_beta_transforms_warning()
print("ok")

torchvision 0.14.1 (torch 1.13.1):

torchvision 0.14.1+cu117
Traceback (most recent call last):
  File "b1.py", line 3, in <module>
    torchvision.disable_beta_transforms_warning()
AttributeError: module 'torchvision' has no attribute 'disable_beta_transforms_warning'

torchvision 0.24.0:

torchvision 0.24.0+cpu
ok

The function was added for the beta transforms.v2 API, so older torchvision releases (0.14.1 here) don't have it. In 0.24.0 it is still there, but its body is just pass with the comment "Noop, only exists to avoid breaking existing code" (pytorch/vision issue 7896). So whatever calls it expects a newer torchvision than you have.

2. Fix A: upgrade torch and torchvision together

Each torchvision needs one exact torch version (0.24 needs torch 2.9.0), so upgrade both in one command from one index, e.g. pip install torch==2.9.0 torchvision==0.24.0 --index-url https://download.pytorch.org/whl/cpu (or your CUDA tag). Upgrading torchvision alone can leave a pair that fails with operator torchvision::nms does not exist.

3. Fix B: guard the call (your own code)

Since the call is a no-op on new versions anyway, skipping it when it is missing changes nothing:

import torchvision
print("torchvision", torchvision.__version__)
if hasattr(torchvision, "disable_beta_transforms_warning"):
    torchvision.disable_beta_transforms_warning()
print("ok")

torchvision 0.14.1:

torchvision 0.14.1+cu117
ok

torchvision 0.24.0:

torchvision 0.24.0+cpu
ok

If the call is inside a library, check its requirements for the torchvision version it expects and use Fix A.

Related: torchvision.transforms has no attribute v2 ยท operator torchvision::nms does not exist

Frequently asked questions

What does disable_beta_transforms_warning do now?

Nothing. In torchvision 0.24.0 its body is pass; it only exists so old code keeps working.

Which torchvision is missing it?

Older releases from before transforms.v2; we confirmed 0.14.1 raises the AttributeError.

Written with AI assistance. Measured on 2026-10-24 on Linux: torchvision 0.24.0+cpu with torch 2.9.0 (CPython 3.11.17) and torchvision 0.14.1 with torch 1.13.1 (CPython 3.10). Output pasted unedited except shortened paths. PlainTables is our extension; torchvision is free.