How i Train With CPU

I want to train cnn model using cpu, i switched from cuda to cpu but it gives me cuda out of memory
that means that run on cuda. I used these lines but not working
defaults.device = torch.device('cpu')
torch.device('cpu')

1 Like

HI alymostafa hope your having a marvelous day!

The links below seem to suggest that this is a possible solution.

you can just set CUDA_VISIBLE_DEVICES variable to empty via shell before running your torch code.

export CUDA_VISIBLE_DEVICES=""

should tell torch that there are no GPUs.

export CUDA_VISIBLE_DEVICES="0"
will tell it to use only one GPU (the one with id 0) and so on

Hope this helps

Cheers mrfabulous1 :smiley: :smiley:

1 Like