mirror of
https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
synced 2025-08-04 11:12:35 +00:00
Merge pull request #5194 from brkirch/autocast-and-mps-randn-fixes
Use devices.autocast() and fix MPS randn issues
This commit is contained in:
@@ -183,11 +183,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)
|
||||
|
||||
|
Reference in New Issue
Block a user