Build Wheels #1
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
name: Build Wheels | |
on: workflow_dispatch | |
jobs: | |
build_wheels: | |
name: ${{ matrix.os }} Python ${{ matrix.pyver }} CUDA ${{ matrix.cuda }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-20.04, windows-latest] | |
pyver: ["3.8", "3.9", "3.10", "3.11"] | |
cuda: ["11.7.0", "11.8.0", "12.1.1"] | |
defaults: | |
run: | |
shell: pwsh | |
env: | |
CUDAVER: ${{ matrix.cuda }} | |
PYVER: ${{ matrix.pyver }} | |
steps: | |
- name: Free Disk Space | |
uses: jlumbroso/[email protected] | |
if: runner.os == 'Linux' | |
with: | |
tool-cache: false | |
android: true | |
dotnet: true | |
haskell: true | |
large-packages: false | |
swap-storage: false | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v3 | |
with: | |
python-version: ${{ matrix.pyver }} | |
- name: Setup Mamba | |
uses: conda-incubator/[email protected] | |
with: | |
activate-environment: "build" | |
python-version: ${{ matrix.pyver }} | |
miniforge-variant: Mambaforge | |
miniforge-version: latest | |
use-mamba: true | |
add-pip-as-python-dependency: true | |
auto-activate-base: false | |
- name: Install Dependencies | |
run: | | |
$cudaVersion = $env:CUDAVER | |
$cudaVersionPytorch = $env:CUDAVER.Remove($env:CUDAVER.LastIndexOf('.')).Replace('.','') | |
$cudaChannels = '' | |
$cudaNum = [int]$cudaVersion.substring($cudaVersion.LastIndexOf('.')+1) | |
while ($cudaNum -ge 0) { $cudaChannels += '-c nvidia/label/cuda-' + $cudaVersion.Remove($cudaVersion.LastIndexOf('.')+1) + $cudaNum + ' '; $cudaNum-- } | |
mamba install -y 'cuda' $cudaChannels.TrimEnd().Split() | |
if ([version]$env:CUDAVER -gt [version]'11.8.0') {$torchver = "torch==2.1.0.* --pre --index-url https://download.pytorch.org/whl/nightly/cu$cudaVersionPytorch"} else {$torchver = "torch --index-url https://download.pytorch.org/whl/cu$cudaVersionPytorch"} | |
python -m pip install $torchver.split() | |
python -m pip install build wheel safetensors sentencepiece ninja | |
- name: Build Wheel | |
run: | | |
$env:CUDA_PATH = $env:CONDA_PREFIX | |
$env:CUDA_HOME = $env:CONDA_PREFIX | |
$cudaVersion = $env:CUDAVER | |
$cudaVersionPytorch = $env:CUDAVER.Remove($env:CUDAVER.LastIndexOf('.')).Replace('.','') | |
$BUILDTAG = "+cu$cudaVersionPytorch" | |
if ($IsLinux) {$env:LD_LIBRARY_PATH = $env:CONDA_PREFIX + '/lib:' + $env:LD_LIBRARY_PATH} | |
$env:TORCH_CUDA_ARCH_LIST = if ([version]$env:CUDAVER -lt [version]'11.8') {'6.0 6.1 7.0 7.5 8.0 8.6+PTX'} else {'6.0 6.1 7.0 7.5 8.0 8.6 8.9 9.0+PTX'} | |
python -m build -n --wheel -C--build-option=egg_info "-C--build-option=--tag-build=$BUILDTAG" | |
if ($IsLinux -and $env:PYVER -eq '3.11' -and $env:CUDAVER -eq '11.8.0') {$env:EXLLAMA_NOCOMPILE=1; python -m build -n} | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: 'wheels' | |
path: ./dist/* | |
build_rocm: | |
name: Build ROCm Wheels & Release | |
needs: build_wheels | |
uses: ./.github/workflows/build-wheels-rocm.yml |