Unverified Commit cb1b9231 authored by Muyang Li's avatar Muyang Li Committed by GitHub
Browse files

chore: add linux nightly build workflows

* update the manylinux2_28 builder

* add a workflow

* finished the nightly-build wheels
parent 67a20245
#name: Nightly Build name: Nightly Build
#
#on: on:
# schedule: schedule:
# - cron: '0 8 * * *' - cron: '0 8 * * *' # UTC time
# workflow_dispatch: workflow_dispatch:
#
#jobs: permissions:
# tag: contents: write
# name: Tag Dev Branch if dev version
# runs-on: ubuntu-latest jobs:
# outputs: tag:
# is_dev: ${{ steps.check.outputs.is_dev }} name: Tag Dev Branch if dev version
# tag_name: ${{ steps.tag.outputs.tag_name }} runs-on: ubuntu-latest
# steps: if: github.repository == 'mit-han-lab/nunchaku'
# - name: Checkout dev branch outputs:
# uses: actions/checkout@v4 is_dev: ${{ steps.check.outputs.is_dev }}
# with: tag_name: ${{ steps.tag.outputs.tag_name }}
# fetch-depth: 0 steps:
# ref: dev - name: Checkout dev branch
# uses: actions/checkout@v4
# - name: Extract version from __version__.py with:
# id: version fetch-depth: 0
# run: | ref: dev
# version=$(grep '__version__' nunchaku/__version__.py | sed -E 's/.*"([^"]+)".*/\1/')
# echo "version=$version" >> "$GITHUB_OUTPUT" - name: Extract version from __version__.py
# echo "Extracted version: $version" id: version
# run: |
# - name: Check if version contains 'dev' version=$(grep '__version__' nunchaku/__version__.py | sed -E 's/.*"([^"]+)".*/\1/')
# id: check echo "Extracted version: $version"
# run: | echo "version=$version" >> "$GITHUB_OUTPUT"
# if [[ "${{ steps.version.outputs.version }}" == *dev* ]]; then
# echo "is_dev=true" >> "$GITHUB_OUTPUT" - name: Check if version contains 'dev'
# else id: check
# echo "is_dev=false" >> "$GITHUB_OUTPUT" run: |
# fi if [[ "${{ steps.version.outputs.version }}" == *dev* ]]; then
# echo "is_dev=true" >> "$GITHUB_OUTPUT"
# - name: Set tag name else
# id: tag echo "is_dev=false" >> "$GITHUB_OUTPUT"
# if: steps.check.outputs.is_dev == 'true' fi
# run: |
# today=$(date -u +"%Y%m%d") - name: Set tag name
# tag_name="v${{ steps.version.outputs.version }}-$today" id: tag
# echo "tag_name=$tag_name" >> "$GITHUB_OUTPUT" if: steps.check.outputs.is_dev == 'true'
# run: |
# - name: Create and push tag today=$(date -u +"%Y%m%d")
# if: steps.check.outputs.is_dev == 'true' tag_name="v${{ steps.version.outputs.version }}-$today"
# run: | echo "tag_name=$tag_name"
# git config user.name "github-actions" echo "tag_name=$tag_name" >> "$GITHUB_OUTPUT"
# git config user.email "github-actions@users.noreply.github.com"
# git tag ${{ steps.tag.outputs.tag_name }} - name: Create and push tag
# git push origin ${{ steps.tag.outputs.tag_name }} if: steps.check.outputs.is_dev == 'true'
# run: |
# - name: Skip tagging (version is not dev) git config user.name "github-actions"
# if: steps.check.outputs.is_dev == 'false' git config user.email "github-actions@users.noreply.github.com"
# run: echo "Version is not a dev version. Skipping tag." git tag ${{ steps.tag.outputs.tag_name }}
# git push origin ${{ steps.tag.outputs.tag_name }}
# windows-build:
# name: Build the windows nightly wheels - name: Skip tagging (version is not dev)
# runs-on: self-hosted, windows-build if: steps.check.outputs.is_dev == 'false'
# needs: tag run: echo "Version is not a dev version. Skipping tag."
# if: needs.tag.outputs.is_dev == 'true'
# steps: linux-wheels:
# - name: Checkout to the tag name: Build the linux nightly wheels
# uses: actions/checkout@v4 runs-on: [self-hosted, linux-build]
# with: needs: tag
# fetch-depth: 0 if: needs.tag.outputs.is_dev == 'true'
# ref: ${{ needs.tag.outputs.tag_name }} steps:
# submodules: true - name: Checkout to the tag
# - name: Show current commit uses: actions/checkout@v4
# run: git log -1 --oneline with:
# - name: setup Conda fetch-depth: 0
# run: | ref: ${{ needs.tag.outputs.tag_name }}
# pwd submodules: true
# - name: Build all wheels
# run: .\scripts\build_all_windows_wheels.cmd - name: Show current commit
# - name: Upload wheels run: git log -1 --oneline
# run: |
# echo "Uploading wheels" - name: Build wheels
# mkdir -p wheels run: |
# cp dist/*.whl wheels/ bash scripts/build_linux_wheel.sh "3.10" "2.7" "12.8"
#
# - name: Upload wheels to GitHub Release
uses: softprops/action-gh-release@v2
with:
files: dist/*.whl
name: Nunchaku Nightly ${{ needs.tag.outputs.tag_name }}
tag_name: ${{ needs.tag.outputs.tag_name }}
prerelease: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Clean up
run: bash scripts/linux_cleanup.sh
linux-clean-up:
if: always()
needs: [ linux-wheels ]
runs-on: [ self-hosted, linux-build ]
steps:
- name: Clean up
run: |
cd ..
rm -rf *nunchaku*
...@@ -22,6 +22,6 @@ bash scripts/build_linux_wheel.sh "3.10" "2.7" "12.8" ...@@ -22,6 +22,6 @@ bash scripts/build_linux_wheel.sh "3.10" "2.7" "12.8"
bash scripts/build_linux_wheel.sh "3.11" "2.7" "12.8" bash scripts/build_linux_wheel.sh "3.11" "2.7" "12.8"
bash scripts/build_linux_wheel.sh "3.12" "2.7" "12.8" bash scripts/build_linux_wheel.sh "3.12" "2.7" "12.8"
bash scripts/build_linux_wheel_cu128.sh "3.10" "2.8" "12.8" #bash scripts/build_linux_wheel_cu128.sh "3.10" "2.8" "12.8"
bash scripts/build_linux_wheel_cu128.sh "3.11" "2.8" "12.8" #bash scripts/build_linux_wheel_cu128.sh "3.11" "2.8" "12.8"
bash scripts/build_linux_wheel_cu128.sh "3.12" "2.8" "12.8" #bash scripts/build_linux_wheel_cu128.sh "3.12" "2.8" "12.8"
...@@ -26,12 +26,10 @@ fi ...@@ -26,12 +26,10 @@ fi
docker run --rm \ docker run --rm \
-v "$(pwd)":/nunchaku \ -v "$(pwd)":/nunchaku \
pytorch/manylinux-builder:cuda${CUDA_VERSION} \ pytorch/manylinux2_28-builder:cuda${CUDA_VERSION} \
bash -c " bash -c "
cd /nunchaku && \ cd /nunchaku && \
rm -rf build && \ rm -rf build && \
yum install -y devtoolset-11 && \
source scl_source enable devtoolset-11 && \
gcc --version && g++ --version && \ gcc --version && g++ --version && \
${PYTHON_ROOT_PATH}/bin/pip install --no-cache-dir torch==${TORCH_VERSION} torchvision==${TORCHVISION_VERSION} torchaudio==${TORCHAUDIO_VERSION} --index-url https://download.pytorch.org/whl/cu${CUDA_VERSION//.} && \ ${PYTHON_ROOT_PATH}/bin/pip install --no-cache-dir torch==${TORCH_VERSION} torchvision==${TORCHVISION_VERSION} torchaudio==${TORCHAUDIO_VERSION} --index-url https://download.pytorch.org/whl/cu${CUDA_VERSION//.} && \
${PYTHON_ROOT_PATH}/bin/pip install build ninja wheel setuptools && \ ${PYTHON_ROOT_PATH}/bin/pip install build ninja wheel setuptools && \
......
#!/bin/bash
# Modified from https://github.com/sgl-project/sglang/blob/main/sgl-kernel/build.sh
set -ex
PYTHON_VERSION=$1
TORCH_VERSION=$2 # has no use for now
CUDA_VERSION=$3
MAX_JOBS=${4:-} # optional
PYTHON_ROOT_PATH=/opt/python/cp${PYTHON_VERSION//.}-cp${PYTHON_VERSION//.}
# Check if TORCH_VERSION is 2.5 or 2.6 and set the corresponding versions for TORCHVISION and TORCHAUDIO
#if [ "$TORCH_VERSION" == "2.5" ]; then
# TORCHVISION_VERSION="0.20"
# TORCHAUDIO_VERSION="2.5"
# echo "TORCH_VERSION is 2.5, setting TORCHVISION_VERSION to $TORCHVISION_VERSION and TORCHAUDIO_VERSION to $TORCHAUDIO_VERSION"
#elif [ "$TORCH_VERSION" == "2.6" ]; then
# TORCHVISION_VERSION="0.21"
# TORCHAUDIO_VERSION="2.6"
# echo "TORCH_VERSION is 2.6, setting TORCHVISION_VERSION to $TORCHVISION_VERSION and TORCHAUDIO_VERSION to $TORCHAUDIO_VERSION"
#else
# echo "TORCH_VERSION is not 2.5 or 2.6, no changes to versions."
#fi
docker run --rm \
-v "$(pwd)":/nunchaku \
pytorch/manylinux2_28-builder:cuda${CUDA_VERSION} \
bash -c "
cd /nunchaku && \
rm -rf build && \
gcc --version && g++ --version && \
${PYTHON_ROOT_PATH}/bin/pip install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cu128 && \
${PYTHON_ROOT_PATH}/bin/pip install build ninja wheel setuptools && \
export NUNCHAKU_INSTALL_MODE=ALL && \
export NUNCHAKU_BUILD_WHEELS=1 && \
export MAX_JOBS=${MAX_JOBS} && \
${PYTHON_ROOT_PATH}/bin/python -m build --wheel --no-isolation
"
...@@ -3,5 +3,5 @@ set -ex ...@@ -3,5 +3,5 @@ set -ex
docker run --rm \ docker run --rm \
-v "$(pwd)":/nunchaku \ -v "$(pwd)":/nunchaku \
pytorch/manylinux-builder:cuda12.4 \ pytorch/manylinux2_28-builder:cuda12.4 \
bash -c "cd /nunchaku && rm -rf *" bash -c "cd /nunchaku && rm -rf *"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment