Skip to content
This repository was archived by the owner on May 11, 2025. It is now read-only.

Commit e87ebcd

Browse files
committed
Add code for saving for release on PyPi
1 parent 16c5fe1 commit e87ebcd

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

.github/workflows/build.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ jobs:
4646
run:
4747
shell: pwsh
4848
env:
49+
PYPI_CUDA_VERSION: "12.1.1"
4950
CUDA_VERSION: ${{ matrix.cuda }}
5051

5152
steps:
@@ -106,6 +107,11 @@ jobs:
106107
$env:CUDA_PATH = $env:CONDA_PREFIX
107108
$env:CUDA_HOME = $env:CONDA_PREFIX
108109
110+
# Only add +cu118 to wheel if not releasing on PyPi
111+
if ( $env:CUDA_VERSION -eq $env:PYPI_CUDA_VERSION ){
112+
$env:PYPI_BUILD = 1
113+
}
114+
109115
python setup.py sdist bdist_wheel
110116
111117
- name: Upload Assets

setup.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@
88
os.environ["CC"] = "g++"
99
os.environ["CXX"] = "g++"
1010
AUTOAWQ_KERNELS_VERSION = "0.0.1"
11-
12-
try:
13-
CUDA_VERSION = "".join(os.environ.get("CUDA_VERSION", torch.version.cuda).split("."))[:3]
14-
AUTOAWQ_KERNELS_VERSION += f"+cu{CUDA_VERSION}"
15-
except Exception as ex:
16-
raise RuntimeError("Your system must have an Nvidia GPU for installing AutoAWQ")
11+
PYPI_BUILD = os.getenv("PYPI_BUILD", "0") == "1"
12+
13+
if not PYPI_BUILD:
14+
try:
15+
CUDA_VERSION = "".join(os.environ.get("CUDA_VERSION", torch.version.cuda).split("."))[:3]
16+
AUTOAWQ_KERNELS_VERSION += f"+cu{CUDA_VERSION}"
17+
except Exception as ex:
18+
raise RuntimeError("Your system must have an Nvidia GPU for installing AutoAWQ")
1719

1820
common_setup_kwargs = {
1921
"version": AUTOAWQ_KERNELS_VERSION,

0 commit comments

Comments
 (0)