File tree Expand file tree Collapse file tree 4 files changed +19
-17
lines changed Expand file tree Collapse file tree 4 files changed +19
-17
lines changed Original file line number Diff line number Diff line change 7
7
8
8
set -eux
9
9
10
- WHEEL_NAME=$( ls dist/)
10
+ # Prepare manywheel, only for CUDA.
11
+ # The wheel is a pure python wheel for other platforms.
12
+ if [[ " $CU_VERSION " == cu* ]]; then
13
+ WHEEL_NAME=$( ls dist/)
11
14
12
- pushd dist
13
- # Prepare manywheel
14
- manylinux_plat=manylinux2014_x86_64
15
- if [[ " $CU_VERSION " == " xpu" ]]; then
16
- manylinux_plat=manylinux_2_28_x86_64
17
- fi
18
- auditwheel repair --plat " $manylinux_plat " -w . \
15
+ pushd dist
16
+ manylinux_plat=manylinux2014_x86_64
17
+ auditwheel repair --plat " $manylinux_plat " -w . \
19
18
--exclude libtorch.so \
20
19
--exclude libtorch_python.so \
21
20
--exclude libtorch_cuda.so \
@@ -26,10 +25,11 @@ auditwheel repair --plat "$manylinux_plat" -w . \
26
25
--exclude libcudart.so.11.0 \
27
26
" ${WHEEL_NAME} "
28
27
29
- ls -lah .
30
- # Clean up the linux_x86_64 wheel
31
- rm " ${WHEEL_NAME} "
32
- popd
28
+ ls -lah .
29
+ # Clean up the linux_x86_64 wheel
30
+ rm " ${WHEEL_NAME} "
31
+ popd
32
+ fi
33
33
34
34
MANYWHEEL_NAME=$( ls dist/)
35
35
# Try to install the new wheel
Original file line number Diff line number Diff line change @@ -110,6 +110,9 @@ def get_extensions():
110
110
if use_cuda :
111
111
sources += cuda_sources
112
112
113
+ if len (sources ) == 0 :
114
+ return None
115
+
113
116
ext_modules = [
114
117
extension (
115
118
"torchao._C" ,
Original file line number Diff line number Diff line change 22
22
)
23
23
if not _IS_FBCODE :
24
24
try :
25
- from . import _C
25
+ from pathlib import Path
26
+ so_files = list (Path (__file__ ).parent .glob ("_C*.so" ))
27
+ assert len (so_files ) == 1 , f"Expected one _C*.so file, found { len (so_files )} "
28
+ torch .ops .load_library (so_files [0 ])
26
29
from . import ops
27
30
except :
28
- _C = None
29
31
logging .info ("Skipping import of cpp extensions" )
30
32
31
33
from torchao .quantization import (
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments