From db96b3458301b1f418f089f0ea10d79bd3f431ae Mon Sep 17 00:00:00 2001 From: 1000850000 user Date: Wed, 26 Jun 2024 18:46:39 +0000 Subject: [PATCH] build autogptq --- .github/workflows/build.yml | 92 +++++++++++++++++++------------------ 1 file changed, 48 insertions(+), 44 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f9bb4543..cbb1299d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -13,8 +13,12 @@ jobs: runs-on: ubuntu-latest strategy: matrix: + cuda-version: + - '12.1' python-version: - setup: "3.9" + torch-version: + - '2.2.2' plugin_name: - "framework" - "accelerated-peft" @@ -29,6 +33,16 @@ jobs: steps: - uses: actions/checkout@v4 + # need to free up disk space for installation of toolkit and libraries + - name: Free up disk space + if: ${{ runner.os == 'Linux' }} + # https://github.com/easimon/maximize-build-space/blob/master/action.yml + # https://github.com/easimon/maximize-build-space/tree/test-report + run: | + sudo rm -rf /usr/share/dotnet + sudo rm -rf /opt/ghc + sudo rm -rf /opt/hostedtoolcache/CodeQL + - name: Set up Python ${{ matrix.python-version.setup }} uses: actions/setup-python@v4 with: @@ -39,55 +53,45 @@ jobs: python -m pip install --upgrade pip python -m pip install tox - - name: Run Tests - run: | - cd plugins/${{ matrix.plugin_name }} - tox -e py + - name: Install CUDA ${{ matrix.cuda-version }} + if: ${{ matrix.plugin_name == 'accelerated-peft' }} + uses: Jimver/cuda-toolkit@v0.2.16 + id: cuda-toolkit + with: + cuda: ${{ matrix.cuda-version }}.0 + linux-local-args: '["--toolkit"]' + method: 'network' + # sub-packages: '["nvcc"]' + # non-cuda-sub-packages: '["libcublas", "libcufft", "cuda-runtime"]' - - name: Build and check wheel package + - name: Building AutoGPTQ + if: ${{ matrix.plugin_name == 'accelerated-peft' }} run: | - cd plugins/${{ matrix.plugin_name }} - tox -e build - ls dist/ + python -m pip install torch --index-url https://download.pytorch.org/whl/cu${{{ matrix.cuda-version }}//./} - # push to Test PyPI on - # - a new GitHub release is published - # - a PR is merged into main branch - publish-test-pypi: - name: Publish packages to test.pypi.org - # environment: publish-test-pypi - if: ${{ (github.event.action == 'published') || ((github.event_name == 'push') && (github.ref == 'refs/heads/actions/whl_build')) }} - permissions: - contents: read - # see https://docs.pypi.org/trusted-publishers/ - id-token: write - runs-on: ubuntu-latest - strategy: - matrix: - python-version: - - setup: "3.9" - plugin_name: - - "framework" - - "accelerated-peft" - - "fused-ops-and-kernels" + export CUDA_HOME=/usr/local/cuda-${{ matrix.cuda-version }} + export LD_LIBRARY_PATH=/usr/local/cuda-${{ matrix.cuda-version }}/lib64:$LD_LIBRARY_PATH + export TORCH_CUDA_ARCH_LIST="6.0 6.1 7.0 7.5 8.0 8.6 8.9 9.0+PTX" - needs: build-package + # extract AutoGPTQ from requirements and add to src + cd plugins/${{ matrix.plugin_name }}/src + target="$(sed -n "/^auto_gptq / {s%.*git+%%; p;}" plugins/${{ matrix.plugin_name }}/requirements.txt)"; + git clone "$(cut -d@ -f1 <<< "$target")"; + cd AutoGPTQ + git checkout "$(cut -d@ -f2 <<< "$target")" - steps: - - name: "Harden Runner" - uses: step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 # v2.8.1 - with: - egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs + # do we need to build here or leave it to package manager + python setup.py sdist - - name: "Download build artifacts" - uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 - with: - path: plugins/${{ matrix.plugin_name }}/dist + ls - - name: Display structure of downloaded files - run: ls -R + # - name: Build and check wheel package + # run: | + # cd plugins/${{ matrix.plugin_name }} + # tox -e build + # ls dist - # - name: "Upload to Test PyPI" - # uses: pypa/gh-action-pypi-publish@ec4db0b4ddc65acdf4bff5fa45ac92d78b56bdf0 # v1.9.0 - # with: - # repository-url: https://test.pypi.org/legacy/ \ No newline at end of file + # - name: "Upload to Test PyPI" + # uses: pypa/gh-action-pypi-publish@ec4db0b4ddc65acdf4bff5fa45ac92d78b56bdf0 # v1.9.0 + # with: + # repository-url: https://test.pypi.org/legacy/