PyTorch HuggingFace model not using GPU
This is the model code:
This is the PyTorch Dataset class code:
This is the Predictions code:
And this is the task manager:
My Gpu works on the tutorials of the PyTorch from youtube, this code has been in the same environment and it still does not work. Any help would be appreciated please and thank you.
did you convert your variables and model device to cuda?did you ever used cuda in your codes?are you sure you config using pytorch from gpu corectly?
Make sure you are always using NUM_WORKERS=0. In Windows only that value is the one that works
Hi @Kashish-1426 ,
I've not had this issue before. I use computer vision models from Hugging Face quite often and they work excellent on the GPU.
I also use very similar code to you, e.g. model.to(device), just like in the PyTorch course.
Have you tried reaching out to anyone from Hugging Face?
@mrdbourke I think He is not referring to the deployment in Huggingface. From what you can see in the images, he is referring to the code he wants to implement, but from what you can see he is executing it locally in Windows and in Windows NUM_WORKERS = 0 is the only value it supports. I'm almost sure that's the problem because I had the same problem.