Pytorch-cyclegan-and-pix2pix: AttributeError: module 'torch._C' has no attribute '_cuda_setDevice' for Opennmt

Created on 12 Jul 2019  路  3Comments  路  Source: junyanz/pytorch-CycleGAN-and-pix2pix

Hi
I am trying to run opennmt from anaconda prompt using GPU. I am trying to run the code -

python train.py -data data/demo -save_model data/demo-model --train_from data/demo-model_step_50000.pt --save_checkpoint_steps 5000 --train_steps 90000 --world_size 1 --gpu_ranks 0

But I am getting the error - AttributeError: module 'torch._C' has no attribute '_cuda_setDevice'

This code is running fine when I am running using CPU

My OS is Windows 10 64 bit and my graphix card is NVIDIA GeForece GTX 1050. I am using CUDA 10.0 and Anaconda 3,

Could you please help me

Most helpful comment

I got this error when I inadvertently downgraded pytorch to a CPU-only version (by conda installing some other packages).

Should be verifiable via:

>>> torch.cuda.is_available()
False

My fix was reinstalling pytorch/torchvision to these pinned versions:

conda install pytorch=1.3.1 torchvision=0.4.2 -c pytorch

, which showed the CPU-only version was in fact installed:

The following packages will be SUPERSEDED by a higher-priority channel:

  pytorch            pkgs/main::pytorch-1.3.1-cpu_py37h62f~ --> pytorch::pytorch-1.3.1-py3.7_cuda10.1.243_cudnn7.6.3_0
  torchvision        pkgs/main::torchvision-0.4.2-cpu_py37~ --> pytorch::torchvision-0.4.2-py37_cu101

All 3 comments

267 and #360

Neither of those mentioned issues solve the problem. #360 is in reference to something really old and #267 is a reference to configuring something to run on a mac cpu.

I got this error when I inadvertently downgraded pytorch to a CPU-only version (by conda installing some other packages).

Should be verifiable via:

>>> torch.cuda.is_available()
False

My fix was reinstalling pytorch/torchvision to these pinned versions:

conda install pytorch=1.3.1 torchvision=0.4.2 -c pytorch

, which showed the CPU-only version was in fact installed:

The following packages will be SUPERSEDED by a higher-priority channel:

  pytorch            pkgs/main::pytorch-1.3.1-cpu_py37h62f~ --> pytorch::pytorch-1.3.1-py3.7_cuda10.1.243_cudnn7.6.3_0
  torchvision        pkgs/main::torchvision-0.4.2-cpu_py37~ --> pytorch::torchvision-0.4.2-py37_cu101
Was this page helpful?
0 / 5 - 0 ratings

Related issues

bill0812 picture bill0812  路  3Comments

John1231983 picture John1231983  路  3Comments

khryang picture khryang  路  3Comments

MaureenZOU picture MaureenZOU  路  4Comments

AllAwake picture AllAwake  路  5Comments