-
-
Notifications
You must be signed in to change notification settings - Fork 337
147 lines (115 loc) · 7.2 KB
/
build-wheels-release-rocm.yml
File metadata and controls
147 lines (115 loc) · 7.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
name: Build Wheels & Release ROCm62
on:
workflow_dispatch:
inputs:
release:
description: 'Release? 1 = yes, 0 = no'
default: '0'
required: true
type: string
permissions:
contents: write
jobs:
build_wheels:
name: ${{ matrix.os }} P${{ matrix.pyver }} C${{ matrix.cuda }} R${{ matrix.rocm }} T${{ matrix.torch }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
# Ubuntu 22.04 CUDA
# ROCm 6.2
- { artname: 'wheel', os: ubuntu-22.04-l, pyver: '3.10', cuda: '', rocm: '6.2', torch: '2.5.0', cudaarch: '' }
- { artname: 'wheel', os: ubuntu-22.04-l, pyver: '3.11', cuda: '', rocm: '6.2', torch: '2.5.0', cudaarch: '' }
- { artname: 'wheel', os: ubuntu-22.04-l, pyver: '3.12', cuda: '', rocm: '6.2', torch: '2.5.0', cudaarch: '' }
# ROCm 6.2.4
- { artname: 'wheel', os: ubuntu-22.04-l, pyver: '3.10', cuda: '', rocm: '6.2.4', torch: '2.6.0', cudaarch: '' }
- { artname: 'wheel', os: ubuntu-22.04-l, pyver: '3.11', cuda: '', rocm: '6.2.4', torch: '2.6.0', cudaarch: '' }
- { artname: 'wheel', os: ubuntu-22.04-l, pyver: '3.12', cuda: '', rocm: '6.2.4', torch: '2.6.0', cudaarch: '' }
- { artname: 'wheel', os: ubuntu-22.04-l, pyver: '3.13', cuda: '', rocm: '6.2.4', torch: '2.6.0', cudaarch: '' }
# ROCm 6.3
- { artname: 'wheel', os: ubuntu-22.04-l, pyver: '3.10', cuda: '', rocm: '6.3', torch: '2.7.0', cudaarch: '' }
- { artname: 'wheel', os: ubuntu-22.04-l, pyver: '3.11', cuda: '', rocm: '6.3', torch: '2.7.0', cudaarch: '' }
- { artname: 'wheel', os: ubuntu-22.04-l, pyver: '3.12', cuda: '', rocm: '6.3', torch: '2.7.0', cudaarch: '' }
- { artname: 'wheel', os: ubuntu-22.04-l, pyver: '3.13', cuda: '', rocm: '6.3', torch: '2.7.0', cudaarch: '' }
# ROCm 6.4 + Torch 2.8
- { artname: 'wheel', os: ubuntu-22.04-l, pyver: '3.10', cuda: '', rocm: '6.4', torch: '2.8.0', cudaarch: '' }
- { artname: 'wheel', os: ubuntu-22.04-l, pyver: '3.11', cuda: '', rocm: '6.4', torch: '2.8.0', cudaarch: '' }
- { artname: 'wheel', os: ubuntu-22.04-l, pyver: '3.12', cuda: '', rocm: '6.4', torch: '2.8.0', cudaarch: '' }
- { artname: 'wheel', os: ubuntu-22.04-l, pyver: '3.13', cuda: '', rocm: '6.4', torch: '2.8.0', cudaarch: '' }
# ROCm 6.4 + Torch 2.9
- { artname: 'wheel', os: ubuntu-22.04-l, pyver: '3.10', cuda: '', rocm: '6.4', torch: '2.9.0', cudaarch: '' }
- { artname: 'wheel', os: ubuntu-22.04-l, pyver: '3.11', cuda: '', rocm: '6.4', torch: '2.9.0', cudaarch: '' }
- { artname: 'wheel', os: ubuntu-22.04-l, pyver: '3.12', cuda: '', rocm: '6.4', torch: '2.9.0', cudaarch: '' }
- { artname: 'wheel', os: ubuntu-22.04-l, pyver: '3.13', cuda: '', rocm: '6.4', torch: '2.9.0', cudaarch: '' }
fail-fast: false
defaults:
run:
shell: pwsh
steps:
# Free disk space
- name: Free Disk Space
uses: jlumbroso/free-disk-space@v1.3.1
if: runner.os == 'Linux'
with:
tool-cache: true
android: true
dotnet: true
haskell: true
large-packages: false
swap-storage: true
- uses: actions/checkout@v4
# Get version string from package
- name: Get version string
id: package_version
run: |
$versionString = Get-Content $(Join-Path 'exllamav2' 'version.py') -raw
if ($versionString -match '__version__ = "(\d+\.(?:\d+\.?(?:dev\d+)?)*)"')
{
Write-Output $('::notice file=build-wheels-release.yml,line=200,title=Package Version::Detected package version is: {0}' -f $Matches[1])
Write-Output "PACKAGE_VERSION=$($Matches[1])" >> "$env:GITHUB_OUTPUT"
}
else
{
Write-Output '::error file=build-wheels-release.yml,line=203::Could not parse version from exllamav2/version.py! You must upload wheels manually!'
Write-Output "PACKAGE_VERSION=None" >> "$env:GITHUB_OUTPUT"
}
# Install uv for easier python setup
- name: Install the latest version of uv and set the python version
uses: astral-sh/setup-uv@v5
with:
python-version: ${{ matrix.pyver }}
# Install ROCm SDK, apparently needs to happen before setting up Python
- name: Build for ROCm
if: matrix.rocm != ''
shell: bash
run: |
# --- Install ROCm SDK
export ROCM_VERSION=${{ matrix.rocm }}
export TORCH_VERSION=${{ matrix.torch }}
[ ! -d /etc/apt/keyrings ] && sudo mkdir --parents --mode=0755 /etc/apt/keyrings
wget https://repo.radeon.com/rocm/rocm.gpg.key -O - | gpg --dearmor | sudo tee /etc/apt/keyrings/rocm.gpg > /dev/null
echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/rocm.gpg] https://repo.radeon.com/amdgpu/$ROCM_VERSION/ubuntu jammy main" | sudo tee --append /etc/apt/sources.list.d/amdgpu.list
echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/rocm.gpg] https://repo.radeon.com/rocm/apt/$ROCM_VERSION jammy main" | sudo tee --append /etc/apt/sources.list.d/rocm.list
echo -e 'Package: *\nPin: release o=repo.radeon.com\nPin-Priority: 600' | sudo tee /etc/apt/preferences.d/rocm-pin-600
sudo apt update
sudo apt install rocm-hip-sdk -y
sudo apt clean -y
echo "/opt/rocm/bin" >> $GITHUB_PATH
echo "ROCM_PATH=/opt/rocm" >> $GITHUB_ENV
echo "ROCM_VERSION=$ROCM_VERSION" >> $GITHUB_ENV
echo "USE_ROCM=1" >> $GITHUB_ENV
# --- Install dependencies
uv pip install torch==${{ matrix.torch }} --index-url="https://download.pytorch.org/whl/rocm$ROCM_VERSION"
uv pip install --upgrade build setuptools==69.5.1 wheel packaging ninja safetensors tokenizers numpy
# --- Build wheel
python3 -m build -n --wheel -C--build-option=egg_info "-C--build-option=--tag-build=+rocm${{ matrix.rocm }}-torch${{ matrix.torch }}"
# Upload files
- name: Upload files to GitHub release
if: steps.package_version.outputs.PACKAGE_VERSION != 'None' && inputs.release == '1'
uses: svenstaro/upload-release-action@2.6.1
with:
file: ./dist/*.whl
tag: ${{ format('v{0}', steps.package_version.outputs.PACKAGE_VERSION) }}
file_glob: true
overwrite: true
release_name: ${{ steps.package_version.outputs.PACKAGE_VERSION }}