Skip to content

Commit

Permalink
Use large runners on Windows to build with FA
Browse files Browse the repository at this point in the history
  • Loading branch information
danthe3rd committed Oct 20, 2023
1 parent de59cfc commit c97990b
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 27 deletions.
7 changes: 0 additions & 7 deletions .github/actions/setup-windows-runner/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,6 @@ runs:
- name: Setup MSVC
uses: ilammy/msvc-dev-cmd@v1

- name: Configure Pagefile
# windows runners will OOM with many CUDA architectures
# we cheat here with a page file
uses: al-cheb/configure-pagefile-action@v1.3
with:
minimum-size: 8GB

# really unfortunate: https://github.com/ilammy/msvc-dev-cmd#name-conflicts-with-shell-bash
- name: Remove link.exe
shell: bash
Expand Down
7 changes: 3 additions & 4 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ jobs:
fail-fast: false
matrix:
os:
- 4-core-ubuntu
- windows-2019
- 8-core-ubuntu
- windows-8-core
python:
- "3.8"
- "3.9"
Expand All @@ -39,7 +39,7 @@ jobs:
- torch_version: "2.1.0"
publish: true
# Publish source distribution only from this runner
- os: 4-core-ubuntu
- os: 8-core-ubuntu
python: "3.10"
torch_version: "2.1.0"
sdist: true
Expand All @@ -59,4 +59,3 @@ jobs:
twine_username: __token__
secrets:
twine_password: ${{ secrets.PYPI_TOKEN }}

40 changes: 24 additions & 16 deletions .github/workflows/wheels_reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ on:
env:
# you need at least cuda 5.0 for some of the stuff compiled here.
TORCH_CUDA_ARCH_LIST: "5.0+PTX 6.0 6.1 7.0 7.5 8.0+PTX"
MAX_JOBS: 1
MAX_JOBS: 4
DISTUTILS_USE_SDK: 1 # otherwise distutils will complain on windows about multiple versions of msvc
XFORMERS_BUILD_TYPE: "Release"
TWINE_USERNAME: __token__
Expand Down Expand Up @@ -123,16 +123,24 @@ jobs:
echo "${{ inputs.pypirc }}" > ~/.pypirc
cat ~/.pypirc
- name: Create venv
run: |
$PY -m venv venv
. ./venv/bin/activate
which pip
pip install packaging ninja
which ninja
- name: Define version
id: xformers_version
run: |
set -Eeuo pipefail
. ./venv/bin/activate
git config --global --add safe.directory "*"
$PY -m pip install packaging
version=`$PY packaging/compute_wheel_version.py`
version=`python packaging/compute_wheel_version.py`
echo $version > version.txt
echo "BUILD_VERSION=$version${{ steps.cuda_info.outputs.CUDA_VERSION_SUFFIX }}" >> ${GITHUB_ENV}
echo "BUILD_VERSION=$version${{ steps.cuda_info.outputs.CUDA_VERSION_SUFFIX }}" >> ${GITHUB_OUTPUT}
which ninja
cat ${GITHUB_ENV}
- run: echo "xformers-${BUILD_VERSION}"
- run: echo "release version (will upload to PyTorch)"
Expand All @@ -152,14 +160,6 @@ jobs:
./aws/install
aws --version
# TODO: This is needed because github-actions takes more than 6 hours (!)
# to build Flash-Attention on windows, and times out.
# We need to use bigger gh-action workers...
- if: runner.os == 'Windows'
name: (Windows) Disable Flash-Attention build
run: |
echo "XFORMERS_DISABLE_FLASH_ATTN=1" >> ${GITHUB_ENV}
- if: runner.os == 'Windows'
name: (Windows) Setup Runner
uses: ./.github/actions/setup-windows-runner
Expand All @@ -168,7 +168,9 @@ jobs:
python: ${{ inputs.python }}

- name: Install dependencies
run: $PY -m pip install wheel setuptools twine -r requirements.txt --extra-index-url https://download.pytorch.org/whl/cu${{ inputs.cuda_short_version }}
run: |
. ./venv/bin/activate
pip install wheel setuptools twine -r requirements.txt --extra-index-url https://download.pytorch.org/whl/cu${{ inputs.cuda_short_version }}
- if: runner.os == 'Linux'
name: (Linux) install cuda
Expand All @@ -181,17 +183,20 @@ jobs:
- name: Create source distribution
if: inputs.sdist
run: |
. ./venv/bin/activate
rm -rf dist/
(cd third_party/flash-attention && \
git describe --tags --always > version.txt && \
echo "Flash-Attention version" && \
cat version.txt
)
$PY setup.py sdist -d sdist/
python setup.py sdist -d sdist/
- name: Build wheel
run: $PY setup.py bdist_wheel -d dist/ -k $PLAT_ARG
run: |
. ./venv/bin/activate
python setup.py bdist_wheel -d dist/ -k $PLAT_ARG
env:
PLAT_ARG: ${{ contains(inputs.os, 'ubuntu') && '--plat-name manylinux2014_x86_64' || '' }}

Expand All @@ -204,15 +209,18 @@ jobs:

- name: Upload wheel to PyPi
if: inputs.publish && steps.cuda_info.outputs.PUBLISH_PYPI == '1'
run: $PY -m twine upload dist/*.whl
run: |
. ./venv/bin/activate
python -m twine upload dist/*.whl
env:
TWINE_USERNAME: ${{ inputs.twine_username }}
TWINE_PASSWORD: ${{ secrets.twine_password }}

- name: Upload source distribution to PyPi
if: inputs.publish && steps.cuda_info.outputs.PUBLISH_PYPI == '1' && inputs.sdist
run: |
$PY -m twine upload sdist/*
. ./venv/bin/activate
python -m twine upload sdist/*
env:
TWINE_USERNAME: ${{ inputs.twine_username }}
TWINE_PASSWORD: ${{ secrets.twine_password }}
Expand Down

0 comments on commit c97990b

Please sign in to comment.