facebookresearch / pytorchvideo

A deep learning library for video understanding research.
https://pytorchvideo.org/
Apache License 2.0
3.33k stars 412 forks source link

No such operator video_reader::read_video_from_memory when using torchvision backend #77

Closed surisdi closed 3 years ago

surisdi commented 3 years ago

🐛 Bugs / Unexpected behaviors

I get a RuntimeError: No such operator video_reader::read_video_from_memory when trying to decode a video using the torchvision backend.

Instructions To Reproduce the Issue:

Run the following code:

from pytorchvideo.data.encoded_video import EncodedVideo

path_video = "/path/to/video.mp4"
video_pyav = EncodedVideo.from_path(path_video, decoder='pyav')  # Runs without any problem
video_torchvision = EncodedVideo.from_path(path_video, decoder='torchvision')  # Throws error

Logs:

Failed to decode video of name <video_name>.mp4. No such operator video_reader::read_video_from_memory
Traceback (most recent call last):
  File "/path/to/conda/env/lib/python3.7/site-packages/pytorchvideo/data/encoded_video_torchvision.py", line 206, in _torch_vision_decode_video
    raise e
  File "/path/to/conda/env/lib/python3.7/site-packages/pytorchvideo/data/encoded_video_torchvision.py", line 180, in _torch_vision_decode_video
    tv_result = torch.ops.video_reader.read_video_from_memory(
  File "/path/to/conda/env/lib/python3.7/site-packages/torch/_ops.py", line 60, in __getattr__
    op = torch._C._jit_get_operation(qualified_op_name)
RuntimeError: No such operator video_reader::read_video_from_memory
python-BaseException

The current version of the libraries is: pytorchvideo -> 0.1.2 torch -> 1.9.0+cu111 torchvision -> 0.10.0+cu111

Thanks!

kalyanvasudev commented 3 years ago

Hi, how did you install pytorch and torchvision ? Could you also provide more info on the environment you are running it in?

surisdi commented 3 years ago

Hi,

I installed them using the following command:

pip3 install torch==1.9.0+cu111 torchvision==0.10.0+cu111 torchaudio==0.9.0 -f https://download.pytorch.org/whl/torch_stable.html

As suggested in https://pytorch.org

I'm running it on Ubuntu 18.04.5 LTS. What specific information do you need about the environment?

Thanks!

kalyanvasudev commented 3 years ago

Hi Could you please try installing using conda in a conda environment? pip wheels are usually delayed in updating. Inside conda, I'm unable to reproduce the said error.

surisdi commented 3 years ago

Hi, after reinstalling pytorch and updating CUDA drivers, the error can't be reproduced anymore.

chenjoya commented 3 years ago

@surisdi @kalyanvasudev Hi, I also encounter the similar problem. Could you help me? By reinstalling pytorch via conda:

conda install pytorch torchvision torchaudio cudatoolkit=11.3 -c pytorch

The problem still exists:

video_pyav = EncodedVideo.from_path(path_video, decoder='pyav')  # Okay!
video_torchvision = EncodedVideo.from_path(path_video, decoder='torchvision')  # segmentation fault (core dumped)

BTW, is torchvision backend much faster than pyav? Then I may still use pyav backend.

Attach my env:

image

Thank you for your attention!

chenjoya commented 3 years ago

@surisdi @kalyanvasudev Hi, I also encounter the similar problem. Could you help me? By reinstalling pytorch via conda:

conda install pytorch torchvision torchaudio cudatoolkit=11.3 -c pytorch

The problem still exists:

video_pyav = EncodedVideo.from_path(path_video, decoder='pyav')  # Okay!
video_torchvision = EncodedVideo.from_path(path_video, decoder='torchvision')  # segmentation fault (core dumped)

BTW, is torchvision backend much faster than pyav? Then I may still use pyav backend.

Attach my env:

image

Thank you for your attention!

By updating pyav:

conda install av -c conda-forge

My problem is solved. Thank you for your pytorchvideo repo. Excellent work. I love it.