perf: skip torch import on non-macOS (#23438)

This commit is contained in:
Algorithm5838 authored and GitHub committed 2026-04-08 13:21:55 -07:00
1 parent 2112a99b36
commit f9ceb7fa89
1 file changed
+3 -2
+3 -2
View File
@@ -60,12 +60,13 @@ if USE_CUDA.lower() == 'true':
else:
DEVICE_TYPE = 'cpu'
try:
if sys.platform == 'darwin':
try:
import torch
if torch.backends.mps.is_available() and torch.backends.mps.is_built():
DEVICE_TYPE = 'mps'
except Exception:
except Exception:
pass
####################################