perf: skip torch import on non-macOS (#23438)
This commit is contained in:
@@ -60,13 +60,14 @@ if USE_CUDA.lower() == 'true':
|
|||||||
else:
|
else:
|
||||||
DEVICE_TYPE = 'cpu'
|
DEVICE_TYPE = 'cpu'
|
||||||
|
|
||||||
try:
|
if sys.platform == 'darwin':
|
||||||
import torch
|
try:
|
||||||
|
import torch
|
||||||
|
|
||||||
if torch.backends.mps.is_available() and torch.backends.mps.is_built():
|
if torch.backends.mps.is_available() and torch.backends.mps.is_built():
|
||||||
DEVICE_TYPE = 'mps'
|
DEVICE_TYPE = 'mps'
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
####################################
|
####################################
|
||||||
# LOGGING
|
# LOGGING
|
||||||
|
|||||||
Reference in New Issue
Block a user