-
Notifications
You must be signed in to change notification settings - Fork 19
379 lines (334 loc) · 14.4 KB
/
Copy pathbuild-whispercpp-release.yml
File metadata and controls
379 lines (334 loc) · 14.4 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
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
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
name: Build whisper.cpp release zips
# Produces the five whisper.cpp build archives consumed by SubtitleEdit's
# WhisperDownloadService (whisper-blas-bin-x64.zip, whisper-vulkan-x64.zip,
# whisper-vulkan-linux64.zip, whisper-cuda-linux64.zip, whisper-mac.zip).
#
# Sourcing strategy:
# - Windows BLAS: repackage the upstream ggml-org/whisper.cpp release
# `whisper-blas-bin-x64.zip` (the only one of our five that upstream
# actually ships) plus our silero VAD model. No compile needed.
# - Windows Vulkan / Linux Vulkan / Linux CUDA / macOS Universal: build
# from upstream source at the requested ref, since upstream does not
# ship release artifacts for these targets.
#
# All archives carry the SubtitleEdit-specific ggml-silero-v6.2.0.bin model
# alongside the binaries, matching the whispercpp-184 layout — except for
# whisper-cuda-linux64.zip, which intentionally does NOT include the VAD
# model (also matches the v184 manifest).
#
# Dispatch manually with workflow_dispatch. Defaults target v1.9.1; bump
# `whisper_ref` / `release_tag` for future releases.
on:
workflow_dispatch:
inputs:
whisper_ref:
description: 'whisper.cpp git ref (must match an upstream release tag for the Windows BLAS repack)'
required: true
default: 'v1.9.1'
release_tag:
description: 'Tag for the resulting support-files release'
required: true
default: 'whispercpp-191'
release_name:
description: 'Display name for the release'
required: true
default: 'Whisper CPP v1.9.1'
silero_url:
description: 'URL of ggml-silero-v6.2.0.zip (the VAD model bundled into 4 of the 5 archives)'
required: true
default: 'https://github.com/SubtitleEdit/support-files/releases/download/whispercpp-184/ggml-silero-v6.2.0.zip'
jobs:
# --------------------------------------------------------------------
# Shared: fetch the VAD model once so each platform job can pull it as
# an artifact instead of re-downloading.
# --------------------------------------------------------------------
fetch-silero:
runs-on: ubuntu-latest
steps:
- name: Download silero VAD model
run: |
curl -fL -o ggml-silero-v6.2.0.zip "${{ inputs.silero_url }}"
unzip -o ggml-silero-v6.2.0.zip
test -f ggml-silero-v6.2.0.bin
- uses: actions/upload-artifact@v4
with:
name: silero
path: ggml-silero-v6.2.0.bin
if-no-files-found: error
# --------------------------------------------------------------------
# Windows BLAS x64 — repackage upstream zip + bundle the VAD model.
# No native build, so this runs on ubuntu-latest with zip/unzip.
# --------------------------------------------------------------------
windows-blas:
needs: fetch-silero
runs-on: ubuntu-latest
steps:
- name: Download upstream whisper-blas-bin-x64.zip
run: |
curl -fL -o upstream.zip \
"https://github.com/ggml-org/whisper.cpp/releases/download/${{ inputs.whisper_ref }}/whisper-blas-bin-x64.zip"
- name: Extract and flatten
run: |
mkdir staging
unzip -j -o upstream.zip -d staging
# Drop anything we don't redistribute: PDBs, msbuild leftovers, tests.
rm -f staging/*.pdb staging/*.exp staging/*.ilk staging/*.lastbuildstate
# Strip helper executables we never invoke (keep only whisper-cli + libs).
find staging -maxdepth 1 -type f \( -name 'bench.exe' -o -name 'main.exe' -o -name 'quantize.exe' -o -name 'server.exe' -o -name 'stream.exe' -o -name 'command.exe' -o -name 'lsp.exe' -o -name 'talk-llama.exe' \) -delete || true
ls -la staging
- uses: actions/download-artifact@v4
with: { name: silero, path: staging }
- name: Pack whisper-blas-bin-x64.zip
run: |
cd staging && zip -r ../whisper-blas-bin-x64.zip . && cd ..
unzip -l whisper-blas-bin-x64.zip
- uses: actions/upload-artifact@v4
with:
name: whisper-blas-bin-x64
path: whisper-blas-bin-x64.zip
if-no-files-found: error
# --------------------------------------------------------------------
# Windows Vulkan x64 — build from source with -DGGML_VULKAN=ON.
# --------------------------------------------------------------------
windows-vulkan:
needs: fetch-silero
runs-on: windows-latest
steps:
- name: Clone whisper.cpp
uses: actions/checkout@v5
with:
repository: ggml-org/whisper.cpp
ref: ${{ inputs.whisper_ref }}
- name: Install Vulkan SDK
uses: jakoch/install-vulkan-sdk-action@v1
with:
vulkan_version: 1.3.296.0
install_runtime: false
cache: true
stripdown: false
- name: Install SPIRV-Headers
# jakoch's SDK install layout doesn't include SPIRV-HeadersConfig.cmake
# where CMake's find_package looks, so install the headers from source
# into a local prefix. Header-only library — installs in seconds.
shell: pwsh
run: |
git clone --depth 1 --branch vulkan-sdk-1.3.296.0 https://github.com/KhronosGroup/SPIRV-Headers.git spirv-headers
cd spirv-headers
cmake -B build -DCMAKE_INSTALL_PREFIX="$env:GITHUB_WORKSPACE/spirv-install"
cmake --build build --target install --config Release
# Sanity-check the CMake config file we'll be searching for.
Get-ChildItem -Recurse "$env:GITHUB_WORKSPACE/spirv-install" -Filter '*.cmake' | Select-Object FullName
- name: Configure
shell: pwsh
run: |
cmake -B build -A x64 `
-DCMAKE_BUILD_TYPE=Release `
-DGGML_VULKAN=ON `
-DWHISPER_SDL2=OFF `
-DBUILD_SHARED_LIBS=ON `
-DCMAKE_PREFIX_PATH="$env:VULKAN_SDK;$env:GITHUB_WORKSPACE/spirv-install"
- name: Build whisper-cli
shell: pwsh
run: cmake --build build --config Release --target whisper-cli -j
- name: Stage release bits
shell: pwsh
run: |
New-Item -ItemType Directory -Path staging | Out-Null
# whisper-cli.exe + every ggml/whisper dll generated by the build
Get-ChildItem build/bin/Release -File | Where-Object {
$_.Extension -in '.exe','.dll'
} | Where-Object {
$_.Name -notin 'bench.exe','main.exe','quantize.exe','server.exe','stream.exe','command.exe','lsp.exe','talk-llama.exe'
} | Copy-Item -Destination staging
- uses: actions/download-artifact@v4
with: { name: silero, path: staging }
- name: Pack whisper-vulkan-x64.zip
shell: pwsh
run: |
Compress-Archive -Path staging/* -DestinationPath whisper-vulkan-x64.zip
Expand-Archive -Path whisper-vulkan-x64.zip -DestinationPath listing-only -Force
Get-ChildItem listing-only
- uses: actions/upload-artifact@v4
with:
name: whisper-vulkan-x64
path: whisper-vulkan-x64.zip
if-no-files-found: error
# --------------------------------------------------------------------
# Linux Vulkan x64 — build with -DGGML_VULKAN=ON -DGGML_CPU_ALL_VARIANTS=ON
# so we ship the per-microarch libggml-cpu-*.so set matching v184.
# --------------------------------------------------------------------
linux-vulkan:
needs: fetch-silero
runs-on: ubuntu-latest
steps:
- name: Clone whisper.cpp
uses: actions/checkout@v5
with:
repository: ggml-org/whisper.cpp
ref: ${{ inputs.whisper_ref }}
- name: Install Vulkan SDK + tools
# ubuntu-latest is now noble (24.04), so use the noble repo path —
# the jammy variant pulls libyaml-cpp0.7 which isn't in noble.
run: |
wget -qO- https://packages.lunarg.com/lunarg-signing-key-pub.asc | sudo tee /etc/apt/trusted.gpg.d/lunarg.asc
sudo wget -qO /etc/apt/sources.list.d/lunarg-vulkan-noble.list \
https://packages.lunarg.com/vulkan/lunarg-vulkan-noble.list
sudo apt-get update
sudo apt-get install -y vulkan-sdk libvulkan-dev glslang-tools libsdl2-dev cmake
- name: Configure
# GGML_BACKEND_DL is required by GGML_CPU_ALL_VARIANTS — it switches
# to a dlopen plugin model so the per-microarch libggml-cpu-*.so
# variants can coexist in one install.
run: |
cmake -B build \
-DCMAKE_BUILD_TYPE=Release \
-DGGML_VULKAN=ON \
-DGGML_CPU_ALL_VARIANTS=ON \
-DGGML_BACKEND_DL=ON \
-DGGML_NATIVE=OFF \
-DWHISPER_SDL2=OFF \
-DBUILD_SHARED_LIBS=ON
- name: Build whisper-cli
run: cmake --build build --config Release --target whisper-cli -j $(nproc)
- name: Stage release bits
run: |
mkdir staging
cp build/bin/whisper-cli staging/
cp build/bin/libggml*.so staging/ 2>/dev/null || cp build/lib/libggml*.so staging/
ls -la staging
- uses: actions/download-artifact@v4
with: { name: silero, path: staging }
- name: Pack whisper-vulkan-linux64.zip
run: |
cd staging && zip -r ../whisper-vulkan-linux64.zip . && cd ..
unzip -l whisper-vulkan-linux64.zip
- uses: actions/upload-artifact@v4
with:
name: whisper-vulkan-linux64
path: whisper-vulkan-linux64.zip
if-no-files-found: error
# --------------------------------------------------------------------
# Linux CUDA x64 — build with CUDA 12.4 toolkit and all CPU variants.
# NOTE: the v184 manifest does NOT include the silero bin in this zip;
# we match that exactly.
# --------------------------------------------------------------------
linux-cuda:
# Pin to 22.04 because Jimver/cuda-toolkit installs apt packages built
# against the runner's libc/libstdc++; on noble (24.04) the `cuda-12-4`
# meta package isn't published yet via the network method.
runs-on: ubuntu-22.04
steps:
- name: Clone whisper.cpp
uses: actions/checkout@v5
with:
repository: ggml-org/whisper.cpp
ref: ${{ inputs.whisper_ref }}
- name: Install CUDA toolkit 12.4
uses: Jimver/cuda-toolkit@v0.2.19
with:
cuda: '12.4.0'
method: network
- name: Install build deps
run: sudo apt-get update && sudo apt-get install -y cmake build-essential
- name: Configure
# GGML_BACKEND_DL is required by GGML_CPU_ALL_VARIANTS — see notes in
# the linux-vulkan Configure step.
run: |
cmake -B build \
-DCMAKE_BUILD_TYPE=Release \
-DGGML_CUDA=ON \
-DGGML_CPU_ALL_VARIANTS=ON \
-DGGML_BACKEND_DL=ON \
-DGGML_NATIVE=OFF \
-DWHISPER_SDL2=OFF \
-DBUILD_SHARED_LIBS=ON
- name: Build whisper-cli
run: cmake --build build --config Release --target whisper-cli -j $(nproc)
- name: Stage release bits (no silero in this zip per v184 layout)
run: |
mkdir staging
cp build/bin/whisper-cli staging/
cp build/bin/libggml*.so staging/ 2>/dev/null || cp build/lib/libggml*.so staging/
ls -la staging
- name: Pack whisper-cuda-linux64.zip
run: |
cd staging && zip -r ../whisper-cuda-linux64.zip . && cd ..
unzip -l whisper-cuda-linux64.zip
- uses: actions/upload-artifact@v4
with:
name: whisper-cuda-linux64
path: whisper-cuda-linux64.zip
if-no-files-found: error
# --------------------------------------------------------------------
# macOS Universal — single fat binary built with both arm64 + x86_64,
# using Apple's Metal backend (Metal is implicit on macOS / iOS targets).
# Matches the v184 layout: just `whisper-cli` + the VAD model.
# --------------------------------------------------------------------
macos:
needs: fetch-silero
runs-on: macos-latest
steps:
- name: Clone whisper.cpp
uses: actions/checkout@v5
with:
repository: ggml-org/whisper.cpp
ref: ${{ inputs.whisper_ref }}
- name: Configure (Universal arm64+x86_64)
run: |
cmake -B build \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" \
-DGGML_METAL=ON \
-DGGML_METAL_EMBED_LIBRARY=ON \
-DGGML_NATIVE=OFF \
-DWHISPER_SDL2=OFF \
-DBUILD_SHARED_LIBS=OFF
- name: Build whisper-cli
run: cmake --build build --config Release --target whisper-cli -j $(sysctl -n hw.logicalcpu)
- name: Verify universal
run: |
file build/bin/whisper-cli
lipo -info build/bin/whisper-cli
- name: Stage release bits
run: |
mkdir staging
cp build/bin/whisper-cli staging/
ls -la staging
- uses: actions/download-artifact@v4
with: { name: silero, path: staging }
- name: Pack whisper-mac.zip
run: |
cd staging && zip -r ../whisper-mac.zip . && cd ..
unzip -l whisper-mac.zip
- uses: actions/upload-artifact@v4
with:
name: whisper-mac
path: whisper-mac.zip
if-no-files-found: error
# --------------------------------------------------------------------
# Collect all five archives and publish them as a single release.
# The first run for a given tag creates the release; reruns update it.
# --------------------------------------------------------------------
release:
needs: [windows-blas, windows-vulkan, linux-vulkan, linux-cuda, macos]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/download-artifact@v4
with:
path: artifacts
- name: Show staged archives
run: ls -la artifacts/*/
- uses: softprops/action-gh-release@v2
with:
tag_name: ${{ inputs.release_tag }}
name: ${{ inputs.release_name }}
generate_release_notes: false
fail_on_unmatched_files: true
files: |
artifacts/whisper-blas-bin-x64/whisper-blas-bin-x64.zip
artifacts/whisper-vulkan-x64/whisper-vulkan-x64.zip
artifacts/whisper-vulkan-linux64/whisper-vulkan-linux64.zip
artifacts/whisper-cuda-linux64/whisper-cuda-linux64.zip
artifacts/whisper-mac/whisper-mac.zip