From 57d1d3ed1602f2ab0e5fb6521ee793fb73c07e96 Mon Sep 17 00:00:00 2001 From: Disty0 Date: Thu, 20 Jul 2023 14:29:15 +0300 Subject: [PATCH] Fix Kandinsky safety_checker and compile --- modules/devices.py | 2 +- modules/sd_models.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/devices.py b/modules/devices.py index d676d198a..b33b7a189 100644 --- a/modules/devices.py +++ b/modules/devices.py @@ -195,9 +195,9 @@ if backend == 'ipex': torch.cuda.get_device_properties = torch.xpu.get_device_properties torch._utils._get_available_device_type = lambda: "xpu" torch.cuda.set_device = torch.xpu.set_device + torch.cuda.empty_cache = torch.xpu.empty_cache if "WSL2" not in os.popen("uname -a").read() else lambda: None torch.cuda.ipc_collect = lambda: None - torch.cuda.memory_stats = torch.xpu.memory_stats torch.cuda.mem_get_info = lambda device=None: [(torch.xpu.get_device_properties(device).total_memory - torch.xpu.memory_allocated(device)), torch.xpu.get_device_properties(device).total_memory] torch.cuda.memory_allocated = torch.xpu.memory_allocated diff --git a/modules/sd_models.py b/modules/sd_models.py index 10c808047..03422f12a 100644 --- a/modules/sd_models.py +++ b/modules/sd_models.py @@ -521,8 +521,10 @@ class PriorPipeline: def __init__(self, prior, main): self.prior = prior self.main = main + self.main.safety_checker = None self.scheduler = main.scheduler self.tokenizer = self.prior.tokenizer + self.unet = self.main.unet def to(self, *args, **kwargs): # only the prior is moved to CUDA in a first step