move torch import (#4468)

This commit is contained in:
Michael Wyatt
2023-10-08 18:33:17 -07:00
committed by GitHub
parent 59d62d614e
commit 6b634d0e7e

View File

@ -5,7 +5,6 @@
import distutils.spawn
import subprocess
import torch
from .builder import OpBuilder
@ -36,6 +35,7 @@ class AsyncIOBuilder(OpBuilder):
# -O0 for improved debugging, since performance is bound by I/O
CPU_ARCH = self.cpu_arch()
SIMD_WIDTH = self.simd_width()
import torch # Keep this import here to avoid errors when building DeepSpeed wheel without torch installed
TORCH_MAJOR, TORCH_MINOR = map(int, torch.__version__.split('.')[0:2])
if TORCH_MAJOR >= 2 and TORCH_MINOR >= 1:
CPP_STD = '-std=c++17'