From 960683eceda2cf1bba46d82b2b7c467dbc200200 Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek <tim@openwebui.com> Date: Mon, 6 Jan 2025 10:08:12 -0800 Subject: [PATCH] fix: torch mps not working Co-Authored-By: Rich Tong <1782087+richtong@users.noreply.github.com> --- backend/open_webui/env.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/backend/open_webui/env.py b/backend/open_webui/env.py index f16f2ea6e..bfe7ced8a 100644 --- a/backend/open_webui/env.py +++ b/backend/open_webui/env.py @@ -54,6 +54,8 @@ else: DEVICE_TYPE = "cpu" try: + import torch + if torch.backends.mps.is_available() and torch.backends.mps.is_built(): DEVICE_TYPE = "mps" except Exception: