Skip to content

Commit 263c758

Browse files
authored
Actions: Update install methods (#775)
Signed-off-by: kingbri <8082010+kingbri1@users.noreply.github.com> Actions: Test
1 parent 0374e36 commit 263c758

File tree

3 files changed

+119
-555
lines changed

3 files changed

+119
-555
lines changed

.github/workflows/build-wheels-release-rocm62.yml

Lines changed: 7 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,8 @@ jobs:
6060
large-packages: false
6161
swap-storage: true
6262

63-
# Setup Python
64-
6563
- uses: actions/checkout@v4
6664

67-
- uses: actions/setup-python@v5.4.0
68-
with:
69-
python-version: ${{ matrix.pyver }}
70-
7165
# Get version string from package
7266

7367
- name: Get version string
@@ -85,11 +79,11 @@ jobs:
8579
Write-Output "PACKAGE_VERSION=None" >> "$env:GITHUB_OUTPUT"
8680
}
8781
88-
# Pin VS build tools to 17.9 so builds won't fail
89-
90-
- name: Install VS2022 BuildTools 17.9.7
91-
run: choco install -y visualstudio2022buildtools --version=117.9.7.0 --params "--add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 --installChannelUri https://aka.ms/vs/17/release/180911598_-255012421/channel"
92-
if: runner.os == 'Windows'
82+
# Install uv for easier python setup
83+
- name: Install the latest version of uv and set the python version
84+
uses: astral-sh/setup-uv@v5
85+
with:
86+
python-version: ${{ matrix.pyver }}
9387

9488
# Install ROCm SDK, apparently needs to happen before setting up Python
9589

@@ -118,101 +112,15 @@ jobs:
118112
119113
# --- Install dependencies
120114
121-
python3 -m ensurepip --upgrade
122-
pip3 install torch==${{ matrix.torch }} --index-url="https://download.pytorch.org/whl/rocm$ROCM_VERSION"
123-
pip3 install --upgrade setuptools==69.5.1 build wheel safetensors sentencepiece ninja
124-
pip3 cache purge
115+
uv pip install torch==${{ matrix.torch }} --index-url="https://download.pytorch.org/whl/rocm$ROCM_VERSION"
116+
uv pip install --upgrade build setuptools==69.5.1 wheel packaging ninja safetensors sentencepiece tokenizers numpy
125117
126118
# --- Build wheel
127119
128120
python3 -m build -n --wheel -C--build-option=egg_info "-C--build-option=--tag-build=+rocm${{ matrix.rocm }}-torch${{ matrix.torch }}"
129121
130-
# Build for CUDA
131-
132-
- name: Setup Mamba
133-
if: matrix.cuda != ''
134-
uses: conda-incubator/setup-miniconda@v3.1.0
135-
with:
136-
activate-environment: "exllama"
137-
python-version: ${{ matrix.pyver }}
138-
# miniforge-variant: Mambaforge
139-
miniforge-version: latest
140-
# use-mamba: true
141-
add-pip-as-python-dependency: true
142-
auto-activate-base: false
143-
144-
- name: Build for CUDA
145-
if: matrix.cuda != ''
146-
run: |
147-
# --- Spawn the VS shell
148-
if ($IsWindows) {
149-
Import-Module 'C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\Common7\Tools\Microsoft.VisualStudio.DevShell.dll'
150-
Enter-VsDevShell -VsInstallPath 'C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools' -DevCmdArguments '-arch=x64 -host_arch=x64'
151-
$env:DISTUTILS_USE_SDK=1
152-
}
153-
154-
# --- Install CUDA using Conda
155-
$cudaVersion = '${{ matrix.cuda }}'
156-
$cudaVersionPytorch = '${{ matrix.cuda }}'.Remove('${{ matrix.cuda }}'.LastIndexOf('.')).Replace('.','')
157-
158-
$env:MAMBA_NO_LOW_SPEED_LIMIT = 1
159-
mamba install -y -c nvidia/label/cuda-$cudaVersion cuda-toolkit cuda-runtime
160-
161-
if (!(mamba list cuda)[-1].contains('cuda')) {sleep -s 10; mamba install -y 'cuda' $cudaVersion}
162-
if (!(mamba list cuda)[-1].contains('cuda')) {throw 'CUDA Toolkit failed to install!'}
163-
164-
$env:CUDA_PATH = $env:CONDA_PREFIX
165-
$env:CUDA_HOME = $env:CONDA_PREFIX
166-
if ($IsLinux) {$env:LD_LIBRARY_PATH = $env:CONDA_PREFIX + '/lib:' + $env:LD_LIBRARY_PATH}
167-
168-
# --- Install dependencies
169-
170-
python -m ensurepip --upgrade
171-
python -m pip install torch==${{ matrix.torch }} --index-url https://download.pytorch.org/whl/cu$cudaVersionPytorch
172-
python -m pip install --upgrade setuptools==69.5.1 build wheel safetensors sentencepiece ninja
173-
174-
# --- Build wheel
175-
176-
$BUILDTAG = "+cu$cudaVersionPytorch-torch${{ matrix.torch }}"
177-
$env:TORCH_CUDA_ARCH_LIST = '${{ matrix.cudaarch }}'
178-
python -m build -n --wheel -C--build-option=egg_info "-C--build-option=--tag-build=$BUILDTAG"
179-
180-
# Build sdist
181-
182-
- name: Build sdist
183-
if: matrix.cuda == '' && matrix.rocm == ''
184-
run: |
185-
# --- Spawn the VS shell
186-
if ($IsWindows) {
187-
Import-Module 'C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\Common7\Tools\Microsoft.VisualStudio.DevShell.dll'
188-
Enter-VsDevShell -VsInstallPath 'C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools' -DevCmdArguments '-arch=x64 -host_arch=x64'
189-
$env:DISTUTILS_USE_SDK=1
190-
}
191-
192-
# --- Install dependencies
193-
194-
python -m pip install torch==${{ matrix.torch }} --index-url https://download.pytorch.org/whl/cpu
195-
python -m pip install build wheel ninja
196-
197-
# --- Build wheel
198-
199-
$env:EXLLAMA_NOCOMPILE=1
200-
python -m build -n
201-
202122
# Upload files
203123

204-
- uses: actions/upload-artifact@v4
205-
if: matrix.artname == 'wheel'
206-
with:
207-
name: wheel-${{ matrix.os }}-py${{ matrix.pyver }}-cuda${{ matrix.cuda }}-torch${{ matrix.torch }}
208-
path: ./dist/*
209-
210-
- uses: actions/upload-artifact@v4
211-
if: matrix.artname == 'sdist'
212-
with:
213-
name: 'sdist'
214-
path: ./dist/*
215-
216124
- name: Upload files to GitHub release
217125
if: steps.package_version.outputs.PACKAGE_VERSION != 'None' && inputs.release == '1'
218126
uses: svenstaro/upload-release-action@2.6.1

0 commit comments

Comments
 (0)