aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbrkirch <brkirch@users.noreply.github.com>2022-11-12 07:17:55 +0000
committerbrkirch <brkirch@users.noreply.github.com>2022-11-29 02:18:51 +0000
commit98ca437edfbf71dd956d67d37f2136b12d13be0d (patch)
tree958588db8a9c61abb0423e363b12f59699a12451
parent0b5dcb3d7ce397ad38312dbfc70febe7bb42dcc3 (diff)
downloadstable-diffusion-webui-gfx803-98ca437edfbf71dd956d67d37f2136b12d13be0d.tar.gz
stable-diffusion-webui-gfx803-98ca437edfbf71dd956d67d37f2136b12d13be0d.tar.bz2
stable-diffusion-webui-gfx803-98ca437edfbf71dd956d67d37f2136b12d13be0d.zip
Refactor and instead check if mps is being used, not availability
-rw-r--r--modules/sd_hijack.py6
1 files changed, 1 insertions, 5 deletions
diff --git a/modules/sd_hijack.py b/modules/sd_hijack.py
index b824b5bf..ce583950 100644
--- a/modules/sd_hijack.py
+++ b/modules/sd_hijack.py
@@ -182,11 +182,7 @@ def register_buffer(self, name, attr):
if type(attr) == torch.Tensor:
if attr.device != devices.device:
-
- if devices.has_mps():
- attr = attr.to(device="mps", dtype=torch.float32)
- else:
- attr = attr.to(devices.device)
+ attr = attr.to(device=devices.device, dtype=(torch.float32 if devices.device.type == 'mps' else None))
setattr(self, name, attr)