use cpu when set --device=cuda on mac
This commit is contained in:
parent
6674104742
commit
592ec3485b
@ -197,6 +197,12 @@ def parse_args():
|
|||||||
setattr(args, k, v)
|
setattr(args, k, v)
|
||||||
|
|
||||||
if args.device == "cuda":
|
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
|
import torch
|
||||||
|
|
||||||
if torch.cuda.is_available() is False:
|
if torch.cuda.is_available() is False:
|
||||||
|
Loading…
Reference in New Issue
Block a user