Easy-Wav2Lip
Easy-Wav2Lip copied to clipboard
RuntimeError looking for CUDA when running on M3 Mac
install.py
throws the following error when running on Apple Silicon:
RuntimeError: Attempting to deserialize object on a CUDA device but torch.cuda.is_available() is False.
If you are running on a CPU-only machine, please use torch.load with map_location=torch.device('cpu')
to map your storages to the CPU.
The solution was to change line 83 of easy_functions.py
to explicitly reference the device value stored in the device
variable:
--- a/easy_functions.py
+++ b/easy_functions.py
@@ -80,7 +80,7 @@ def format_time(seconds):
def _load(checkpoint_path):
if device != "cpu":
- checkpoint = torch.load(checkpoint_path)
+ checkpoint = torch.load(checkpoint_path, map_location=torch.device(device))
else:
checkpoint = torch.load(
checkpoint_path, map_location=lambda storage, loc: storage
I'm not submitting a PR bc I can't be bothered to fork this repo when I don't even know if it will work past the install. Leaving this here for anyone else who's trying to run this on a Mac.