From 6b634d0e7e7a7059f9fdf8434b7d92d3da2953ff Mon Sep 17 00:00:00 2001 From: Michael Wyatt Date: Sun, 8 Oct 2023 18:33:17 -0700 Subject: [PATCH] move torch import (#4468) --- op_builder/async_io.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/op_builder/async_io.py b/op_builder/async_io.py index da511a0a8c9d..b55c821910b9 100644 --- a/op_builder/async_io.py +++ b/op_builder/async_io.py @@ -5,7 +5,6 @@ import distutils.spawn import subprocess -import torch from .builder import OpBuilder @@ -36,6 +35,7 @@ def cxx_args(self): # -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'