From a101942e8a7d1313d4f2fe6a46c5cd9d32344e87 Mon Sep 17 00:00:00 2001 From: Ftps Date: Thu, 9 Feb 2023 16:38:18 +0900 Subject: [PATCH] Separate mps and other processes --- ldm/models/diffusion/ddim.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ldm/models/diffusion/ddim.py b/ldm/models/diffusion/ddim.py index 4497eb5..4b6d594 100644 --- a/ldm/models/diffusion/ddim.py +++ b/ldm/models/diffusion/ddim.py @@ -18,7 +18,10 @@ class DDIMSampler(object): def register_buffer(self, name, attr): if type(attr) == torch.Tensor: if attr.device != self.device: - attr = attr.to(self.device, torch.float32) + if str(self.device) == 'mps': + attr = attr.to(self.device, torch.float32) + else: + attr = attr.to(self.device) setattr(self, name, attr) def make_schedule(self, ddim_num_steps, ddim_discretize="uniform", ddim_eta=0., verbose=True):