-
Notifications
You must be signed in to change notification settings - Fork 654
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support sgl-kernel PyPI (#2433)
Co-authored-by: Zhangyi <[email protected]>
- Loading branch information
1 parent
2b340ad
commit 56fcd8e
Showing
4 changed files
with
97 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: Release SGLang Kernel to PyPI | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- sgl-kernel/pyproject.toml | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build-wheels: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ['3.9', '3.10', '3.11', '3.12'] | ||
cuda-version: ['11.8', '12.1', '12.4'] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Build wheels for Python ${{ matrix.python-version }} and CUDA ${{ matrix.cuda-version }} | ||
run: | | ||
cd sgl-kernel | ||
chmod +x ./build.sh | ||
./build.sh "${{ matrix.python-version }}" "${{ matrix.cuda-version }}" | ||
- name: Upload to pypi | ||
working-directory: sgl-kernel | ||
run: | | ||
pip install twine | ||
python3 -m twine upload dist/* -u __token__ -p ${{ secrets.PYPI_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,16 @@ | ||
#!/bin/bash | ||
|
||
set -ex | ||
PYTHON_VERSION=$1 | ||
CUDA_VERSION=$2 | ||
PYTHON_ROOT_PATH=/opt/python/cp${PYTHON_VERSION//.}-cp${PYTHON_VERSION//.} | ||
|
||
docker run --rm -it \ | ||
docker run --rm \ | ||
-v "$(pwd)":/sgl-kernel \ | ||
pytorch/manylinux-builder:cuda12.1 \ | ||
pytorch/manylinux-builder:cuda${CUDA_VERSION} \ | ||
bash -c " | ||
pip install --no-cache-dir torch==2.4.0 --index-url https://download.pytorch.org/whl/cu121 && \ | ||
${PYTHON_ROOT_PATH}/bin/pip install --no-cache-dir torch==2.4.0 --index-url https://download.pytorch.org/whl/cu${CUDA_VERSION//.} && \ | ||
export TORCH_CUDA_ARCH_LIST='7.5 8.0 8.9 9.0+PTX' && \ | ||
export CUDA_VERSION=${CUDA_VERSION} && \ | ||
cd /sgl-kernel && \ | ||
python setup.py bdist_wheel | ||
${PYTHON_ROOT_PATH}/bin/python setup.py bdist_wheel | ||
" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters