chenjun2hao/facemask

Could not load the model. Showing CUDA error

Opened this issue · 3 comments

image
While I try to load the model it is showing
"in _check_driver
raise AssertionError("Torch not compiled with CUDA enabled")
AssertionError: Torch not compiled with CUDA enabled". Torch installation is not done with cuda enabled.

You have a problem because your torch was not compiled with CUDA capabilities... be sure you have a GPU card and use a version of torch with cuda capabilities

facemask/utils/config.py
line 6:
config.device = torch.device('cpu')

To add to @swuxyj 's response and to avoid having to install it manually:

import torch
import facemask as fm
fm.utils.config.config.device = torch.device('cpu')

# Or this: model = fm.FaceMaskDetector(modelpath, device=torch.device('cpu'))
model = fm.FaceMaskDetector(modelpath)
...