Skip to content

armgit / rembg

Public Imported from GitHub
0

Rembg is a tool to remove images background

Fix the TypeError: expected CUDA (got CPU) error

Student B5960eb75399e
diff --git a/src/rembg/u2net/detect.py b/src/rembg/u2net/detect.py
index ffc247e..924336c 100644
--- a/src/rembg/u2net/detect.py
+++ b/src/rembg/u2net/detect.py
@@ -107,7 +107,7 @@ def predict(net, item):
with torch.no_grad():
if torch.cuda.is_available():
- inputs_test = torch.cuda.FloatTensor(sample["image"].unsqueeze(0).float())
+ inputs_test = torch.cuda.FloatTensor(sample["image"].unsqueeze(0).cuda().float())
else:
inputs_test = torch.FloatTensor(sample["image"].unsqueeze(0).float())