From ecabfc252b3625a1c133272166741bbad017245a Mon Sep 17 00:00:00 2001 From: gogurtenjoyer <36354352+gogurtenjoyer@users.noreply.github.com> Date: Fri, 21 Jul 2023 19:59:22 -0400 Subject: [PATCH] devices.py - Update MPS FP16 check to account for upcoming MacOS Sonoma float16 doesn't seem to work on MacOS Sonoma due to further changes with Metal. This'll default back to float32 for Sonoma users. --- invokeai/backend/util/devices.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/invokeai/backend/util/devices.py b/invokeai/backend/util/devices.py index eeabcc35db..2acd5e4834 100644 --- a/invokeai/backend/util/devices.py +++ b/invokeai/backend/util/devices.py @@ -1,6 +1,8 @@ from __future__ import annotations from contextlib import nullcontext +from packaging import version +import platform import torch from torch import autocast @@ -30,7 +32,7 @@ def choose_precision(device: torch.device) -> str: device_name = torch.cuda.get_device_name(device) if not ("GeForce GTX 1660" in device_name or "GeForce GTX 1650" in device_name): return "float16" - elif device.type == "mps": + elif device.type == "mps" and version.parse(platform.mac_ver()[0]) < version.parse('14.0.0'): return "float16" return "float32"