mirror of
https://github.com/vladmandic/automatic
synced 2026-09-18 16:54:33 +02:00
Fix GroupNorm.forward with IPEX
This commit is contained in:
+8
-1
@@ -145,8 +145,15 @@ def set_cuda_params():
|
||||
|
||||
args = cmd_args.parser.parse_args()
|
||||
if args.use_ipex:
|
||||
#Fix broken function in ipex 1.13.120+xpu
|
||||
from modules.sd_hijack_utils import CondFunc
|
||||
CondFunc('torch.nn.modules.GroupNorm.forward',
|
||||
lambda orig_func, *args, **kwargs: orig_func(args[0], args[1].to(args[0].weight.data.dtype)),
|
||||
lambda *args, **kwargs: args[2].dtype != args[1].weight.data.dtype)
|
||||
|
||||
#Use XPU instead of CPU. %20 Perf improvement on weak CPUs.
|
||||
if args.device_id is not None:
|
||||
cpu = torch.device(f"xpu:{args.device_id}") #Use XPU instead of CPU. %20 Perf improvement on weak CPUs.
|
||||
cpu = torch.device(f"xpu:{args.device_id}")
|
||||
else:
|
||||
cpu = torch.device("xpu")
|
||||
else:
|
||||
|
||||
+1
-1
@@ -304,7 +304,7 @@ options_templates.update(options_section(('cuda', "Compute Settings"), {
|
||||
"cuda_dtype": OptionInfo("FP32" if sys.platform == "darwin" else "FP16", "Device precision type", gr.Radio, lambda: {"choices": ["FP32", "FP16", "BF16"]}),
|
||||
"no_half": OptionInfo(False, "Use full precision for model (--no-half)", None, None, None),
|
||||
"no_half_vae": OptionInfo(False, "Use full precision for VAE (--no-half-vae)"),
|
||||
"upcast_sampling": OptionInfo(True if sys.platform == "darwin" or cmd_opts.use_ipex else False, "Enable upcast sampling"),
|
||||
"upcast_sampling": OptionInfo(True if sys.platform == "darwin" else False, "Enable upcast sampling"),
|
||||
"upcast_attn": OptionInfo(False, "Enable upcast cross attention layer"),
|
||||
"disable_nan_check": OptionInfo(True, "Disable NaN check in produced images/latent spaces"),
|
||||
"rollback_vae": OptionInfo(False, "Attempt to roll back VAE when produced NaN values, requires NaN check (experimental)"),
|
||||
|
||||
Reference in New Issue
Block a user