From 7fdda2c8b3491de7b74f33fe2b6a6c2f98d24588 Mon Sep 17 00:00:00 2001 From: Jack Wooldridge Date: Fri, 14 Jul 2023 15:34:14 -0400 Subject: [PATCH] MPS fix --- modules/sd_models.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/sd_models.py b/modules/sd_models.py index 134a6c5c4..8d9adfca4 100644 --- a/modules/sd_models.py +++ b/modules/sd_models.py @@ -558,7 +558,7 @@ class PriorPipeline: def __call__(self, *args, **kwargs): unclip_outputs = self.prior(prompt=kwargs.get("prompt"), negative_prompt=kwargs.get("negative_prompt")) - if self.prior.device.type == "cuda" or self.prior.device.type == "xpu": + if self.prior.device.type == "cuda" or self.prior.device.type == "xpu" or self.prior.device.type == "mps": prior_device = self.prior.device self.prior.to("cpu") self.main.to(prior_device) @@ -566,7 +566,7 @@ class PriorPipeline: kwargs = {**kwargs, **unclip_outputs} result = self.main(*args, **kwargs) - if self.main.device.type == "cuda" or self.main.device.type == "xpu": + if self.main.device.type == "cuda" or self.main.device.type == "xpu" or self.prior.device.type == "mps": main_device = self.main.device self.main.to("cpu") self.prior.to(main_device)