Module 'torchvision.models' has no attribute 'video'

I am using PyTorch 1.5 on Ubuntu 16.04 installed via anaconda, cuda 10.1
My model:

    model = models.video.r3d_18(pretrained=True, progress=False)
    num_features = model.fc.in_features
    model.fc = nn.Linear(num_features, num_classes)

I am getting this error:

AttributeError: module ‘torchvision.models’ has no attribute ‘video’

Can you all please help me out? Thanks!

Make sure the installed version of torchvision is >= 0.4.0.

Try

import torchvision
print(torchvision.__version__)

if you are unsure what version is installed.

I reinstalled pytorch by creating an environment using pip and:

pip install torch==1.5.0+cu101 torchvision==0.6.0+cu101 -f https://download.pytorch.org/whl/torch_stable.html

But after trying:

import torchvision
print(torchvision.__version__)

the output is:

0.2.2

This is strange.

I created a new environment with anaconda again and I am getting the same.

Try pip uninstall torchvision until there are no installations left. Then install it again with pip install torchvision.