diff --git a/backend/open_webui/env.py b/backend/open_webui/env.py index e0dcaff276..53737a1f2f 100644 --- a/backend/open_webui/env.py +++ b/backend/open_webui/env.py @@ -60,13 +60,14 @@ if USE_CUDA.lower() == 'true': else: DEVICE_TYPE = 'cpu' -try: - import torch +if sys.platform == 'darwin': + try: + import torch - if torch.backends.mps.is_available() and torch.backends.mps.is_built(): - DEVICE_TYPE = 'mps' -except Exception: - pass + if torch.backends.mps.is_available() and torch.backends.mps.is_built(): + DEVICE_TYPE = 'mps' + except Exception: + pass #################################### # LOGGING