mirror of
https://github.com/open-webui/open-webui.git
synced 2026-09-10 22:43:29 +00:00
perf: skip torch import on non-macOS
This commit is contained in:
parent
c40ea7f29d
commit
5e93ec07f3
1 changed files with 7 additions and 6 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue