1adrianb / face-alignment

:fire: 2D and 3D Face alignment library build using pytorch
https://www.adrianbulat.com
BSD 3-Clause "New" or "Revised" License
7.1k stars 1.35k forks source link

Exception can't convert cuda:0 device type tensor to numpy. Use Tensor.cpu() to copy the tensor to host memory first. #362

Closed subtlevenom closed 2 months ago

subtlevenom commented 2 months ago

Repro steps (just following the steps from https://pypi.org/project/face-alignment/1.4.1/):

fal = fa.FaceAlignment(landmarks_type= fa.LandmarksType.TWO_D, face_detector='sfd', dtype=torch.bfloat16, device='cuda') preds = fal.get_landmarks(img)

img is a numpy array [H,W,3]

Exception: TypeError("can't convert cuda:0 device type tensor to numpy. Use Tensor.cpu() to copy the tensor to host memory first.")

subtlevenom commented 2 months ago

It seems it is a duplicate of https://github.com/1adrianb/face-alignment/issues/292, which is still open. Looks like a showstopper issue

1adrianb commented 2 months ago

@subtlevenom I've pushed a quick fix, if you reinstall it from source it should now be fine