Limit training to CPU instead of GPU #1557
-
Training on GPU is crashing when loading the CIFAR dataset using
I have MX130 GPU with 2GB memory on laptop. I have 16GB RAM available for CPU. I want to train on CPU to get around the memory problem. But I cannot select training on CPU even when I have GPU available. How can I train exclusively on CPU even when GPU is available. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
For the Cifar10 dataset, you can change what device it is on by setting a manager for it in the builder: try(NDManager manager = NDManager.newBaseManager(Device.cpu())) {
Cifar10 cifar10 = Cifar10.builder()
.optManager(manager)
...
.build();
// Train and build within scope of manager
} The other one to keep in mind is that when you create a new Model, you should create it with the CPU as well like Finally, you will also need to set the device to CPU in your Just fix those three things and you should be able to do your training on CPU only. *Edited to include missed place to update based on comments below |
Beta Was this translation helpful? Give feedback.
For the Cifar10 dataset, you can change what device it is on by setting a manager for it in the builder:
The other one to keep in mind is that when you create a new Model, you should create it with the CPU as well like
Model.newInstance(modelName, Device.cpu())
.Finally, you will also need to set the device to CPU in your
TrainingConfig
as well.Just fix those three things and you should be able to do your training on CPU only.
*Edited to include missed place to update based on co…