remove MacOS Sonoma check in devices.py (#5312)

* remove MacOS Sonoma check in devices.py

As of pytorch 2.1.0, float16 works with our MPS fixes on Sonoma, so the check is no longer needed.

* remove unused platform import
This commit is contained in:
gogurtenjoyer 2023-12-21 19:42:47 -05:00 committed by GitHub
parent 64858b2523
commit 2d11d97dad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,11 +1,9 @@
from __future__ import annotations from __future__ import annotations
import platform
from contextlib import nullcontext from contextlib import nullcontext
from typing import Union from typing import Union
import torch import torch
from packaging import version
from torch import autocast from torch import autocast
from invokeai.app.services.config import InvokeAIAppConfig from invokeai.app.services.config import InvokeAIAppConfig
@ -37,7 +35,7 @@ def choose_precision(device: torch.device) -> str:
device_name = torch.cuda.get_device_name(device) device_name = torch.cuda.get_device_name(device)
if not ("GeForce GTX 1660" in device_name or "GeForce GTX 1650" in device_name): if not ("GeForce GTX 1660" in device_name or "GeForce GTX 1650" in device_name):
return "float16" return "float16"
elif device.type == "mps" and version.parse(platform.mac_ver()[0]) < version.parse("14.0.0"): elif device.type == "mps":
return "float16" return "float16"
return "float32" return "float32"