vision icon indicating copy to clipboard operation
vision copied to clipboard

AttributeError: module 'torch.library' has no attribute 'register_fake'

Open WangXinYi111 opened this issue 8 months ago • 2 comments

I am using pytorch2.4.0, torchvision version is 0.19.0, python3.10, and an error occurs when running import torchvision

Python 3.10.12 (main, Jun 11 2023, 05:26:28) [GCC 11.4.0] on linux Type "help", "copyright", "credits" or "license" for more information. import torchvision Traceback (most recent call last): File "", line 1, in File "/home/user/.local/lib/python3.10/site-packages/torchvision/init.py", line 10, in from torchvision import _meta_registrations, datasets, io, models, ops, transforms, utils # usort:skip File "/home/user/.local/lib/python3.10/site-packages/torchvision/_meta_registrations.py", line 163, in @torch.library.register_fake("torchvision::nms") AttributeError: module 'torch.library' has no attribute 'register_fake'

WangXinYi111 avatar Apr 16 '25 10:04 WangXinYi111

Hi @WangXinYi111 , can you share how you installed torchvision and pytorch? Also please share the output of

wget https://raw.githubusercontent.com/pytorch/pytorch/main/torch/utils/collect_env.py
# For security purposes, please check the contents of collect_env.py before running it.
python collect_env.py

as originally requested in our bug report form

NicolasHug avatar Apr 22 '25 10:04 NicolasHug

Hello, I am facing the same issue. Trying to run the model in a docker container. base image : nvidia/cuda:11.8.0-cudnn8-runtime-ubuntu22.04 torchvision/pytorch installation:


RUN pip3 install --no-cache-dir \
    torch==2.4.0+cu118 \
    torchvision==0.19.0+cu118 \
    torchaudio==2.4.0+cu118 \
    --extra-index-url https://download.pytorch.org/whl/cu118

karancode avatar Aug 12 '25 09:08 karancode