Reputation: 63
I am trying to do pytorch tutorial. When I try to set their device as cuda, it does not work and my code running get stuck.
For specific information, I am using conda environment of python 3.7.3 pytorch 1.3.0 cuda 10.2 (NVIDIA RTX2080TI)
>>> import torch
>>> torch.cuda.is_available()
True
>>> torch.cuda.device_count()
1
>>> torch.cuda.current_device()
0
>>> device = torch.device('cuda:0')
>>> device
device(type='cuda', index=0)
>>> aa = torch.randn(5)
>>> aa = tensor([-2.2084, -0.2700, 0.0921, -1.7678, 0.7642])
>>> aa.to(device)
nothing happens...
Can anybody please help me how to overcome this problem?
Upvotes: 5
Views: 8719
Reputation: 6618
GeForce 30
series need cuda 11 =<
, so try to use cuda 11 =< using,
conda install pytorch==1.8.0 torchvision==0.9.0 torchaudio==0.8.0 cudatoolkit=11.1 -c pytorch -c conda-forge
Upvotes: 1
Reputation: 146
This has happened with the Pytorch 1.3.0 release (the release was this week). I too face this bug. Basically, when I call .to(device)
, it just hangs and does nothing.
If you would like to fix this temporarily, you can downgrade to PyTorch 1.2.0. To do this, I ran:
conda install pytorch=1.2.0 torchvision cudatoolkit=10.2 -c pytorch
I would have just commented but I do not have enough reputation to do that.
Upvotes: 5