Fix Kandinsky safety_checker and compile

This commit is contained in:
Disty0
2023-07-20 14:29:15 +03:00
parent e002652ac6
commit 57d1d3ed16
2 changed files with 3 additions and 1 deletions
+1 -1
View File
@@ -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
+2
View File
@@ -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