I am trying to import torchvision but I am getting an error. I researched the topic in the Web and there seems to be a problem with the later versions. Different solutions were offered --mostly reinstalling the modules-- which I tried without a result The latest advice I found was to install torch and torchvision using the following command which I did successfully:
pip install torch===1.4.0 torchvision===0.5.0 -f https://download.pytorch.org/whl/torch_stable.html
Still, the error persists:
(tf2) C:\Users\Alienware>python
Python 3.7.6 | packaged by conda-forge | (default, Mar 23 2020, 22:22:21) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> import torchvision
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\Alienware\Anaconda3\envs\tf2\lib\site-packages\torchvision\__init__.py", line 3, in <module>
from torchvision import models
File "C:\Users\Alienware\Anaconda3\envs\tf2\lib\site-packages\torchvision\models\__init__.py", line 5, in <module>
from .inception import *
File "C:\Users\Alienware\Anaconda3\envs\tf2\lib\site-packages\torchvision\models\inception.py", line 65, in <module>
class Inception3(nn.Module):
File "C:\Users\Alienware\Anaconda3\envs\tf2\lib\site-packages\torchvision\models\inception.py", line 182, in Inception3
@torch.jit.unused
AttributeError: module 'torch.jit' has no attribute 'unused'
I am running Windows10, Anaconda 3, Python 3.7. My PC has a GPU and I have installed CUDA which works with TensorFlow and PyTorch.