Model.cuda() takes long time

It works! Now it takes a few seconds but I guess it’s normal. Thank you so much @richard

1 Like

model.cuda() shows the same problem on
Ubuntu 16.04
GeForce GTX 1080
CUDA 7.5
torch (0.2.0.post3)

I’ve tried installing through pip as well as source.

Same issue. Variable.cuda() or model.cuda() takes 5 mins. I’m running:

Titan Xp
PyTorch 0.2.0_3 installed using pip
CUDA V7.5.17
Ubuntu 16.04

@litesaber and @devansh20la both of you have a pascal graphics card, hence you need to installl CUDA 8.0 configuration of pytorch, not CUDA 7.5.

2 Likes

@litesaber This issue surfaced only with the newer version of pytorch. I fixed it with installing torch CUDA 8 using anaconda.

1 Like

Same issue, model.cuda() takes more than a couple minutes

Ubuntu 17.04
GeForce GTX 1080
CUDA 8.0
torch (0.3.0)

For what it’s worth:

>>> import torch
>>> torch.__version__
'0.3.0'
>>> torch.version.cuda
'8.0.61'
>>> torch.version.cudnn
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'torch.version' has no attribute 'cudnn'

I installed using:

conda install pytorch torchvision cuda80
1 Like

I am also having the same issue.

Ubuntu 16.04
GeForce GTX 1060
CUDA 8.0
torch (0.3.0)

Thanks.

model.cuda() takes very long time to instantiate and is very slow on my GTX 920M machine.
I am using Cuda 8.0 on my machine, conda install and torch version is 0.3.1. Please help me.

This method really helped me. before that, x=Variable(torch.Tenor([0]).cuda()) took 1 minute to run.

To be more specific, following helped in my case.

conda install pytorch torchvision cuda80 -c soumith

You most likely installed an old version of PyTorch, which is not recommended.
Try to install from the pytorch channel:

conda install pytorch torchvision -c pytorch

Also, have a look at the different install options for your setup (CUDA version etc.) at the website.

I realize this is an old discussion and the latest pytorch probably fixes it. For some reason I have to use an older version of pytorch and this issue occurs for me again. When I call model.cuda(), it takes about 10 minutes to load the model.
My system setup:

Titan Xp
pytorch 0.3.0
python 2.7
cuda 9.0
cudnn 7.0.5
torchvision 0.2.0

Really appreciate it if anyone could take a look. Thanks!

Similar issue here. I am using torch in C++ in order to have a production model for my application. Retinanet (Resnet50 backbone) takes approximately 80 ms . However, the bottleneck is moving one tensor to CUDA which takes approximately 130 ms (in order to compute the bounding boxes). Do you think this is normal?

My GPU is Nvidia GeForce GTX 950M and my specs are (inside a conda environment with Python 2.7):

>>> import torch
>>> torch.__version__
'1.0.0.dev20181203'
>>> torch.version.cuda
'9.2.148'
>>> torch.version.cudnn
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'cudnn'
>>> 

Thanks.

Same issue.
my model.cuda() also takes long time.

I’m running on
Geforce 1080 Ti,
Cuda v8.0
Ubuntu 16.04

and what i did for pytorch installation is:
conda create -n torch python=3.5
source activate torch
conda install pytorch torchvision cudatoolkit=8.0 -c python

I do search several time in internet, but I can’t find some solution…
What can I do ?