|
| 1 | +name: Build Wheels 0.1.66/62 AVX512 |
| 2 | + |
| 3 | +on: workflow_dispatch |
| 4 | + |
| 5 | +permissions: |
| 6 | + contents: write |
| 7 | + |
| 8 | +jobs: |
| 9 | + build_wheels: |
| 10 | + name: Build wheels for ${{ matrix.os }} |
| 11 | + runs-on: ${{ matrix.os }} |
| 12 | + strategy: |
| 13 | + matrix: |
| 14 | + os: [ubuntu-20.04, windows-latest] |
| 15 | + pyver: ["3.7", "3.8", "3.9", "3.10", "3.11"] |
| 16 | + cuda: ["11.6.2", "11.7.1", "11.8.0", "12.0.1", "12.1.0"] |
| 17 | + llamacpp: ['v0.1.66','v0.1.62'] |
| 18 | + defaults: |
| 19 | + run: |
| 20 | + shell: pwsh |
| 21 | + env: |
| 22 | + CUDAVER: ${{ matrix.cuda }} |
| 23 | + LLAMAVER: ${{ matrix.llamacpp }} |
| 24 | + |
| 25 | + steps: |
| 26 | + - uses: actions/checkout@v3 |
| 27 | + - uses: actions/checkout@v3 |
| 28 | + with: |
| 29 | + repository: 'abetlen/llama-cpp-python' |
| 30 | + ref: ${{ matrix.llamacpp }} |
| 31 | + path: 'llama-cpp-python' |
| 32 | + submodules: 'recursive' |
| 33 | + |
| 34 | + - uses: actions/setup-python@v3 |
| 35 | + with: |
| 36 | + python-version: ${{ matrix.pyver }} |
| 37 | + |
| 38 | + - name: Setup Mamba |
| 39 | + uses: conda-incubator/setup-miniconda@v2.2.0 |
| 40 | + with: |
| 41 | + activate-environment: "build" |
| 42 | + python-version: ${{ matrix.pyver }} |
| 43 | + miniforge-variant: Mambaforge |
| 44 | + miniforge-version: latest |
| 45 | + use-mamba: true |
| 46 | + add-pip-as-python-dependency: true |
| 47 | + auto-activate-base: false |
| 48 | + |
| 49 | + - name: Install Dependencies |
| 50 | + run: | |
| 51 | + $cudaVersion = $env:CUDAVER |
| 52 | + $cudaChannels = '' |
| 53 | + $cudaNum = [int]$cudaVersion.substring($cudaVersion.LastIndexOf('.')+1) |
| 54 | + while ($cudaNum -ge 0) { $cudaChannels += '-c nvidia/label/cuda-' + $cudaVersion.Remove($cudaVersion.LastIndexOf('.')+1) + $cudaNum + ' '; $cudaNum-- } |
| 55 | + mamba install -y 'cuda' $cudaChannels.TrimEnd().Split() |
| 56 | + python -m pip install build wheel |
| 57 | + |
| 58 | + - name: Build Wheel |
| 59 | + run: | |
| 60 | + Set-Location 'llama-cpp-python' |
| 61 | + $cudaVersion = $env:CUDAVER.Remove($env:CUDAVER.LastIndexOf('.')).Replace('.','') |
| 62 | + $env:CUDA_PATH = $env:CONDA_PREFIX |
| 63 | + $env:CUDA_HOME = $env:CONDA_PREFIX |
| 64 | + if ($IsLinux) {$env:LD_LIBRARY_PATH = $env:CONDA_PREFIX + '/lib:' + $env:LD_LIBRARY_PATH} |
| 65 | + $env:VERBOSE = '1' |
| 66 | + $env:FORCE_CMAKE = '1' |
| 67 | + $env:CMAKE_ARGS = '-DLLAMA_CUBLAS=on -DLLAMA_AVX512=on' |
| 68 | + if ($env:LLAMAVER -eq 'v0.1.66') {$env:CMAKE_ARGS = $env:CMAKE_ARGS + ' -DCMAKE_CUDA_ARCHITECTURES=all'} |
| 69 | + if ($env:LLAMAVER -eq 'v0.1.62') {$env:CUDAFLAGS = '-arch=all'} |
| 70 | + python -m build --wheel -C--build-option=egg_info "-C--build-option=--tag-build=+cu$cudaVersion" |
| 71 | + |
| 72 | + - name: Upload files to a GitHub release |
| 73 | + uses: svenstaro/upload-release-action@2.6.1 |
| 74 | + with: |
| 75 | + file: ./llama-cpp-python/dist/*.whl |
| 76 | + tag: AVX512 |
| 77 | + file_glob: true |
| 78 | + overwrite: true |
0 commit comments