use cpu when set --device=cuda on mac

This commit is contained in:
Qing 2023-05-29 21:40:58 +08:00
parent 6674104742
commit 592ec3485b

View File

@ -197,6 +197,12 @@ def parse_args():
setattr(args, k, v)
if args.device == "cuda":
import platform
if platform.system() == "Darwin":
logger.info("MacOS does not support cuda, use cpu instead")
setattr(args, "device", "cpu")
else:
import torch
if torch.cuda.is_available() is False: