fix cpu error

Link: https://code.alibaba-inc.com/Ali-MaaS/MaaS-lib/codereview/10432300

    * fix cpu error
This commit is contained in:
xingguang.zxg
2022-10-20 12:51:48 +08:00
committed by yingda.chen
parent 535acaef5b
commit e7c7be6aae

View File

@@ -93,7 +93,7 @@ class TextDrivenSeg(TorchModel):
"""
with torch.no_grad():
if self.device_id == -1:
output = self.model(image)
output = self.model(image, [text])
else:
device = torch.device('cuda', self.device_id)
output = self.model(image.to(device), [text])