Skip to content

Commit e30c679

Browse files
authored
whisper : reorganize source code + improve CMake (#2256)
* scripts : update sync [no ci] * files : reorganize [no ci] * sync : llama.cpp * cmake : link math library * cmake : build normal ggml library * files : move headers to include * objc : fix path to ggml-metal.h * ci : fix WHISPER_CUDA -> GGML_CUDA * scripts : sync LICENSE [no ci]
1 parent bf4cb4a commit e30c679

File tree

361 files changed

+176592
-20522
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

361 files changed

+176592
-20522
lines changed

.devops/cublas.Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ COPY . .
2121
# Set nvcc architecture
2222
ENV CUDA_DOCKER_ARCH=${CUDA_DOCKER_ARCH}
2323
# Enable cuBLAS
24-
ENV WHISPER_CUBLAS=1
24+
ENV GGML_CUDA=1
2525

2626
RUN make
2727

.devops/main-cuda.Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ ARG CUDA_DOCKER_ARCH=all
1414
# Set nvcc architecture
1515
ENV CUDA_DOCKER_ARCH=${CUDA_DOCKER_ARCH}
1616
# Enable cuBLAS
17-
ENV WHISPER_CUBLAS=1
17+
ENV GGML_CUDA=1
1818

1919
RUN apt-get update && \
2020
apt-get install -y build-essential \

.github/workflows/build.yml

+11-28
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,10 @@ jobs:
101101
fail-fast: false
102102
matrix:
103103
build: [Debug, Release]
104-
arch: [linux/amd64, linux/arm64, linux/arm/v7, linux/ppc64le]
104+
#arch: [linux/amd64, linux/arm64, linux/arm/v7, linux/ppc64le]
105+
# TODO: arm/v7 disabled due to clang bug
106+
# https://github.com/ggerganov/whisper.cpp/actions/runs/9657764109/job/26637633042?pr=2256#step:4:1990
107+
arch: [linux/amd64, linux/arm64, linux/ppc64le]
105108

106109
steps:
107110
- name: Clone
@@ -197,7 +200,7 @@ jobs:
197200
source /opt/intel/oneapi/setvars.sh
198201
mkdir build
199202
cd build
200-
cmake -DWHISPER_SYCL=ON -DCMAKE_C_COMPILER=icx -DCMAKE_CXX_COMPILER=icpx ..
203+
cmake -DGGML_SYCL=ON -DCMAKE_C_COMPILER=icx -DCMAKE_CXX_COMPILER=icpx ..
201204
cmake --build . --config Release -j $(nproc)
202205
203206
ubuntu-22-cmake-sycl-fp16:
@@ -247,7 +250,7 @@ jobs:
247250
source /opt/intel/oneapi/setvars.sh
248251
mkdir build
249252
cd build
250-
cmake -DWHISPER_SYCL_F16=ON -DCMAKE_C_COMPILER=icx -DCMAKE_CXX_COMPILER=icpx ..
253+
cmake -DGGML_SYCL_F16=ON -DCMAKE_C_COMPILER=icx -DCMAKE_CXX_COMPILER=icpx ..
251254
cmake --build . --config Release -j $(nproc)
252255
253256
windows-msys2:
@@ -289,7 +292,7 @@ jobs:
289292
- name: Build using make w/ OpenBLAS
290293
shell: msys2 {0}
291294
run: |
292-
make WHISPER_OPENBLAS=1 -j $(nproc)
295+
make GGML_OPENBLAS=1 -j $(nproc)
293296
294297
- name: Build using CMake
295298
shell: msys2 {0}
@@ -305,7 +308,7 @@ jobs:
305308
- name: Build using CMake w/ OpenBLAS
306309
shell: msys2 {0}
307310
run: |
308-
cmake -B build -DWHISPER_OPENBLAS=ON
311+
cmake -B build -DGGML_OPENBLAS=ON
309312
cmake --build build --config ${{ matrix.build }} -j $(nproc)
310313
311314
windows:
@@ -381,12 +384,9 @@ jobs:
381384
- arch: Win32
382385
obzip: https://github.com/OpenMathLib/OpenBLAS/releases/download/v0.3.25/OpenBLAS-0.3.25-x86.zip
383386
s2arc: x86
384-
clblast: OFF
385387
- arch: x64
386388
obzip: https://github.com/OpenMathLib/OpenBLAS/releases/download/v0.3.25/OpenBLAS-0.3.25-x64.zip
387389
s2arc: x64
388-
clblast: ON
389-
clver: 1.6.1
390390
- sdl2: ON
391391
s2ver: 2.28.5
392392

@@ -413,26 +413,13 @@ jobs:
413413
7z x sdl2.zip
414414
echo "SDL2_DIR=$env:GITHUB_WORKSPACE/SDL2-${{ matrix.s2ver }}/cmake" >> $env:GITHUB_ENV
415415
416-
- name: Install OpenCL
417-
if: matrix.clblast == 'ON'
418-
run: vcpkg.exe --triplet=${{ matrix.arch }}-windows install opencl
419-
420-
- name: Fetch CLBlast and set CLBlast_DIR
421-
if: matrix.clblast == 'ON'
422-
run: |
423-
C:/msys64/usr/bin/wget.exe -qO clblast.zip https://github.com/CNugteren/CLBlast/releases/download/${{ matrix.clver }}/CLBlast-${{ matrix.clver }}-windows-x64.zip
424-
7z x clblast.zip
425-
7z x CLBlast-${{ matrix.clver }}-windows-x64.7z
426-
echo "CLBlast_DIR=$env:GITHUB_WORKSPACE/CLBlast-${{ matrix.clver }}-windows-x64/lib/cmake/CLBlast" >> $env:GITHUB_ENV
427-
428416
- name: Configure
429417
run: >
430418
cmake -S . -B ./build -A ${{ matrix.arch }}
431419
-DCMAKE_BUILD_TYPE=${{ matrix.build }}
432-
-DWHISPER_OPENBLAS=${{ matrix.blas }}
420+
-DGGML_OPENBLAS=${{ matrix.blas }}
433421
-DCMAKE_LIBRARY_PATH="$env:OPENBLAS_PATH/lib"
434422
-DWHISPER_SDL2=${{ matrix.sdl2 }}
435-
-DWHISPER_CLBLAST=${{ matrix.clblast }}
436423
437424
- name: Build
438425
run: |
@@ -447,15 +434,11 @@ jobs:
447434
if: matrix.sdl2 == 'ON'
448435
run: copy "$env:SDL2_DIR/../lib/${{ matrix.s2arc }}/SDL2.dll" build/bin/${{ matrix.build }}
449436

450-
- name: Copy clblast.dll
451-
if: matrix.clblast == 'ON'
452-
run: copy "$env:CLBlast_DIR/../../clblast.dll" build/bin/${{ matrix.build }}
453-
454437
- name: Upload binaries
455438
if: matrix.blas == 'ON' && matrix.sdl2 == 'ON'
456439
uses: actions/upload-artifact@v4
457440
with:
458-
name: whisper-blas${{ matrix.clblast == 'ON' && '-clblast' || ''}}-bin-${{ matrix.arch }}
441+
name: whisper-blas-bin-${{ matrix.arch }}
459442
path: build/bin/${{ matrix.build }}
460443

461444
windows-cublas:
@@ -498,7 +481,7 @@ jobs:
498481
run: >
499482
cmake -S . -B ./build -A ${{ matrix.arch }}
500483
-DCMAKE_BUILD_TYPE=${{ matrix.build }}
501-
-DWHISPER_CUDA=${{ matrix.cublas }}
484+
-DGGML_CUDA=${{ matrix.cublas }}
502485
-DWHISPER_SDL2=${{ matrix.sdl2 }}
503486
504487
- name: Build ${{ matrix.cuda-toolkit }}

.gitignore

+1-11
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,7 @@
1010
/CMakeSettings.json
1111

1212
build/
13-
build-blas/
14-
build-coreml/
15-
build-em/
16-
build-debug/
17-
build-release/
18-
build-rwdi/
19-
build-static/
20-
build-cublas/
21-
build-no-accel/
22-
build-sanitize-addr/
23-
build-sanitize-thread/
13+
build-*/
2414

2515
# SPM
2616
.build/

.gitmodules

-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +0,0 @@
1-
[submodule "bindings/ios"]
2-
path = bindings/ios
3-
url = https://github.com/ggerganov/whisper.spm

0 commit comments

Comments
 (0)