OpenTalker / SadTalker

[CVPR 2023] SadTalker:Learning Realistic 3D Motion Coefficients for Stylized Audio-Driven Single Image Talking Face Animation
https://sadtalker.github.io/
Other
11.12k stars 2.08k forks source link

add support to macOS GPU for inference #890

Open huiofficial opened 2 months ago

huiofficial commented 2 months ago

Use torch.backends.mps.is_available() to check whether GPU is available for PyTorch on macOS.

Use to.(xx.device) to match op device for computing.

Use os.environ['PYTORCH_ENABLE_MPS_FALLBACK'] = '1' to deal with operator 'aten::grid_sampler_3d' is not currently implemented for the MPS device.

And I optimized imports in inference.py

yukiarimo commented 1 month ago

How fast is it?

bruno-cunha commented 1 month ago

How fast is it?

I tested it in my M1 and got 2x faster

huiofficial commented 1 month ago

thanks, it'd be better if u can give a review.