-
Notifications
You must be signed in to change notification settings - Fork 0
183 lines (176 loc) · 5.96 KB
/
cuda11.8-whl-release.yml
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
name: cuda11.8-whl-release
on:
workflow_dispatch:
inputs:
repo:
description: "repo"
default: "InternLM/lmdeploy"
branch:
description: "branch"
default: "main"
schedule:
- cron: '30 1 * * *'
permissions:
contents: write
jobs:
linux-build:
strategy:
matrix:
pyver: [py38, py39, py310, py311, py312]
runs-on: ubuntu-latest
env:
PYTHON_VERSION: ${{ matrix.pyver }}
PLAT_NAME: manylinux2014_x86_64
DOCKER_TAG: cuda11.8
OUTPUT_FOLDER: cuda11.8_dist
CUDA_VER: 11.8
steps:
- name: Free disk space
uses: jlumbroso/free-disk-space@main
with:
# This might remove tools that are actually needed, if set to "true" but frees about 6 GB
tool-cache: false
docker-images: false
# All of these default to true, but feel free to set to "false" if necessary for your workflow
android: true
dotnet: true
haskell: true
large-packages: true
swap-storage: false
- name: Set default values
id: set_defaults
run: |
echo "[INFO] Event name is '${{ github.event_name }}'"
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
echo "REPO=${{ inputs.repo }}" >> $GITHUB_ENV
echo "BRANCH=${{ inputs.branch }}" >> $GITHUB_ENV
elif [[ "${{ github.event_name }}" == "schedule" ]]; then
echo "REPO=internLM/lmdeploy" >> $GITHUB_ENV
echo "BRANCH=main" >> $GITHUB_ENV
else
echo "[ERROR] Unsupported event '${{ github.event_name }}'." >&2
exit 1
fi
- name: Checkout repository
run: git clone -b ${{ env.BRANCH }} --depth=1 https://github.com/${{ env.REPO }}
- name: Build
run: |
echo ${PYTHON_VERSION}
echo ${PLAT_NAME}
echo ${DOCKER_TAG}
echo ${OUTPUT_FOLDER}
pushd lmdeploy
# remove -it
sed -i 's/docker run --rm -it/docker run --rm/g' builder/manywheel/build_wheel.sh
bash builder/manywheel/build_wheel.sh ${PYTHON_VERSION} ${PLAT_NAME} ${DOCKER_TAG} ${OUTPUT_FOLDER}
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
if-no-files-found: error
path: lmdeploy/builder/manywheel/${{ env.OUTPUT_FOLDER }}/*
retention-days: 1
windows-build:
strategy:
matrix:
pyver: ['3.8', '3.9', '3.10', '3.11', '3.12']
runs-on: windows-latest
steps:
- name: Set up python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.pyver }}
- name: Install python packages
run: |
pip install pybind11<=2.13.1 wheel
- uses: actions/checkout@v4
- name: Setup CUDA Toolkit
id: cuda-toolkit
shell: pwsh
run: ./setup_cuda.ps1
env:
INPUT_CUDA_VERSION: '11.8.0'
- name: Set default values
id: set_defaults
run: |
Write-Host "[INFO] Event name is '${{ github.event_name }}'"
if ("${{ github.event_name }}" -eq "workflow_dispatch") {
echo "REPO=${{ inputs.repo }}" >> $env:GITHUB_ENV
echo "BRANCH=${{ inputs.branch }}" >> $env:GITHUB_ENV
} elseif ("${{ github.event_name }}" -eq "schedule") {
echo "REPO=InternLM/lmdeploy" >> $env:GITHUB_ENV
echo "BRANCH=main" >> $env:GITHUB_ENV
} else {
Write-Error "[ERROR] Unsupported event '${{ github.event_name }}'."
exit 1
}
- name: Build wheel
run: |
git clone -b ${{ env.BRANCH }} --depth=1 https://github.com/${{ env.REPO }}
pushd lmdeploy
mkdir build
cd build
pip install -U setuptools
..\builder\windows\generate.ps1
cmake --build . --config Release -- /m /v:q
if (-Not $?) {
echo "build failed"
exit 1
}
cmake --install . --config Release
cd ..
rm build -Force -Recurse
python setup.py bdist_wheel -d build/wheel
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
if-no-files-found: error
path: lmdeploy/build/wheel/*
retention-days: 1
publish:
runs-on: ubuntu-latest
environment: 'prod'
needs:
- linux-build
- windows-build
steps:
- name: Set default values
id: set_defaults
run: |
echo "[INFO] Event name is '${{ github.event_name }}'"
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
echo "REPO=${{ inputs.repo }}" >> $GITHUB_ENV
echo "BRANCH=${{ inputs.branch }}" >> $GITHUB_ENV
elif [[ "${{ github.event_name }}" == "schedule" ]]; then
echo "REPO=internLM/lmdeploy" >> $GITHUB_ENV
echo "BRANCH=main" >> $GITHUB_ENV
else
echo "[ERROR] Unsupported event '${{ github.event_name }}'." >&2
exit 1
fi
- name: Checkout repository
run:
git clone -b ${{ env.BRANCH }} --depth=1 https://github.com/${{ env.REPO }}
- name: Download artifacts
uses: actions/download-artifact@v3
- name: Add cuda version to package name
id: commit
run: |
pushd lmdeploy
ver=$(cat lmdeploy/version.py | grep '__version__ =' | cut -d\' -f2)
id=$(git rev-parse --short HEAD)
echo "id=$id" >> $GITHUB_OUTPUT
cuver=$ver+cu118+$id
popd
cd artifact
for file in *; do
mv "$file" "`echo $file | sed "s/$ver/$cuver/g"`";
done
- name: Display artifacts
run: ls artifact/ -lh
- name: Publish
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.REPO_TOKEN }}
with:
tag_name: ${{ steps.commit.outputs.id }}
files: artifact/*