From 422c60c78771fc927e20884466a43152edbcdcf6 Mon Sep 17 00:00:00 2001 From: Disty0 Date: Wed, 5 Jul 2023 20:49:39 +0300 Subject: [PATCH] Patch torch.Generator --- modules/devices.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/devices.py b/modules/devices.py index ddd02fb28..87734c4e1 100644 --- a/modules/devices.py +++ b/modules/devices.py @@ -190,9 +190,9 @@ if backend == 'ipex': lambda orig_func, *args, **kwargs: orig_func(args[0].to("cpu"), args[1].to("cpu")).to(get_cuda_device_string()), lambda *args, **kwargs: args[1].device != torch.device("cpu")) #SDE Samplers: - CondFunc('torchsde._brownian.brownian_interval._randn', - lambda _, size, dtype, device, seed: torch.randn(size, dtype=dtype, device=device, generator=torch.xpu.Generator(device).manual_seed(int(seed))), - lambda _, size, dtype, device, seed: device != torch.device("cpu")) + CondFunc('torch.Generator', + lambda orig_func, *args, **kwargs: torch.xpu.Generator(args[0]), + lambda *args, **kwargs: args[1] != torch.device("cpu")) #ControlNet: CondFunc('torch.batch_norm', lambda orig_func, *args, **kwargs: orig_func(args[0].to("cpu"),