Skip to content

Commit

Permalink
Merge branch 'ggerganov:master' into libffmpeg
Browse files Browse the repository at this point in the history
  • Loading branch information
WilliamTambellini authored May 20, 2024
2 parents f81fe80 + adee3f9 commit 4e9047e
Show file tree
Hide file tree
Showing 39 changed files with 2,753 additions and 768 deletions.
92 changes: 46 additions & 46 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ jobs:

steps:
- name: Clone
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v2
uses: docker/setup-qemu-action@v3

- name: Build ${{ matrix.arch }}
run: |
Expand All @@ -36,7 +36,7 @@ jobs:

steps:
- name: Clone
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Dependencies
run: |
Expand All @@ -53,10 +53,10 @@ jobs:

steps:
- name: Clone
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Build
uses: cross-platform-actions/action@v0.15.0
uses: cross-platform-actions/action@v0.24.0
with:
operating_system: freebsd
version: '13.2'
Expand All @@ -77,10 +77,10 @@ jobs:

steps:
- name: Clone
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v2
uses: docker/setup-qemu-action@v3

- name: Build ${{ matrix.arch }}
run: |
Expand All @@ -105,10 +105,10 @@ jobs:

steps:
- name: Clone
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v2
uses: docker/setup-qemu-action@v3

- name: Build ${{ matrix.arch }}
run: |
Expand All @@ -133,10 +133,10 @@ jobs:

steps:
- name: Clone
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v2
uses: docker/setup-qemu-action@v3

- name: Build ${{ matrix.arch }}
run: |
Expand Down Expand Up @@ -165,7 +165,7 @@ jobs:

steps:
- name: Clone
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: add oneAPI to apt
shell: bash
Expand All @@ -189,7 +189,7 @@ jobs:
- name: Clone
id: checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Build
id: cmake_build
Expand All @@ -215,7 +215,7 @@ jobs:

steps:
- name: Clone
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: add oneAPI to apt
shell: bash
Expand All @@ -239,7 +239,7 @@ jobs:
- name: Clone
id: checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Build
id: cmake_build
Expand All @@ -262,7 +262,7 @@ jobs:

steps:
- name: Clone
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup ${{ matrix.sys }}
uses: msys2/setup-msys2@v2
Expand Down Expand Up @@ -328,10 +328,10 @@ jobs:

steps:
- name: Clone
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v1
uses: microsoft/setup-msbuild@v2

- name: Fetch SDL2 and set SDL2_DIR
if: matrix.sdl2 == 'ON'
Expand All @@ -356,14 +356,14 @@ jobs:
run: copy "$env:SDL2_DIR/../lib/${{ matrix.s2arc }}/SDL2.dll" build/bin/${{ matrix.build }}

- name: Upload dll
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.jnaPath }}_whisper.dll
path: build/bin/${{ matrix.build }}/whisper.dll

- name: Upload binaries
if: matrix.sdl2 == 'ON'
uses: actions/upload-artifact@v1
uses: actions/upload-artifact@v4
with:
name: whisper-bin-${{ matrix.arch }}
path: build/bin/${{ matrix.build }}
Expand Down Expand Up @@ -392,10 +392,10 @@ jobs:

steps:
- name: Clone
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v1
uses: microsoft/setup-msbuild@v2

- name: Fetch OpenBLAS
if: matrix.blas == 'ON'
Expand Down Expand Up @@ -453,7 +453,7 @@ jobs:

- name: Upload binaries
if: matrix.blas == 'ON' && matrix.sdl2 == 'ON'
uses: actions/upload-artifact@v1
uses: actions/upload-artifact@v4
with:
name: whisper-blas${{ matrix.clblast == 'ON' && '-clblast' || ''}}-bin-${{ matrix.arch }}
path: build/bin/${{ matrix.build }}
Expand All @@ -476,14 +476,14 @@ jobs:

steps:
- name: Clone
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v1
uses: microsoft/setup-msbuild@v2

- name: Install CUDA Toolkit
id: cuda-toolkit
uses: Jimver/[email protected].11
uses: Jimver/[email protected].15
with:
cuda: '${{ matrix.cuda-toolkit }}'

Expand Down Expand Up @@ -519,7 +519,7 @@ jobs:

- name: Upload binaries
if: matrix.sdl2 == 'ON'
uses: actions/upload-artifact@v1
uses: actions/upload-artifact@v4
with:
name: whisper-cublas-${{ matrix.cuda-toolkit }}-bin-${{ matrix.arch }}
path: build/bin/${{ matrix.build }}
Expand All @@ -533,10 +533,10 @@ jobs:

steps:
- name: Clone
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup emsdk
uses: mymindstorm/setup-emsdk@v12
uses: mymindstorm/setup-emsdk@v14

- name: Verify
run: emcc -v
Expand All @@ -555,7 +555,7 @@ jobs:

steps:
- name: Clone
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Configure
run: |
Expand All @@ -573,24 +573,24 @@ jobs:

steps:
- name: Clone
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
path: whisper

- name: Clone
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: ggerganov/ggml
path: ggml

- name: Install Java
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 17
java-version: 21

- name: Setup Android SDK
uses: android-actions/setup-android@v2
uses: android-actions/setup-android@v3

- name: Build
run: |
Expand All @@ -608,20 +608,19 @@ jobs:

steps:
- name: Clone
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: set up JDK 11
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'temurin'
cache: gradle

- name: Setup Android SDK
uses: android-actions/setup-android@v2
uses: android-actions/setup-android@v3
with:
api-level: 30
build-tools-version: 30.0.3
cmdline-tools-version: 9.0

- name: Build
run: |
Expand All @@ -633,15 +632,16 @@ jobs:
needs: [ 'windows' ]
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Install Java
uses: actions/setup-java@v1
uses: actions/setup-java@v4
with:
java-version: 17
distribution: zulu
java-version: 20

- name: Download Windows lib
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: win32-x86-64_whisper.dll
path: bindings/java/build/generated/resources/main/win32-x86-64
Expand All @@ -654,7 +654,7 @@ jobs:
./gradlew build
- name: Upload jar
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: whispercpp.jar
path: bindings/java/build/libs/whispercpp-*.jar
Expand All @@ -676,7 +676,7 @@ jobs:

steps:
- name: Clone
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Test quantize
run: |
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ cmake_minimum_required (VERSION 3.5)
# Allow for the creation of solution folders.
set_property(GLOBAL PROPERTY USE_FOLDERS ON)

project(whisper.cpp VERSION 1.5.5)
project(whisper.cpp VERSION 1.6.0)
set(SOVERSION 1)

# Add path to modules
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](https://opensource.org/licenses/MIT)
[![npm](https://img.shields.io/npm/v/whisper.cpp.svg)](https://www.npmjs.com/package/whisper.cpp/)

Stable: [v1.5.5](https://github.com/ggerganov/whisper.cpp/releases/tag/v1.5.5) / [Roadmap | F.A.Q.](https://github.com/ggerganov/whisper.cpp/discussions/126)
Stable: [v1.6.0](https://github.com/ggerganov/whisper.cpp/releases/tag/v1.6.0) / [Roadmap | F.A.Q.](https://github.com/ggerganov/whisper.cpp/discussions/126)

High-performance inference of [OpenAI's Whisper](https://github.com/openai/whisper) automatic speech recognition (ASR) model:

Expand Down
2 changes: 1 addition & 1 deletion bindings/javascript/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "whisper.cpp",
"version": "1.5.5",
"version": "1.6.0",
"description": "Whisper speech recognition",
"main": "whisper.js",
"scripts": {
Expand Down
1 change: 1 addition & 0 deletions examples/addon.node/__test__/whisper.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const whisperParamsMock = {
model: path.join(__dirname, "../../../models/ggml-base.en.bin"),
fname_inp: path.join(__dirname, "../../../samples/jfk.wav"),
use_gpu: true,
flash_attn: false,
no_prints: true,
comma_in_time: false,
translate: true,
Expand Down
4 changes: 4 additions & 0 deletions examples/addon.node/addon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ struct whisper_params {
bool no_timestamps = false;
bool no_prints = false;
bool use_gpu = true;
bool flash_attn = false;
bool comma_in_time = true;

std::string language = "en";
Expand Down Expand Up @@ -146,6 +147,7 @@ int run(whisper_params &params, std::vector<std::vector<std::string>> &result) {

struct whisper_context_params cparams = whisper_context_default_params();
cparams.use_gpu = params.use_gpu;
cparams.flash_attn = params.flash_attn;
struct whisper_context * ctx = whisper_init_from_file_with_params(params.model.c_str(), cparams);

if (ctx == nullptr) {
Expand Down Expand Up @@ -326,6 +328,7 @@ Napi::Value whisper(const Napi::CallbackInfo& info) {
std::string model = whisper_params.Get("model").As<Napi::String>();
std::string input = whisper_params.Get("fname_inp").As<Napi::String>();
bool use_gpu = whisper_params.Get("use_gpu").As<Napi::Boolean>();
bool flash_attn = whisper_params.Get("flash_attn").As<Napi::Boolean>();
bool no_prints = whisper_params.Get("no_prints").As<Napi::Boolean>();
bool no_timestamps = whisper_params.Get("no_timestamps").As<Napi::Boolean>();
int32_t audio_ctx = whisper_params.Get("audio_ctx").As<Napi::Number>();
Expand All @@ -346,6 +349,7 @@ Napi::Value whisper(const Napi::CallbackInfo& info) {
params.model = model;
params.fname_inp.emplace_back(input);
params.use_gpu = use_gpu;
params.flash_attn = flash_attn;
params.no_prints = no_prints;
params.no_timestamps = no_timestamps;
params.audio_ctx = audio_ctx;
Expand Down
1 change: 1 addition & 0 deletions examples/addon.node/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const whisperParams = {
model: path.join(__dirname, "../../models/ggml-base.en.bin"),
fname_inp: path.join(__dirname, "../../samples/jfk.wav"),
use_gpu: true,
flash_attn: false,
no_prints: true,
comma_in_time: false,
translate: true,
Expand Down
Loading

0 comments on commit 4e9047e

Please sign in to comment.