Skip to content

RuntimeError: No such operator image::read_file #6693

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
datumbox opened this issue Oct 4, 2022 · 3 comments
Closed

RuntimeError: No such operator image::read_file #6693

datumbox opened this issue Oct 4, 2022 · 3 comments

Comments

@datumbox
Copy link
Contributor

datumbox commented Oct 4, 2022

🐛 Describe the bug

The CI job unittest_windows_gpu_py3.8 stared failing with:

______ test_decode_jpeg_cuda[False-ImageReadMode.GRAY-gray_pytorch.jpg] _______
Traceback (most recent call last):
  File "C:\Users\circleci\project\env\lib\site-packages\torch\_ops.py", line 501, in __getattr__
    op, overload_names = torch._C._jit_get_operation(qualified_op_name)
RuntimeError: No such operator image::read_file

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\circleci\project\test\test_image.py", line 363, in test_decode_jpeg_cuda
    data = read_file(img_path)
  File "c:\users\circleci\project\torchvision\io\image.py", line 47, in read_file
    data = torch.ops.image.read_file(path)
  File "C:\Users\circleci\project\env\lib\site-packages\torch\_ops.py", line 505, in __getattr__
    raise AttributeError(
AttributeError: '_OpNamespace' 'image' object has no attribute 'read_file'

It seems like the kernel is not registered properly. Might be related to a change on Core.

Versions

The issue started appearing on torch-1.13.0.dev20221004 py3.8_cuda11.6_cudnn8_0

@atalman
Copy link
Contributor

atalman commented Oct 4, 2022

This issue is caused by inclusion of cudart dll in windows torch/lib folder. The builder change #1157 is in place to resolve this issue

@atalman atalman self-assigned this Oct 4, 2022
@weiwangmeta
Copy link

pytorch/builder#1157 :)

@dbl001
Copy link

dbl001 commented Jan 17, 2023

I got the exception: "AttributeError: '_OpNamespace' 'image' object has no attribute 'read_file'"
with Pytorch Version: 2.0.0a0+gitf8b2879 on MacOS Ventura 13.1

Shared Interest project:
https://github.com/mitvis/shared-interest

 % python test.py
/Users/davidlaxer/anaconda3/envs/AI-Feynman/lib/python3.10/site-packages/torchvision-0.14.0a0+a61e6ef-py3.10-macosx-10.9-x86_64.egg/torchvision/io/image.py:13: UserWarning: Failed to load image Python extension: dlopen(/Users/davidlaxer/anaconda3/envs/AI-Feynman/lib/python3.10/site-packages/torchvision-0.14.0a0+a61e6ef-py3.10-macosx-10.9-x86_64.egg/torchvision/image.so, 0x0006): Symbol not found: __ZN2at4_ops19empty_memory_format4callEN3c108ArrayRefIxEENS2_8optionalINS2_10ScalarTypeEEENS5_INS2_6LayoutEEENS5_INS2_6DeviceEEENS5_IbEENS5_INS2_12MemoryFormatEEE
  Referenced from: <B53D2070-C006-35E7-821C-04385AFECC3B> /Users/davidlaxer/anaconda3/envs/AI-Feynman/lib/python3.10/site-packages/torchvision-0.14.0a0+a61e6ef-py3.10-macosx-10.9-x86_64.egg/torchvision/image.so
  Expected in:     <EFA33186-A337-3933-9E32-73FE6E861466> /Users/davidlaxer/anaconda3/envs/AI-Feynman/lib/python3.10/site-packages/torch/lib/libtorch_cpu.dylib
  warn(f"Failed to load image Python extension: {e}")
Traceback (most recent call last):
  File "/Users/davidlaxer/anaconda3/envs/AI-Feynman/lib/python3.10/site-packages/torch/_ops.py", line 562, in __getattr__
    op, overload_names = torch._C._jit_get_operation(qualified_op_name)
RuntimeError: No such operator image::read_file

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Users/davidlaxer/shared-interest/test.py", line 10, in <module>
    img = read_image("/Users/davidlaxer/ImageNet/ILSVRC/Data/CLS-LOC/train/n01494475/n01494475_6.JPEG")
  File "/Users/davidlaxer/anaconda3/envs/AI-Feynman/lib/python3.10/site-packages/torchvision-0.14.0a0+a61e6ef-py3.10-macosx-10.9-x86_64.egg/torchvision/io/image.py", line 251, in read_image
    data = read_file(path)
  File "/Users/davidlaxer/anaconda3/envs/AI-Feynman/lib/python3.10/site-packages/torchvision-0.14.0a0+a61e6ef-py3.10-macosx-10.9-x86_64.egg/torchvision/io/image.py", line 47, in read_file
    data = torch.ops.image.read_file(path)
  File "/Users/davidlaxer/anaconda3/envs/AI-Feynman/lib/python3.10/site-packages/torch/_ops.py", line 566, in __getattr__
    raise AttributeError(
AttributeError: '_OpNamespace' 'image' object has no attribute 'read_file'

% pip show torch
Name: torch
Version: 2.0.0a0+gitf8b2879
Summary: Tensors and Dynamic neural networks in Python with strong GPU acceleration
Home-page: https://pytorch.org/
Author: PyTorch Team
Author-email: [email protected]
License: BSD-3
Location: /Users/davidlaxer/anaconda3/envs/AI-Feynman/lib/python3.10/site-packages
Requires: networkx, sympy, typing_extensions
Required-by: accelerate, aifeynman, audiolm-pytorch, benepar, captum, parallelformers, pytorch-transformers, sentence-transformers, torch-struct, torchaudio, torchtraining-nightly, torchvision, vector-quantize-pytorch, whisper, xformers

(AI-Feynman) davidlaxer@x86_64-apple-darwin13 shared-interest % pip show torchvision
Name: torchvision
Version: 0.14.0a0+a61e6ef
Summary: image and video datasets and models for torch deep learning
Home-page: https://github.com/pytorch/vision
Author: PyTorch Core Team
Author-email: [email protected]
License: BSD
Location: /Users/davidlaxer/anaconda3/envs/AI-Feynman/lib/python3.10/site-packages/torchvision-0.14.0a0+a61e6ef-py3.10-macosx-10.9-x86_64.egg
Requires: numpy, pillow, requests, torch, typing_extensions
Required-by: aifeynman, sentence-transformers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants