use cpu when set --device=cuda on mac
This commit is contained in:
parent
6674104742
commit
592ec3485b
@ -197,12 +197,18 @@ def parse_args():
|
|||||||
setattr(args, k, v)
|
setattr(args, k, v)
|
||||||
|
|
||||||
if args.device == "cuda":
|
if args.device == "cuda":
|
||||||
import torch
|
import platform
|
||||||
|
|
||||||
if torch.cuda.is_available() is False:
|
if platform.system() == "Darwin":
|
||||||
parser.error(
|
logger.info("MacOS does not support cuda, use cpu instead")
|
||||||
"torch.cuda.is_available() is False, please use --device cpu or check your pytorch installation"
|
setattr(args, "device", "cpu")
|
||||||
)
|
else:
|
||||||
|
import torch
|
||||||
|
|
||||||
|
if torch.cuda.is_available() is False:
|
||||||
|
parser.error(
|
||||||
|
"torch.cuda.is_available() is False, please use --device cpu or check your pytorch installation"
|
||||||
|
)
|
||||||
|
|
||||||
if args.sd_local_model_path and args.model == "sd1.5":
|
if args.sd_local_model_path and args.model == "sd1.5":
|
||||||
if not os.path.exists(args.sd_local_model_path):
|
if not os.path.exists(args.sd_local_model_path):
|
||||||
|
Loading…
Reference in New Issue
Block a user