I am trying to run the example of fastai/courses/dl2/wgan.ipynb on Paperspace.
At the second cell of the code,
from fastai.conv_learner import *
from fastai.dataset import *
import gzip
torch.cuda.set_device(3)
I get this error:
RuntimeError Traceback (most recent call last)
in ()
2 from fastai.dataset import *
3 import gzip
----> 4 torch.cuda.set_device(3)
~/anaconda3/envs/fastai/lib/python3.6/site-packages/torch/cuda/init.py in set_device(device)
260 “”"
261 if device >= 0:
–> 262 torch._C._cuda_setDevice(device)
263
264
RuntimeError: cuda runtime error (10) : invalid device ordinal at torch/csrc/cuda/Module.cpp:32
If I comment out the line torch.cuda.set_device(3), it returns an error later at the code.
This may mean that you have the dataset in Cuda (GPU) but this operation was expecting it to be in CPU. If you can provide more details on what cell in the notebook you are running it might help. Also, the Part 2 Videos are not yet released. So, you might want to wait till those are released before delving into the notebooks.
I’ve only used Paperspace for all the second part of the course and it has worked perfectly. A few things might require a P6000 but by lowering your batch size you should always be able to run the notebooks.
Like Ramesh said however, the videos will probably help a lot!
Thanks sgugger! I guess that you have chosen an increased storage (>50GB) to run this particular example with the ‘lsun’ dataset. Again, my intention is to run the ‘fastai/courses/dl2/wgan.ipynb’ but the default storage size of the fastai machine is inhibiting.
The first error I get is later at the cell:
netD.load_state_dict(torch.load(TMP_PATH/‘netD_2.h5’))
netG.load_state_dict(torch.load(TMP_PATH/‘netG_2.h5’))
This is to load a saved model. Jeremy had trained a bit and saved some files named netD_2.h5 and netG_2.h5 but since you’re starting from scratch, those lines won’t work.