简体   繁体   中英

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.

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM