'RuntimeError: Numpy is not available, torch

I try to run the git repository : https://github.com/DinoMan/speech-driven-animation on jupyter. I followed the steps indicated but I encountered an error when I wanted to run example :

Here is my code amd the error :

import sda
va = sda.VideoAnimator(gpu=-1, model_path="crema")# Instantiate the animator
vid, aud = va("example/image.bmp", "example/audio.wav")

---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
Input In [7], in <cell line: 1>()
----> 1 vid, aud = va("example/image.bmp", "example/audio.wav")

File ~\IVERSE\sda\sda.py:229, in VideoAnimator.__call__(self, img, audio, fs, aligned)
    226     frame = img
    228 if not aligned:
--> 229     frame = self.preprocess_img(frame)
    231 if isinstance(audio, str):  # if we have a path then grab the audio clip
    232     info = mediainfo(audio)

File ~\IVERSE\sda\sda.py:191, in VideoAnimator.preprocess_img(self, img)
    190 def preprocess_img(self, img):
--> 191     src = self.fa.get_landmarks(img)[0][self.stablePntsIDs, :]
    192     dst = self.mean_face[self.stablePntsIDs, :]
    193     tform = tf.estimate_transform('similarity', src, dst)  # find the transformation matrix

File ~\AppData\Local\Programs\Python\Python310\lib\site-packages\face_alignment\api.py:110, in FaceAlignment.get_landmarks(self, image_or_path, detected_faces, return_bboxes, return_landmark_score)
     98 def get_landmarks(self, image_or_path, detected_faces=None, return_bboxes=False, return_landmark_score=False):
     99     """Deprecated, please use get_landmarks_from_image
    100 
    101     Arguments:
   (...)
    108         return_landmark_score {boolean} -- If True, return the keypoint scores along with the keypoints.
    109     """
--> 110     return self.get_landmarks_from_image(image_or_path, detected_faces, return_bboxes, return_landmark_score)

File ~\AppData\Local\Programs\Python\Python310\lib\site-packages\torch\autograd\grad_mode.py:27, in _DecoratorContextManager.__call__.<locals>.decorate_context(*args, **kwargs)
     24 @functools.wraps(func)
     25 def decorate_context(*args, **kwargs):
     26     with self.clone():
---> 27         return func(*args, **kwargs)

File ~\AppData\Local\Programs\Python\Python310\lib\site-packages\face_alignment\api.py:141, in FaceAlignment.get_landmarks_from_image(self, image_or_path, detected_faces, return_bboxes, return_landmark_score)
    138 image = get_image(image_or_path)
    140 if detected_faces is None:
--> 141     detected_faces = self.face_detector.detect_from_image(image.copy())
    143 if len(detected_faces) == 0:
    144     warnings.warn("No faces were detected.")

File ~\AppData\Local\Programs\Python\Python310\lib\site-packages\face_alignment\detection\sfd\sfd_detector.py:45, in SFDDetector.detect_from_image(self, tensor_or_path)
     42 def detect_from_image(self, tensor_or_path):
     43     image = self.tensor_or_path_to_ndarray(tensor_or_path)
---> 45     bboxlist = detect(self.face_detector, image, device=self.device)[0]
     46     bboxlist = self._filter_bboxes(bboxlist)
     48     return bboxlist

File ~\AppData\Local\Programs\Python\Python310\lib\site-packages\face_alignment\detection\sfd\detect.py:15, in detect(net, img, device)
     12 # Creates a batch of 1
     13 img = np.expand_dims(img, 0)
---> 15 img = torch.from_numpy(img.copy()).to(device, dtype=torch.float32)
     17 return batch_detect(net, img, device)

RuntimeError: Numpy is not available

I uploaded models via Google drive, I tried to uninstall numpy and reinstall a lower version (1.19) but this doesn't work too.. The error was:

note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

Could you help me understand what can I do to resolve the problem please ?

Thanks



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source