adapt to cpu environment

Link: https://code.alibaba-inc.com/Ali-MaaS/MaaS-lib/codereview/9754314
This commit is contained in:
biwen.lbw
2022-08-15 16:31:17 +08:00
committed by Yingda Chen
parent 77c6420c42
commit 4e0ee1ed57

View File

@@ -44,8 +44,10 @@ class SkinRetouchingPipeline(Pipeline):
"""
super().__init__(model=model)
if device == 'gpu':
if torch.cuda.is_available() and device == 'gpu':
device = 'cuda'
else:
device = 'cpu'
model_path = os.path.join(self.model, ModelFile.TORCH_MODEL_FILE)
detector_model_path = os.path.join(
self.model, 'retinaface_resnet50_2020-07-20_old_torch.pth')