Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Run code on GPU instead of CPU with detecto

I am using machine learning with detecto in Python. However, whenever I run it, I get a warning saying

It looks like you're training your model on a CPU. Consider switching to a GPU; otherwise, 
this method can take hours upon hours or even days to finish. For more information, see 
https://detecto.readthedocs.io/en/latest/usage/quickstart.html#technical-requirements 

I have a GPU in the form of an Intel(R) HD graphics 4600, but for some reason the code is running on the CPU. I have checked out the link it gives which says

By default, Detecto will run all heavy-duty code on the GPU if it’s available and on the CPU otherwise.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

It recommends using Google Collab if the computer doesn’t have a GPU it can use, but I do have one, and don’t want to use Google Collab.

Why is it running on the CPU instead of the GPU? And how can I fix it? The part of my code where I get the warning is

losses = fitmodel(loader, Test_dataset, epochs=25, lr_step_size=5, 
learning_rate=0.001, verbose=True)

The code does work, however it takes ages to run, so want to be able to run it on the GPU to save time.

>Solution :

The GPU that detecto is referring to would need to be a CUDA capable Nvidia GPU. So your Intel(R) HD graphics 4600 does not meet this criterion.

Detecto uses pytorch internally, whichs GPU support is based on CUDA. So in order to use a GPU, you would need to move to a machine that has a CUDA capable card

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading