Full Code of ggml-org/whisper.cpp for AI

master 9386f2394010 cached
1580 files
23.8 MB
4.0M tokens
1 requests
Copy disabled (too large) Download .txt
Showing preview only (16,074K chars total). Download the full file to get everything.
Repository: ggml-org/whisper.cpp
Branch: master
Commit: 9386f2394010
Files: 1580
Total size: 23.8 MB

Directory structure:
gitextract_2_of6s_n/

├── .devops/
│   ├── cublas.Dockerfile
│   ├── main-cuda.Dockerfile
│   ├── main-intel.Dockerfile
│   ├── main-musa.Dockerfile
│   ├── main-vulkan.Dockerfile
│   └── main.Dockerfile
├── .dockerignore
├── .github/
│   └── workflows/
│       ├── bindings-go.yml
│       ├── bindings-ruby.yml
│       ├── build.yml
│       ├── docker.yml
│       ├── examples-wasm.yml
│       └── examples.yml
├── .gitignore
├── AUTHORS
├── CMakeLists.txt
├── LICENSE
├── Makefile
├── README.md
├── README_sycl.md
├── bindings/
│   ├── CMakeLists.txt
│   ├── go/
│   │   ├── .gitignore
│   │   ├── LICENSE
│   │   ├── Makefile
│   │   ├── README.md
│   │   ├── doc.go
│   │   ├── examples/
│   │   │   ├── go-model-download/
│   │   │   │   ├── context.go
│   │   │   │   └── main.go
│   │   │   └── go-whisper/
│   │   │       ├── color.go
│   │   │       ├── flags.go
│   │   │       ├── main.go
│   │   │       └── process.go
│   │   ├── go.mod
│   │   ├── go.sum
│   │   ├── params.go
│   │   ├── pkg/
│   │   │   └── whisper/
│   │   │       ├── consts.go
│   │   │       ├── context.go
│   │   │       ├── context_test.go
│   │   │       ├── doc.go
│   │   │       ├── interface.go
│   │   │       ├── model.go
│   │   │       ├── model_test.go
│   │   │       └── util_test.go
│   │   ├── whisper.go
│   │   └── whisper_test.go
│   ├── java/
│   │   ├── README.md
│   │   ├── build.gradle
│   │   ├── gradle/
│   │   │   └── wrapper/
│   │   │       ├── gradle-wrapper.jar
│   │   │       └── gradle-wrapper.properties
│   │   ├── gradle.properties
│   │   ├── gradlew
│   │   ├── gradlew.bat
│   │   ├── settings.gradle
│   │   └── src/
│   │       ├── main/
│   │       │   └── java/
│   │       │       └── io/
│   │       │           └── github/
│   │       │               └── ggerganov/
│   │       │                   └── whispercpp/
│   │       │                       ├── WhisperConstants.java
│   │       │                       ├── WhisperContext.java
│   │       │                       ├── WhisperCpp.java
│   │       │                       ├── WhisperCppJnaLibrary.java
│   │       │                       ├── bean/
│   │       │                       │   └── WhisperSegment.java
│   │       │                       ├── callbacks/
│   │       │                       │   ├── GgmlAbortCallback.java
│   │       │                       │   ├── WhisperEncoderBeginCallback.java
│   │       │                       │   ├── WhisperLogitsFilterCallback.java
│   │       │                       │   ├── WhisperNewSegmentCallback.java
│   │       │                       │   └── WhisperProgressCallback.java
│   │       │                       ├── ggml/
│   │       │                       │   ├── GgmlTensor.java
│   │       │                       │   └── GgmlType.java
│   │       │                       ├── model/
│   │       │                       │   ├── EModel.java
│   │       │                       │   ├── WhisperModel.java
│   │       │                       │   ├── WhisperModelLoader.java
│   │       │                       │   ├── WhisperState.java
│   │       │                       │   └── WhisperTokenData.java
│   │       │                       └── params/
│   │       │                           ├── BeamSearchParams.java
│   │       │                           ├── CBool.java
│   │       │                           ├── GreedyParams.java
│   │       │                           ├── WhisperAhead.java
│   │       │                           ├── WhisperAheads.java
│   │       │                           ├── WhisperContextParams.java
│   │       │                           ├── WhisperFilters.java
│   │       │                           ├── WhisperFullParams.java
│   │       │                           ├── WhisperHParams.java
│   │       │                           └── WhisperSamplingStrategy.java
│   │       └── test/
│   │           └── java/
│   │               └── io/
│   │                   └── github/
│   │                       └── ggerganov/
│   │                           └── whispercpp/
│   │                               ├── WhisperCppTest.java
│   │                               └── WhisperJnaLibraryTest.java
│   ├── javascript/
│   │   ├── .gitignore
│   │   ├── CMakeLists.txt
│   │   ├── README.md
│   │   ├── emscripten.cpp
│   │   ├── libwhisper.worker.js
│   │   ├── package-tmpl.json
│   │   ├── package.json
│   │   └── whisper.js
│   └── ruby/
│       ├── .gitignore
│       ├── README.md
│       ├── Rakefile
│       ├── ext/
│       │   ├── .gitignore
│       │   ├── dependencies.rb
│       │   ├── extconf.rb
│       │   ├── options.rb
│       │   ├── ruby_whisper.c
│       │   ├── ruby_whisper.h
│       │   ├── ruby_whisper_context.c
│       │   ├── ruby_whisper_context_params.c
│       │   ├── ruby_whisper_error.c
│       │   ├── ruby_whisper_model.c
│       │   ├── ruby_whisper_params.c
│       │   ├── ruby_whisper_segment.c
│       │   ├── ruby_whisper_token.c
│       │   ├── ruby_whisper_transcribe.cpp
│       │   ├── ruby_whisper_vad_context.c
│       │   ├── ruby_whisper_vad_context_detect.cpp
│       │   ├── ruby_whisper_vad_params.c
│       │   ├── ruby_whisper_vad_segment.c
│       │   ├── ruby_whisper_vad_segments.c
│       │   └── sources/
│       │       └── CMakeGraphVizOptions.cmake
│       ├── extsources.rb
│       ├── lib/
│       │   └── whisper/
│       │       ├── context.rb
│       │       ├── model/
│       │       │   └── uri.rb
│       │       └── segment.rb
│       ├── sig/
│       │   └── whisper.rbs
│       ├── test/
│       │   ├── helper.rb
│       │   ├── jfk_reader/
│       │   │   ├── .gitignore
│       │   │   ├── extconf.rb
│       │   │   └── jfk_reader.c
│       │   ├── test_callback.rb
│       │   ├── test_context_params.rb
│       │   ├── test_error.rb
│       │   ├── test_model.rb
│       │   ├── test_package.rb
│       │   ├── test_params.rb
│       │   ├── test_segment.rb
│       │   ├── test_token.rb
│       │   ├── test_vad.rb
│       │   ├── test_vad_context.rb
│       │   ├── test_vad_params.rb
│       │   ├── test_vad_segment.rb
│       │   ├── test_vad_segments.rb
│       │   └── test_whisper.rb
│       └── whispercpp.gemspec
├── build-xcframework.sh
├── ci/
│   ├── README.md
│   └── run.sh
├── close-issue.yml
├── cmake/
│   ├── DefaultTargetOptions.cmake
│   ├── FindFFmpeg.cmake
│   ├── arm64-apple-clang.cmake
│   ├── arm64-windows-llvm.cmake
│   ├── build-info.cmake
│   ├── git-vars.cmake
│   ├── riscv64-spacemit-linux-gnu-gcc.cmake
│   ├── whisper-config.cmake.in
│   ├── whisper.pc.in
│   └── x64-windows-llvm.cmake
├── examples/
│   ├── CMakeLists.txt
│   ├── addon.node/
│   │   ├── .gitignore
│   │   ├── CMakeLists.txt
│   │   ├── README.md
│   │   ├── __test__/
│   │   │   └── whisper.spec.js
│   │   ├── addon.cpp
│   │   ├── index.js
│   │   ├── package.json
│   │   └── vad-example.js
│   ├── bench/
│   │   ├── CMakeLists.txt
│   │   ├── README.md
│   │   └── bench.cpp
│   ├── bench.wasm/
│   │   ├── CMakeLists.txt
│   │   ├── README.md
│   │   ├── emscripten.cpp
│   │   └── index-tmpl.html
│   ├── cli/
│   │   ├── CMakeLists.txt
│   │   ├── README.md
│   │   └── cli.cpp
│   ├── coi-serviceworker.js
│   ├── command/
│   │   ├── CMakeLists.txt
│   │   ├── README.md
│   │   ├── command.cpp
│   │   └── commands.txt
│   ├── command.wasm/
│   │   ├── CMakeLists.txt
│   │   ├── README.md
│   │   ├── emscripten.cpp
│   │   └── index-tmpl.html
│   ├── common-ggml.cpp
│   ├── common-ggml.h
│   ├── common-sdl.cpp
│   ├── common-sdl.h
│   ├── common-whisper.cpp
│   ├── common-whisper.h
│   ├── common.cpp
│   ├── common.h
│   ├── deprecation-warning/
│   │   ├── CMakeLists.txt
│   │   ├── README.md
│   │   └── deprecation-warning.cpp
│   ├── ffmpeg-transcode.cpp
│   ├── generate-karaoke.sh
│   ├── grammar-parser.cpp
│   ├── grammar-parser.h
│   ├── helpers.js
│   ├── json.hpp
│   ├── livestream.sh
│   ├── lsp/
│   │   ├── CMakeLists.txt
│   │   ├── README.md
│   │   ├── lsp.cpp
│   │   └── whisper.vim
│   ├── miniaudio.h
│   ├── python/
│   │   ├── test_whisper_processor.py
│   │   └── whisper_processor.py
│   ├── quantize/
│   │   ├── CMakeLists.txt
│   │   ├── README.md
│   │   └── quantize.cpp
│   ├── server/
│   │   ├── CMakeLists.txt
│   │   ├── README.md
│   │   ├── bench.js
│   │   ├── httplib.h
│   │   └── server.cpp
│   ├── server.py
│   ├── stb_vorbis.c
│   ├── stream/
│   │   ├── CMakeLists.txt
│   │   ├── README.md
│   │   └── stream.cpp
│   ├── stream.wasm/
│   │   ├── CMakeLists.txt
│   │   ├── README.md
│   │   ├── emscripten.cpp
│   │   └── index-tmpl.html
│   ├── sycl/
│   │   ├── CMakeLists.txt
│   │   ├── README.md
│   │   ├── build.sh
│   │   ├── ls-sycl-device.cpp
│   │   └── run-whisper.sh
│   ├── talk-llama/
│   │   ├── .gitignore
│   │   ├── CMakeLists.txt
│   │   ├── README.md
│   │   ├── eleven-labs.py
│   │   ├── llama-adapter.cpp
│   │   ├── llama-adapter.h
│   │   ├── llama-arch.cpp
│   │   ├── llama-arch.h
│   │   ├── llama-batch.cpp
│   │   ├── llama-batch.h
│   │   ├── llama-chat.cpp
│   │   ├── llama-chat.h
│   │   ├── llama-context.cpp
│   │   ├── llama-context.h
│   │   ├── llama-cparams.cpp
│   │   ├── llama-cparams.h
│   │   ├── llama-ext.h
│   │   ├── llama-grammar.cpp
│   │   ├── llama-grammar.h
│   │   ├── llama-graph.cpp
│   │   ├── llama-graph.h
│   │   ├── llama-hparams.cpp
│   │   ├── llama-hparams.h
│   │   ├── llama-impl.cpp
│   │   ├── llama-impl.h
│   │   ├── llama-io.cpp
│   │   ├── llama-io.h
│   │   ├── llama-kv-cache-iswa.cpp
│   │   ├── llama-kv-cache-iswa.h
│   │   ├── llama-kv-cache.cpp
│   │   ├── llama-kv-cache.h
│   │   ├── llama-kv-cells.h
│   │   ├── llama-memory-hybrid-iswa.cpp
│   │   ├── llama-memory-hybrid-iswa.h
│   │   ├── llama-memory-hybrid.cpp
│   │   ├── llama-memory-hybrid.h
│   │   ├── llama-memory-recurrent.cpp
│   │   ├── llama-memory-recurrent.h
│   │   ├── llama-memory.cpp
│   │   ├── llama-memory.h
│   │   ├── llama-mmap.cpp
│   │   ├── llama-mmap.h
│   │   ├── llama-model-loader.cpp
│   │   ├── llama-model-loader.h
│   │   ├── llama-model-saver.cpp
│   │   ├── llama-model-saver.h
│   │   ├── llama-model.cpp
│   │   ├── llama-model.h
│   │   ├── llama-quant.cpp
│   │   ├── llama-quant.h
│   │   ├── llama-sampler.cpp
│   │   ├── llama-sampler.h
│   │   ├── llama-vocab.cpp
│   │   ├── llama-vocab.h
│   │   ├── llama.cpp
│   │   ├── llama.h
│   │   ├── models/
│   │   │   ├── afmoe.cpp
│   │   │   ├── apertus.cpp
│   │   │   ├── arcee.cpp
│   │   │   ├── arctic.cpp
│   │   │   ├── arwkv7.cpp
│   │   │   ├── baichuan.cpp
│   │   │   ├── bailingmoe.cpp
│   │   │   ├── bailingmoe2.cpp
│   │   │   ├── bert.cpp
│   │   │   ├── bitnet.cpp
│   │   │   ├── bloom.cpp
│   │   │   ├── chameleon.cpp
│   │   │   ├── chatglm.cpp
│   │   │   ├── codeshell.cpp
│   │   │   ├── cogvlm.cpp
│   │   │   ├── cohere2-iswa.cpp
│   │   │   ├── command-r.cpp
│   │   │   ├── dbrx.cpp
│   │   │   ├── deci.cpp
│   │   │   ├── deepseek.cpp
│   │   │   ├── deepseek2.cpp
│   │   │   ├── delta-net-base.cpp
│   │   │   ├── dots1.cpp
│   │   │   ├── dream.cpp
│   │   │   ├── ernie4-5-moe.cpp
│   │   │   ├── ernie4-5.cpp
│   │   │   ├── eurobert.cpp
│   │   │   ├── exaone-moe.cpp
│   │   │   ├── exaone.cpp
│   │   │   ├── exaone4.cpp
│   │   │   ├── falcon-h1.cpp
│   │   │   ├── falcon.cpp
│   │   │   ├── gemma-embedding.cpp
│   │   │   ├── gemma.cpp
│   │   │   ├── gemma2-iswa.cpp
│   │   │   ├── gemma3.cpp
│   │   │   ├── gemma3n-iswa.cpp
│   │   │   ├── glm4-moe.cpp
│   │   │   ├── glm4.cpp
│   │   │   ├── gpt2.cpp
│   │   │   ├── gptneox.cpp
│   │   │   ├── granite-hybrid.cpp
│   │   │   ├── granite.cpp
│   │   │   ├── grok.cpp
│   │   │   ├── grovemoe.cpp
│   │   │   ├── hunyuan-dense.cpp
│   │   │   ├── hunyuan-moe.cpp
│   │   │   ├── internlm2.cpp
│   │   │   ├── jais.cpp
│   │   │   ├── jais2.cpp
│   │   │   ├── jamba.cpp
│   │   │   ├── kimi-linear.cpp
│   │   │   ├── lfm2.cpp
│   │   │   ├── llada-moe.cpp
│   │   │   ├── llada.cpp
│   │   │   ├── llama-iswa.cpp
│   │   │   ├── llama.cpp
│   │   │   ├── maincoder.cpp
│   │   │   ├── mamba-base.cpp
│   │   │   ├── mamba.cpp
│   │   │   ├── mimo2-iswa.cpp
│   │   │   ├── minicpm3.cpp
│   │   │   ├── minimax-m2.cpp
│   │   │   ├── mistral3.cpp
│   │   │   ├── models.h
│   │   │   ├── modern-bert.cpp
│   │   │   ├── mpt.cpp
│   │   │   ├── nemotron-h.cpp
│   │   │   ├── nemotron.cpp
│   │   │   ├── neo-bert.cpp
│   │   │   ├── olmo.cpp
│   │   │   ├── olmo2.cpp
│   │   │   ├── olmoe.cpp
│   │   │   ├── openai-moe-iswa.cpp
│   │   │   ├── openelm.cpp
│   │   │   ├── orion.cpp
│   │   │   ├── paddleocr.cpp
│   │   │   ├── pangu-embedded.cpp
│   │   │   ├── phi2.cpp
│   │   │   ├── phi3.cpp
│   │   │   ├── plamo.cpp
│   │   │   ├── plamo2.cpp
│   │   │   ├── plamo3.cpp
│   │   │   ├── plm.cpp
│   │   │   ├── qwen.cpp
│   │   │   ├── qwen2.cpp
│   │   │   ├── qwen2moe.cpp
│   │   │   ├── qwen2vl.cpp
│   │   │   ├── qwen3.cpp
│   │   │   ├── qwen35.cpp
│   │   │   ├── qwen35moe.cpp
│   │   │   ├── qwen3moe.cpp
│   │   │   ├── qwen3next.cpp
│   │   │   ├── qwen3vl-moe.cpp
│   │   │   ├── qwen3vl.cpp
│   │   │   ├── refact.cpp
│   │   │   ├── rnd1.cpp
│   │   │   ├── rwkv6-base.cpp
│   │   │   ├── rwkv6.cpp
│   │   │   ├── rwkv6qwen2.cpp
│   │   │   ├── rwkv7-base.cpp
│   │   │   ├── rwkv7.cpp
│   │   │   ├── seed-oss.cpp
│   │   │   ├── smallthinker.cpp
│   │   │   ├── smollm3.cpp
│   │   │   ├── stablelm.cpp
│   │   │   ├── starcoder.cpp
│   │   │   ├── starcoder2.cpp
│   │   │   ├── step35-iswa.cpp
│   │   │   ├── t5-dec.cpp
│   │   │   ├── t5-enc.cpp
│   │   │   ├── wavtokenizer-dec.cpp
│   │   │   └── xverse.cpp
│   │   ├── prompts/
│   │   │   └── talk-alpaca.txt
│   │   ├── speak
│   │   ├── speak.bat
│   │   ├── speak.ps1
│   │   ├── talk-llama.cpp
│   │   ├── unicode-data.cpp
│   │   ├── unicode-data.h
│   │   ├── unicode.cpp
│   │   └── unicode.h
│   ├── twitch.sh
│   ├── vad-speech-segments/
│   │   ├── CMakeLists.txt
│   │   ├── README.md
│   │   └── speech.cpp
│   ├── wchess/
│   │   ├── CMakeLists.txt
│   │   ├── README.md
│   │   ├── libwchess/
│   │   │   ├── CMakeLists.txt
│   │   │   ├── Chessboard.cpp
│   │   │   ├── Chessboard.h
│   │   │   ├── WChess.cpp
│   │   │   ├── WChess.h
│   │   │   └── test-chessboard.cpp
│   │   ├── wchess.cmd/
│   │   │   ├── CMakeLists.txt
│   │   │   └── wchess.cmd.cpp
│   │   └── wchess.wasm/
│   │       ├── CMakeLists.txt
│   │       ├── chessboardjs-1.0.0/
│   │       │   ├── css/
│   │       │   │   └── chessboard-1.0.0.css
│   │       │   └── js/
│   │       │       ├── chessboard-1.0.0/
│   │       │       │   ├── CHANGELOG.md
│   │       │       │   ├── LICENSE.md
│   │       │       │   ├── README.md
│   │       │       │   └── package.json
│   │       │       └── chessboard-1.0.0.js
│   │       ├── index-tmpl.html
│   │       └── wchess.wasm.cpp
│   ├── whisper.android/
│   │   ├── .gitignore
│   │   ├── README.md
│   │   ├── app/
│   │   │   ├── .gitignore
│   │   │   ├── build.gradle
│   │   │   ├── proguard-rules.pro
│   │   │   └── src/
│   │   │       ├── androidTest/
│   │   │       │   └── java/
│   │   │       │       └── com/
│   │   │       │           └── whispercppdemo/
│   │   │       │               └── ExampleInstrumentedTest.kt
│   │   │       ├── main/
│   │   │       │   ├── AndroidManifest.xml
│   │   │       │   ├── java/
│   │   │       │   │   └── com/
│   │   │       │   │       └── whispercppdemo/
│   │   │       │   │           ├── MainActivity.kt
│   │   │       │   │           ├── media/
│   │   │       │   │           │   └── RiffWaveHelper.kt
│   │   │       │   │           ├── recorder/
│   │   │       │   │           │   └── Recorder.kt
│   │   │       │   │           └── ui/
│   │   │       │   │               ├── main/
│   │   │       │   │               │   ├── MainScreen.kt
│   │   │       │   │               │   └── MainScreenViewModel.kt
│   │   │       │   │               └── theme/
│   │   │       │   │                   ├── Color.kt
│   │   │       │   │                   ├── Theme.kt
│   │   │       │   │                   └── Type.kt
│   │   │       │   └── res/
│   │   │       │       ├── drawable/
│   │   │       │       │   ├── ic_launcher_background.xml
│   │   │       │       │   └── ic_launcher_foreground.xml
│   │   │       │       ├── mipmap-anydpi/
│   │   │       │       │   └── ic_launcher.xml
│   │   │       │       ├── values/
│   │   │       │       │   ├── strings.xml
│   │   │       │       │   └── themes.xml
│   │   │       │       └── xml/
│   │   │       │           ├── backup_rules.xml
│   │   │       │           └── data_extraction_rules.xml
│   │   │       └── test/
│   │   │           └── java/
│   │   │               └── com/
│   │   │                   └── whispercppdemo/
│   │   │                       └── ExampleUnitTest.kt
│   │   ├── build.gradle
│   │   ├── gradle/
│   │   │   └── wrapper/
│   │   │       ├── gradle-wrapper.jar
│   │   │       └── gradle-wrapper.properties
│   │   ├── gradle.properties
│   │   ├── gradlew
│   │   ├── gradlew.bat
│   │   ├── lib/
│   │   │   ├── .gitignore
│   │   │   ├── build.gradle
│   │   │   └── src/
│   │   │       └── main/
│   │   │           ├── AndroidManifest.xml
│   │   │           ├── java/
│   │   │           │   └── com/
│   │   │           │       └── whispercpp/
│   │   │           │           └── whisper/
│   │   │           │               ├── LibWhisper.kt
│   │   │           │               └── WhisperCpuConfig.kt
│   │   │           └── jni/
│   │   │               └── whisper/
│   │   │                   ├── CMakeLists.txt
│   │   │                   └── jni.c
│   │   └── settings.gradle
│   ├── whisper.android.java/
│   │   ├── .gitignore
│   │   ├── README.md
│   │   ├── app/
│   │   │   ├── .gitignore
│   │   │   ├── build.gradle
│   │   │   ├── proguard-rules.pro
│   │   │   └── src/
│   │   │       ├── androidTest/
│   │   │       │   └── java/
│   │   │       │       └── com/
│   │   │       │           └── litongjava/
│   │   │       │               └── whisper/
│   │   │       │                   └── android/
│   │   │       │                       └── java/
│   │   │       │                           └── ExampleInstrumentedTest.java
│   │   │       ├── main/
│   │   │       │   ├── AndroidManifest.xml
│   │   │       │   ├── assets/
│   │   │       │   │   └── logback.xml
│   │   │       │   ├── java/
│   │   │       │   │   └── com/
│   │   │       │   │       ├── litongjava/
│   │   │       │   │       │   └── whisper/
│   │   │       │   │       │       └── android/
│   │   │       │   │       │           └── java/
│   │   │       │   │       │               ├── MainActivity.java
│   │   │       │   │       │               ├── app/
│   │   │       │   │       │               │   └── App.java
│   │   │       │   │       │               ├── bean/
│   │   │       │   │       │               │   └── WhisperSegment.java
│   │   │       │   │       │               ├── services/
│   │   │       │   │       │               │   └── WhisperService.java
│   │   │       │   │       │               ├── single/
│   │   │       │   │       │               │   └── LocalWhisper.java
│   │   │       │   │       │               ├── task/
│   │   │       │   │       │               │   ├── LoadModelTask.java
│   │   │       │   │       │               │   └── TranscriptionTask.java
│   │   │       │   │       │               └── utils/
│   │   │       │   │       │                   ├── AssetUtils.java
│   │   │       │   │       │                   └── WaveEncoder.java
│   │   │       │   │       └── whispercpp/
│   │   │       │   │           └── java/
│   │   │       │   │               └── whisper/
│   │   │       │   │                   ├── CpuInfo.java
│   │   │       │   │                   ├── WhisperContext.java
│   │   │       │   │                   ├── WhisperCpuConfig.java
│   │   │       │   │                   ├── WhisperLib.java
│   │   │       │   │                   └── WhisperUtils.java
│   │   │       │   ├── jni/
│   │   │       │   │   └── whisper/
│   │   │       │   │       ├── CMakeLists.txt
│   │   │       │   │       └── jni.c
│   │   │       │   └── res/
│   │   │       │       ├── drawable/
│   │   │       │       │   └── ic_launcher_background.xml
│   │   │       │       ├── drawable-v24/
│   │   │       │       │   └── ic_launcher_foreground.xml
│   │   │       │       ├── layout/
│   │   │       │       │   └── activity_main.xml
│   │   │       │       ├── mipmap-anydpi-v26/
│   │   │       │       │   ├── ic_launcher.xml
│   │   │       │       │   └── ic_launcher_round.xml
│   │   │       │       ├── values/
│   │   │       │       │   ├── colors.xml
│   │   │       │       │   ├── strings.xml
│   │   │       │       │   └── themes.xml
│   │   │       │       └── values-night/
│   │   │       │           └── themes.xml
│   │   │       └── test/
│   │   │           └── java/
│   │   │               └── com/
│   │   │                   └── litongjava/
│   │   │                       └── whisper/
│   │   │                           └── android/
│   │   │                               └── java/
│   │   │                                   └── ExampleUnitTest.java
│   │   ├── build.gradle
│   │   ├── gradle/
│   │   │   └── wrapper/
│   │   │       ├── gradle-wrapper.jar
│   │   │       └── gradle-wrapper.properties
│   │   ├── gradle.properties
│   │   ├── gradlew
│   │   ├── gradlew.bat
│   │   └── settings.gradle
│   ├── whisper.nvim/
│   │   ├── README.md
│   │   └── whisper.nvim
│   ├── whisper.objc/
│   │   ├── README.md
│   │   ├── whisper.objc/
│   │   │   ├── AppDelegate.h
│   │   │   ├── AppDelegate.m
│   │   │   ├── Assets.xcassets/
│   │   │   │   ├── AccentColor.colorset/
│   │   │   │   │   └── Contents.json
│   │   │   │   ├── AppIcon.appiconset/
│   │   │   │   │   └── Contents.json
│   │   │   │   └── Contents.json
│   │   │   ├── Base.lproj/
│   │   │   │   ├── LaunchScreen.storyboard
│   │   │   │   └── Main.storyboard
│   │   │   ├── Info.plist
│   │   │   ├── SceneDelegate.h
│   │   │   ├── SceneDelegate.m
│   │   │   ├── ViewController.h
│   │   │   ├── ViewController.m
│   │   │   └── main.m
│   │   └── whisper.objc.xcodeproj/
│   │       ├── project.pbxproj
│   │       └── project.xcworkspace/
│   │           ├── contents.xcworkspacedata
│   │           └── xcshareddata/
│   │               └── IDEWorkspaceChecks.plist
│   ├── whisper.swiftui/
│   │   ├── .gitignore
│   │   ├── README.md
│   │   ├── whisper.cpp.swift/
│   │   │   └── LibWhisper.swift
│   │   ├── whisper.swiftui.demo/
│   │   │   ├── Models/
│   │   │   │   ├── Model.swift
│   │   │   │   └── WhisperState.swift
│   │   │   ├── Resources/
│   │   │   │   ├── models/
│   │   │   │   │   └── .gitignore
│   │   │   │   └── samples/
│   │   │   │       └── .gitignore
│   │   │   ├── Supporting files/
│   │   │   │   ├── Assets.xcassets/
│   │   │   │   │   ├── AccentColor.colorset/
│   │   │   │   │   │   └── Contents.json
│   │   │   │   │   ├── AppIcon.appiconset/
│   │   │   │   │   │   └── Contents.json
│   │   │   │   │   └── Contents.json
│   │   │   │   ├── Preview Content/
│   │   │   │   │   └── Preview Assets.xcassets/
│   │   │   │   │       └── Contents.json
│   │   │   │   └── WhisperCppDemo.entitlements
│   │   │   ├── UI/
│   │   │   │   ├── ContentView.swift
│   │   │   │   └── DownloadButton.swift
│   │   │   ├── Utils/
│   │   │   │   ├── Recorder.swift
│   │   │   │   └── RiffWaveUtils.swift
│   │   │   └── WhisperCppDemoApp.swift
│   │   └── whisper.swiftui.xcodeproj/
│   │       ├── .gitignore
│   │       ├── project.pbxproj
│   │       └── project.xcworkspace/
│   │           └── .gitignore
│   ├── whisper.wasm/
│   │   ├── CMakeLists.txt
│   │   ├── README.md
│   │   ├── emscripten.cpp
│   │   └── index-tmpl.html
│   └── yt-wsp.sh
├── ggml/
│   ├── .gitignore
│   ├── CMakeLists.txt
│   ├── cmake/
│   │   ├── GitVars.cmake
│   │   ├── common.cmake
│   │   └── ggml-config.cmake.in
│   ├── include/
│   │   ├── ggml-alloc.h
│   │   ├── ggml-backend.h
│   │   ├── ggml-blas.h
│   │   ├── ggml-cann.h
│   │   ├── ggml-cpp.h
│   │   ├── ggml-cpu.h
│   │   ├── ggml-cuda.h
│   │   ├── ggml-hexagon.h
│   │   ├── ggml-metal.h
│   │   ├── ggml-opencl.h
│   │   ├── ggml-openvino.h
│   │   ├── ggml-opt.h
│   │   ├── ggml-rpc.h
│   │   ├── ggml-sycl.h
│   │   ├── ggml-virtgpu.h
│   │   ├── ggml-vulkan.h
│   │   ├── ggml-webgpu.h
│   │   ├── ggml-zdnn.h
│   │   ├── ggml-zendnn.h
│   │   ├── ggml.h
│   │   └── gguf.h
│   └── src/
│       ├── CMakeLists.txt
│       ├── ggml-alloc.c
│       ├── ggml-backend-dl.cpp
│       ├── ggml-backend-dl.h
│       ├── ggml-backend-impl.h
│       ├── ggml-backend-reg.cpp
│       ├── ggml-backend.cpp
│       ├── ggml-blas/
│       │   ├── CMakeLists.txt
│       │   └── ggml-blas.cpp
│       ├── ggml-cann/
│       │   ├── CMakeLists.txt
│       │   ├── acl_tensor.cpp
│       │   ├── acl_tensor.h
│       │   ├── aclnn_ops.cpp
│       │   ├── aclnn_ops.h
│       │   ├── common.h
│       │   └── ggml-cann.cpp
│       ├── ggml-common.h
│       ├── ggml-cpu/
│       │   ├── CMakeLists.txt
│       │   ├── amx/
│       │   │   ├── amx.cpp
│       │   │   ├── amx.h
│       │   │   ├── common.h
│       │   │   ├── mmq.cpp
│       │   │   └── mmq.h
│       │   ├── arch/
│       │   │   ├── arm/
│       │   │   │   ├── cpu-feats.cpp
│       │   │   │   ├── quants.c
│       │   │   │   └── repack.cpp
│       │   │   ├── loongarch/
│       │   │   │   └── quants.c
│       │   │   ├── powerpc/
│       │   │   │   ├── cpu-feats.cpp
│       │   │   │   └── quants.c
│       │   │   ├── riscv/
│       │   │   │   ├── cpu-feats.cpp
│       │   │   │   ├── quants.c
│       │   │   │   └── repack.cpp
│       │   │   ├── s390/
│       │   │   │   ├── cpu-feats.cpp
│       │   │   │   └── quants.c
│       │   │   ├── wasm/
│       │   │   │   └── quants.c
│       │   │   └── x86/
│       │   │       ├── cpu-feats.cpp
│       │   │       ├── quants.c
│       │   │       └── repack.cpp
│       │   ├── arch-fallback.h
│       │   ├── binary-ops.cpp
│       │   ├── binary-ops.h
│       │   ├── cmake/
│       │   │   └── FindSIMD.cmake
│       │   ├── common.h
│       │   ├── ggml-cpu-impl.h
│       │   ├── ggml-cpu.c
│       │   ├── ggml-cpu.cpp
│       │   ├── hbm.cpp
│       │   ├── hbm.h
│       │   ├── kleidiai/
│       │   │   ├── kernels.cpp
│       │   │   ├── kernels.h
│       │   │   ├── kleidiai.cpp
│       │   │   └── kleidiai.h
│       │   ├── llamafile/
│       │   │   ├── sgemm.cpp
│       │   │   └── sgemm.h
│       │   ├── ops.cpp
│       │   ├── ops.h
│       │   ├── quants.c
│       │   ├── quants.h
│       │   ├── repack.cpp
│       │   ├── repack.h
│       │   ├── simd-gemm.h
│       │   ├── simd-mappings.h
│       │   ├── spacemit/
│       │   │   ├── ime.cpp
│       │   │   ├── ime.h
│       │   │   ├── ime1_kernels.cpp
│       │   │   └── ime_kernels.h
│       │   ├── traits.cpp
│       │   ├── traits.h
│       │   ├── unary-ops.cpp
│       │   ├── unary-ops.h
│       │   ├── vec.cpp
│       │   └── vec.h
│       ├── ggml-cuda/
│       │   ├── CMakeLists.txt
│       │   ├── acc.cu
│       │   ├── acc.cuh
│       │   ├── add-id.cu
│       │   ├── add-id.cuh
│       │   ├── arange.cu
│       │   ├── arange.cuh
│       │   ├── argmax.cu
│       │   ├── argmax.cuh
│       │   ├── argsort.cu
│       │   ├── argsort.cuh
│       │   ├── binbcast.cu
│       │   ├── binbcast.cuh
│       │   ├── clamp.cu
│       │   ├── clamp.cuh
│       │   ├── common.cuh
│       │   ├── concat.cu
│       │   ├── concat.cuh
│       │   ├── conv-transpose-1d.cu
│       │   ├── conv-transpose-1d.cuh
│       │   ├── conv2d-dw.cu
│       │   ├── conv2d-dw.cuh
│       │   ├── conv2d-transpose.cu
│       │   ├── conv2d-transpose.cuh
│       │   ├── conv2d.cu
│       │   ├── conv2d.cuh
│       │   ├── convert.cu
│       │   ├── convert.cuh
│       │   ├── count-equal.cu
│       │   ├── count-equal.cuh
│       │   ├── cp-async.cuh
│       │   ├── cpy-utils.cuh
│       │   ├── cpy.cu
│       │   ├── cpy.cuh
│       │   ├── cross-entropy-loss.cu
│       │   ├── cross-entropy-loss.cuh
│       │   ├── cumsum.cu
│       │   ├── cumsum.cuh
│       │   ├── dequantize.cuh
│       │   ├── diag.cu
│       │   ├── diag.cuh
│       │   ├── diagmask.cu
│       │   ├── diagmask.cuh
│       │   ├── fattn-common.cuh
│       │   ├── fattn-mma-f16.cuh
│       │   ├── fattn-tile.cu
│       │   ├── fattn-tile.cuh
│       │   ├── fattn-vec.cuh
│       │   ├── fattn-wmma-f16.cu
│       │   ├── fattn-wmma-f16.cuh
│       │   ├── fattn.cu
│       │   ├── fattn.cuh
│       │   ├── fill.cu
│       │   ├── fill.cuh
│       │   ├── gated_delta_net.cu
│       │   ├── gated_delta_net.cuh
│       │   ├── getrows.cu
│       │   ├── getrows.cuh
│       │   ├── ggml-cuda.cu
│       │   ├── gla.cu
│       │   ├── gla.cuh
│       │   ├── im2col.cu
│       │   ├── im2col.cuh
│       │   ├── mean.cu
│       │   ├── mean.cuh
│       │   ├── mma.cuh
│       │   ├── mmf.cu
│       │   ├── mmf.cuh
│       │   ├── mmid.cu
│       │   ├── mmid.cuh
│       │   ├── mmq.cu
│       │   ├── mmq.cuh
│       │   ├── mmvf.cu
│       │   ├── mmvf.cuh
│       │   ├── mmvq.cu
│       │   ├── mmvq.cuh
│       │   ├── norm.cu
│       │   ├── norm.cuh
│       │   ├── opt-step-adamw.cu
│       │   ├── opt-step-adamw.cuh
│       │   ├── opt-step-sgd.cu
│       │   ├── opt-step-sgd.cuh
│       │   ├── out-prod.cu
│       │   ├── out-prod.cuh
│       │   ├── pad.cu
│       │   ├── pad.cuh
│       │   ├── pad_reflect_1d.cu
│       │   ├── pad_reflect_1d.cuh
│       │   ├── pool2d.cu
│       │   ├── pool2d.cuh
│       │   ├── quantize.cu
│       │   ├── quantize.cuh
│       │   ├── reduce_rows.cuh
│       │   ├── roll.cu
│       │   ├── roll.cuh
│       │   ├── rope.cu
│       │   ├── rope.cuh
│       │   ├── scale.cu
│       │   ├── scale.cuh
│       │   ├── set-rows.cu
│       │   ├── set-rows.cuh
│       │   ├── set.cu
│       │   ├── set.cuh
│       │   ├── softcap.cu
│       │   ├── softcap.cuh
│       │   ├── softmax.cu
│       │   ├── softmax.cuh
│       │   ├── solve_tri.cu
│       │   ├── solve_tri.cuh
│       │   ├── ssm-conv.cu
│       │   ├── ssm-conv.cuh
│       │   ├── ssm-scan.cu
│       │   ├── ssm-scan.cuh
│       │   ├── sum.cu
│       │   ├── sum.cuh
│       │   ├── sumrows.cu
│       │   ├── sumrows.cuh
│       │   ├── template-instances/
│       │   │   ├── fattn-mma-f16-instance-ncols1_1-ncols2_16.cu
│       │   │   ├── fattn-mma-f16-instance-ncols1_1-ncols2_32.cu
│       │   │   ├── fattn-mma-f16-instance-ncols1_1-ncols2_8.cu
│       │   │   ├── fattn-mma-f16-instance-ncols1_16-ncols2_1.cu
│       │   │   ├── fattn-mma-f16-instance-ncols1_16-ncols2_2.cu
│       │   │   ├── fattn-mma-f16-instance-ncols1_16-ncols2_4.cu
│       │   │   ├── fattn-mma-f16-instance-ncols1_2-ncols2_16.cu
│       │   │   ├── fattn-mma-f16-instance-ncols1_2-ncols2_32.cu
│       │   │   ├── fattn-mma-f16-instance-ncols1_2-ncols2_4.cu
│       │   │   ├── fattn-mma-f16-instance-ncols1_2-ncols2_8.cu
│       │   │   ├── fattn-mma-f16-instance-ncols1_32-ncols2_1.cu
│       │   │   ├── fattn-mma-f16-instance-ncols1_32-ncols2_2.cu
│       │   │   ├── fattn-mma-f16-instance-ncols1_4-ncols2_16.cu
│       │   │   ├── fattn-mma-f16-instance-ncols1_4-ncols2_2.cu
│       │   │   ├── fattn-mma-f16-instance-ncols1_4-ncols2_4.cu
│       │   │   ├── fattn-mma-f16-instance-ncols1_4-ncols2_8.cu
│       │   │   ├── fattn-mma-f16-instance-ncols1_64-ncols2_1.cu
│       │   │   ├── fattn-mma-f16-instance-ncols1_8-ncols2_1.cu
│       │   │   ├── fattn-mma-f16-instance-ncols1_8-ncols2_2.cu
│       │   │   ├── fattn-mma-f16-instance-ncols1_8-ncols2_4.cu
│       │   │   ├── fattn-mma-f16-instance-ncols1_8-ncols2_8.cu
│       │   │   ├── fattn-tile-instance-dkq112-dv112.cu
│       │   │   ├── fattn-tile-instance-dkq128-dv128.cu
│       │   │   ├── fattn-tile-instance-dkq256-dv256.cu
│       │   │   ├── fattn-tile-instance-dkq40-dv40.cu
│       │   │   ├── fattn-tile-instance-dkq576-dv512.cu
│       │   │   ├── fattn-tile-instance-dkq64-dv64.cu
│       │   │   ├── fattn-tile-instance-dkq72-dv72.cu
│       │   │   ├── fattn-tile-instance-dkq80-dv80.cu
│       │   │   ├── fattn-tile-instance-dkq96-dv96.cu
│       │   │   ├── fattn-vec-instance-f16-f16.cu
│       │   │   ├── fattn-vec-instance-f16-q4_0.cu
│       │   │   ├── fattn-vec-instance-f16-q4_1.cu
│       │   │   ├── fattn-vec-instance-f16-q5_0.cu
│       │   │   ├── fattn-vec-instance-f16-q5_1.cu
│       │   │   ├── fattn-vec-instance-f16-q8_0.cu
│       │   │   ├── fattn-vec-instance-q4_0-f16.cu
│       │   │   ├── fattn-vec-instance-q4_0-q4_0.cu
│       │   │   ├── fattn-vec-instance-q4_0-q4_1.cu
│       │   │   ├── fattn-vec-instance-q4_0-q5_0.cu
│       │   │   ├── fattn-vec-instance-q4_0-q5_1.cu
│       │   │   ├── fattn-vec-instance-q4_0-q8_0.cu
│       │   │   ├── fattn-vec-instance-q4_1-f16.cu
│       │   │   ├── fattn-vec-instance-q4_1-q4_0.cu
│       │   │   ├── fattn-vec-instance-q4_1-q4_1.cu
│       │   │   ├── fattn-vec-instance-q4_1-q5_0.cu
│       │   │   ├── fattn-vec-instance-q4_1-q5_1.cu
│       │   │   ├── fattn-vec-instance-q4_1-q8_0.cu
│       │   │   ├── fattn-vec-instance-q5_0-f16.cu
│       │   │   ├── fattn-vec-instance-q5_0-q4_0.cu
│       │   │   ├── fattn-vec-instance-q5_0-q4_1.cu
│       │   │   ├── fattn-vec-instance-q5_0-q5_0.cu
│       │   │   ├── fattn-vec-instance-q5_0-q5_1.cu
│       │   │   ├── fattn-vec-instance-q5_0-q8_0.cu
│       │   │   ├── fattn-vec-instance-q5_1-f16.cu
│       │   │   ├── fattn-vec-instance-q5_1-q4_0.cu
│       │   │   ├── fattn-vec-instance-q5_1-q4_1.cu
│       │   │   ├── fattn-vec-instance-q5_1-q5_0.cu
│       │   │   ├── fattn-vec-instance-q5_1-q5_1.cu
│       │   │   ├── fattn-vec-instance-q5_1-q8_0.cu
│       │   │   ├── fattn-vec-instance-q8_0-f16.cu
│       │   │   ├── fattn-vec-instance-q8_0-q4_0.cu
│       │   │   ├── fattn-vec-instance-q8_0-q4_1.cu
│       │   │   ├── fattn-vec-instance-q8_0-q5_0.cu
│       │   │   ├── fattn-vec-instance-q8_0-q5_1.cu
│       │   │   ├── fattn-vec-instance-q8_0-q8_0.cu
│       │   │   ├── generate_cu_files.py
│       │   │   ├── mmf-instance-ncols_1.cu
│       │   │   ├── mmf-instance-ncols_10.cu
│       │   │   ├── mmf-instance-ncols_11.cu
│       │   │   ├── mmf-instance-ncols_12.cu
│       │   │   ├── mmf-instance-ncols_13.cu
│       │   │   ├── mmf-instance-ncols_14.cu
│       │   │   ├── mmf-instance-ncols_15.cu
│       │   │   ├── mmf-instance-ncols_16.cu
│       │   │   ├── mmf-instance-ncols_2.cu
│       │   │   ├── mmf-instance-ncols_3.cu
│       │   │   ├── mmf-instance-ncols_4.cu
│       │   │   ├── mmf-instance-ncols_5.cu
│       │   │   ├── mmf-instance-ncols_6.cu
│       │   │   ├── mmf-instance-ncols_7.cu
│       │   │   ├── mmf-instance-ncols_8.cu
│       │   │   ├── mmf-instance-ncols_9.cu
│       │   │   ├── mmq-instance-iq1_s.cu
│       │   │   ├── mmq-instance-iq2_s.cu
│       │   │   ├── mmq-instance-iq2_xs.cu
│       │   │   ├── mmq-instance-iq2_xxs.cu
│       │   │   ├── mmq-instance-iq3_s.cu
│       │   │   ├── mmq-instance-iq3_xxs.cu
│       │   │   ├── mmq-instance-iq4_nl.cu
│       │   │   ├── mmq-instance-iq4_xs.cu
│       │   │   ├── mmq-instance-mxfp4.cu
│       │   │   ├── mmq-instance-q2_k.cu
│       │   │   ├── mmq-instance-q3_k.cu
│       │   │   ├── mmq-instance-q4_0.cu
│       │   │   ├── mmq-instance-q4_1.cu
│       │   │   ├── mmq-instance-q4_k.cu
│       │   │   ├── mmq-instance-q5_0.cu
│       │   │   ├── mmq-instance-q5_1.cu
│       │   │   ├── mmq-instance-q5_k.cu
│       │   │   ├── mmq-instance-q6_k.cu
│       │   │   └── mmq-instance-q8_0.cu
│       │   ├── top-k.cu
│       │   ├── top-k.cuh
│       │   ├── topk-moe.cu
│       │   ├── topk-moe.cuh
│       │   ├── tri.cu
│       │   ├── tri.cuh
│       │   ├── tsembd.cu
│       │   ├── tsembd.cuh
│       │   ├── unary.cu
│       │   ├── unary.cuh
│       │   ├── upscale.cu
│       │   ├── upscale.cuh
│       │   ├── vecdotq.cuh
│       │   ├── vendors/
│       │   │   ├── cuda.h
│       │   │   ├── hip.h
│       │   │   └── musa.h
│       │   ├── wkv.cu
│       │   └── wkv.cuh
│       ├── ggml-hexagon/
│       │   ├── CMakeLists.txt
│       │   ├── ggml-hexagon.cpp
│       │   ├── htp/
│       │   │   ├── CMakeLists.txt
│       │   │   ├── act-ops.c
│       │   │   ├── argsort-ops.c
│       │   │   ├── binary-ops.c
│       │   │   ├── cmake-toolchain.cmake
│       │   │   ├── cpy-ops.c
│       │   │   ├── flash-attn-ops.c
│       │   │   ├── get-rows-ops.c
│       │   │   ├── hex-dma.c
│       │   │   ├── hex-dma.h
│       │   │   ├── hex-dump.h
│       │   │   ├── hex-fastdiv.h
│       │   │   ├── hex-utils.h
│       │   │   ├── htp-ctx.h
│       │   │   ├── htp-msg.h
│       │   │   ├── htp-ops.h
│       │   │   ├── htp_iface.idl
│       │   │   ├── hvx-arith.h
│       │   │   ├── hvx-base.h
│       │   │   ├── hvx-copy.h
│       │   │   ├── hvx-div.h
│       │   │   ├── hvx-dump.h
│       │   │   ├── hvx-exp.h
│       │   │   ├── hvx-floor.h
│       │   │   ├── hvx-inverse.h
│       │   │   ├── hvx-reduce.h
│       │   │   ├── hvx-scale.h
│       │   │   ├── hvx-sigmoid.h
│       │   │   ├── hvx-sqrt.h
│       │   │   ├── hvx-types.h
│       │   │   ├── hvx-utils.h
│       │   │   ├── main.c
│       │   │   ├── matmul-ops.c
│       │   │   ├── rope-ops.c
│       │   │   ├── set-rows-ops.c
│       │   │   ├── softmax-ops.c
│       │   │   ├── ssm-conv.c
│       │   │   ├── sum-rows-ops.c
│       │   │   ├── unary-ops.c
│       │   │   ├── worker-pool.c
│       │   │   └── worker-pool.h
│       │   ├── htp-drv.cpp
│       │   ├── htp-drv.h
│       │   ├── libdl.h
│       │   ├── libggml-htp.inf
│       │   └── op-desc.h
│       ├── ggml-hip/
│       │   └── CMakeLists.txt
│       ├── ggml-impl.h
│       ├── ggml-metal/
│       │   ├── CMakeLists.txt
│       │   ├── ggml-metal-common.cpp
│       │   ├── ggml-metal-common.h
│       │   ├── ggml-metal-context.h
│       │   ├── ggml-metal-context.m
│       │   ├── ggml-metal-device.cpp
│       │   ├── ggml-metal-device.h
│       │   ├── ggml-metal-device.m
│       │   ├── ggml-metal-impl.h
│       │   ├── ggml-metal-ops.cpp
│       │   ├── ggml-metal-ops.h
│       │   ├── ggml-metal.cpp
│       │   └── ggml-metal.metal
│       ├── ggml-musa/
│       │   ├── CMakeLists.txt
│       │   ├── mudnn.cu
│       │   └── mudnn.cuh
│       ├── ggml-opencl/
│       │   ├── CMakeLists.txt
│       │   ├── ggml-opencl.cpp
│       │   └── kernels/
│       │       ├── add.cl
│       │       ├── add_id.cl
│       │       ├── argsort.cl
│       │       ├── clamp.cl
│       │       ├── concat.cl
│       │       ├── conv2d.cl
│       │       ├── conv2d_f16_f32.cl
│       │       ├── cpy.cl
│       │       ├── cumsum.cl
│       │       ├── cvt.cl
│       │       ├── diag.cl
│       │       ├── diag_mask_inf.cl
│       │       ├── div.cl
│       │       ├── embed_kernel.py
│       │       ├── exp.cl
│       │       ├── expm1.cl
│       │       ├── fill.cl
│       │       ├── flash_attn_f16.cl
│       │       ├── flash_attn_f32.cl
│       │       ├── flash_attn_f32_f16.cl
│       │       ├── gelu.cl
│       │       ├── gemm_moe_mxfp4_f32.cl
│       │       ├── gemm_noshuffle_q4_1_f32.cl
│       │       ├── gemv_moe_mxfp4_f32.cl
│       │       ├── gemv_noshuffle.cl
│       │       ├── gemv_noshuffle_general.cl
│       │       ├── gemv_noshuffle_general_q8_0_f32.cl
│       │       ├── gemv_noshuffle_q4_1_f32.cl
│       │       ├── get_rows.cl
│       │       ├── glu.cl
│       │       ├── group_norm.cl
│       │       ├── im2col_f16.cl
│       │       ├── im2col_f32.cl
│       │       ├── l2_norm.cl
│       │       ├── mean.cl
│       │       ├── mul.cl
│       │       ├── mul_mat_Ab_Bi_8x4.cl
│       │       ├── mul_mat_f16_f32.cl
│       │       ├── mul_mm_f16_f32_kq_kqv.cl
│       │       ├── mul_mm_f16_f32_l4_lm.cl
│       │       ├── mul_mm_f32_f32_l4_lm.cl
│       │       ├── mul_mm_q4_0_f32_l4_lm.cl
│       │       ├── mul_mm_q4_1_f32_l4_lm.cl
│       │       ├── mul_mm_q6_k_f32_l4_lm.cl
│       │       ├── mul_mm_q8_0_f32_8x4.cl
│       │       ├── mul_mm_q8_0_f32_l4_lm.cl
│       │       ├── mul_mv_f16_f16.cl
│       │       ├── mul_mv_f16_f32.cl
│       │       ├── mul_mv_f16_f32_1row.cl
│       │       ├── mul_mv_f16_f32_l4.cl
│       │       ├── mul_mv_f32_f32.cl
│       │       ├── mul_mv_id_mxfp4_f32.cl
│       │       ├── mul_mv_id_mxfp4_f32_flat.cl
│       │       ├── mul_mv_id_q4_0_f32_8x_flat.cl
│       │       ├── mul_mv_id_q8_0_f32.cl
│       │       ├── mul_mv_id_q8_0_f32_flat.cl
│       │       ├── mul_mv_mxfp4_f32.cl
│       │       ├── mul_mv_mxfp4_f32_flat.cl
│       │       ├── mul_mv_q4_0_f32.cl
│       │       ├── mul_mv_q4_0_f32_1d_16x_flat.cl
│       │       ├── mul_mv_q4_0_f32_1d_8x_flat.cl
│       │       ├── mul_mv_q4_0_f32_8x_flat.cl
│       │       ├── mul_mv_q4_0_f32_v.cl
│       │       ├── mul_mv_q4_1_f32.cl
│       │       ├── mul_mv_q4_1_f32_flat.cl
│       │       ├── mul_mv_q4_k_f32.cl
│       │       ├── mul_mv_q6_k_f32.cl
│       │       ├── mul_mv_q6_k_f32_flat.cl
│       │       ├── mul_mv_q8_0_f32.cl
│       │       ├── mul_mv_q8_0_f32_flat.cl
│       │       ├── neg.cl
│       │       ├── norm.cl
│       │       ├── pad.cl
│       │       ├── relu.cl
│       │       ├── repeat.cl
│       │       ├── rms_norm.cl
│       │       ├── rope.cl
│       │       ├── scale.cl
│       │       ├── set_rows.cl
│       │       ├── sigmoid.cl
│       │       ├── silu.cl
│       │       ├── softmax_4_f16.cl
│       │       ├── softmax_4_f32.cl
│       │       ├── softmax_f16.cl
│       │       ├── softmax_f32.cl
│       │       ├── softplus.cl
│       │       ├── solve_tri.cl
│       │       ├── sqr.cl
│       │       ├── sqrt.cl
│       │       ├── ssm_conv.cl
│       │       ├── sub.cl
│       │       ├── sum_rows.cl
│       │       ├── tanh.cl
│       │       ├── transpose.cl
│       │       ├── tri.cl
│       │       ├── tsembd.cl
│       │       └── upscale.cl
│       ├── ggml-openvino/
│       │   ├── .clang-format
│       │   ├── CMakeLists.txt
│       │   ├── ggml-decoder.cpp
│       │   ├── ggml-decoder.h
│       │   ├── ggml-openvino-extra.cpp
│       │   ├── ggml-openvino-extra.h
│       │   ├── ggml-openvino.cpp
│       │   ├── ggml-quants.cpp
│       │   ├── ggml-quants.h
│       │   ├── openvino/
│       │   │   ├── decoder.h
│       │   │   ├── frontend.cpp
│       │   │   ├── frontend.h
│       │   │   ├── input_model.cpp
│       │   │   ├── input_model.h
│       │   │   ├── node_context.h
│       │   │   ├── op/
│       │   │   │   ├── cont.cpp
│       │   │   │   ├── cpy.cpp
│       │   │   │   ├── flash_attn_ext.cpp
│       │   │   │   ├── get_rows.cpp
│       │   │   │   ├── glu_geglu.cpp
│       │   │   │   ├── glu_swiglu.cpp
│       │   │   │   ├── mulmat.cpp
│       │   │   │   ├── permute.cpp
│       │   │   │   ├── reshape.cpp
│       │   │   │   ├── rms_norm.cpp
│       │   │   │   ├── rope.cpp
│       │   │   │   ├── scale.cpp
│       │   │   │   ├── set_rows.cpp
│       │   │   │   ├── softmax.cpp
│       │   │   │   ├── transpose.cpp
│       │   │   │   ├── unary_silu.cpp
│       │   │   │   └── view.cpp
│       │   │   ├── op_table.cpp
│       │   │   ├── op_table.h
│       │   │   ├── pass/
│       │   │   │   ├── eliminate_zp.cpp
│       │   │   │   ├── eliminate_zp.h
│       │   │   │   ├── fuse_to_sdpa.cpp
│       │   │   │   ├── fuse_to_sdpa.h
│       │   │   │   ├── mark_decompression_convert_constant_folding.h
│       │   │   │   ├── squeeze_matmul.cpp
│       │   │   │   └── squeeze_matmul.h
│       │   │   ├── translate_session.cpp
│       │   │   ├── translate_session.h
│       │   │   ├── utils.cpp
│       │   │   └── utils.h
│       │   ├── utils.cpp
│       │   └── utils.h
│       ├── ggml-opt.cpp
│       ├── ggml-quants.c
│       ├── ggml-quants.h
│       ├── ggml-rpc/
│       │   ├── CMakeLists.txt
│       │   └── ggml-rpc.cpp
│       ├── ggml-sycl/
│       │   ├── CMakeLists.txt
│       │   ├── add-id.cpp
│       │   ├── add-id.hpp
│       │   ├── backend.hpp
│       │   ├── binbcast.cpp
│       │   ├── binbcast.hpp
│       │   ├── common.cpp
│       │   ├── common.hpp
│       │   ├── concat.cpp
│       │   ├── concat.hpp
│       │   ├── conv.cpp
│       │   ├── conv.hpp
│       │   ├── convert.cpp
│       │   ├── convert.hpp
│       │   ├── count-equal.cpp
│       │   ├── count-equal.hpp
│       │   ├── cpy.cpp
│       │   ├── cpy.hpp
│       │   ├── dequantize.hpp
│       │   ├── dmmv.cpp
│       │   ├── dmmv.hpp
│       │   ├── dpct/
│       │   │   └── helper.hpp
│       │   ├── element_wise.cpp
│       │   ├── element_wise.hpp
│       │   ├── fattn-common.hpp
│       │   ├── fattn-tile.cpp
│       │   ├── fattn-tile.hpp
│       │   ├── fattn-vec.hpp
│       │   ├── fattn.cpp
│       │   ├── fattn.hpp
│       │   ├── gated_delta_net.cpp
│       │   ├── gated_delta_net.hpp
│       │   ├── gemm.hpp
│       │   ├── getrows.cpp
│       │   ├── getrows.hpp
│       │   ├── ggml-sycl.cpp
│       │   ├── gla.cpp
│       │   ├── gla.hpp
│       │   ├── im2col.cpp
│       │   ├── im2col.hpp
│       │   ├── mmq.cpp
│       │   ├── mmq.hpp
│       │   ├── mmvq.cpp
│       │   ├── mmvq.hpp
│       │   ├── norm.cpp
│       │   ├── norm.hpp
│       │   ├── outprod.cpp
│       │   ├── outprod.hpp
│       │   ├── pad.cpp
│       │   ├── pad.hpp
│       │   ├── pad_reflect_1d.cpp
│       │   ├── pad_reflect_1d.hpp
│       │   ├── presets.hpp
│       │   ├── quantize.hpp
│       │   ├── quants.hpp
│       │   ├── repeat_back.cpp
│       │   ├── repeat_back.hpp
│       │   ├── roll.cpp
│       │   ├── roll.hpp
│       │   ├── rope.cpp
│       │   ├── rope.hpp
│       │   ├── set.cpp
│       │   ├── set.hpp
│       │   ├── set_rows.cpp
│       │   ├── set_rows.hpp
│       │   ├── softmax.cpp
│       │   ├── softmax.hpp
│       │   ├── ssm_conv.cpp
│       │   ├── ssm_conv.hpp
│       │   ├── sycl_hw.cpp
│       │   ├── sycl_hw.hpp
│       │   ├── template-instances/
│       │   │   ├── fattn-tile-instance-dkq112-dv112.cpp
│       │   │   ├── fattn-tile-instance-dkq128-dv128.cpp
│       │   │   ├── fattn-tile-instance-dkq256-dv256.cpp
│       │   │   ├── fattn-tile-instance-dkq40-dv40.cpp
│       │   │   ├── fattn-tile-instance-dkq576-dv512.cpp
│       │   │   ├── fattn-tile-instance-dkq64-dv64.cpp
│       │   │   ├── fattn-tile-instance-dkq72-dv72.cpp
│       │   │   ├── fattn-tile-instance-dkq80-dv80.cpp
│       │   │   ├── fattn-tile-instance-dkq96-dv96.cpp
│       │   │   ├── fattn-vec-instance-f16-f16.cpp
│       │   │   ├── fattn-vec-instance-f16-q4_0.cpp
│       │   │   ├── fattn-vec-instance-f16-q4_1.cpp
│       │   │   ├── fattn-vec-instance-f16-q5_0.cpp
│       │   │   ├── fattn-vec-instance-f16-q5_1.cpp
│       │   │   ├── fattn-vec-instance-f16-q8_0.cpp
│       │   │   ├── fattn-vec-instance-q4_0-f16.cpp
│       │   │   ├── fattn-vec-instance-q4_0-q4_0.cpp
│       │   │   ├── fattn-vec-instance-q4_0-q4_1.cpp
│       │   │   ├── fattn-vec-instance-q4_0-q5_0.cpp
│       │   │   ├── fattn-vec-instance-q4_0-q5_1.cpp
│       │   │   ├── fattn-vec-instance-q4_0-q8_0.cpp
│       │   │   ├── fattn-vec-instance-q4_1-f16.cpp
│       │   │   ├── fattn-vec-instance-q4_1-q4_0.cpp
│       │   │   ├── fattn-vec-instance-q4_1-q4_1.cpp
│       │   │   ├── fattn-vec-instance-q4_1-q5_0.cpp
│       │   │   ├── fattn-vec-instance-q4_1-q5_1.cpp
│       │   │   ├── fattn-vec-instance-q4_1-q8_0.cpp
│       │   │   ├── fattn-vec-instance-q5_0-f16.cpp
│       │   │   ├── fattn-vec-instance-q5_0-q4_0.cpp
│       │   │   ├── fattn-vec-instance-q5_0-q4_1.cpp
│       │   │   ├── fattn-vec-instance-q5_0-q5_0.cpp
│       │   │   ├── fattn-vec-instance-q5_0-q5_1.cpp
│       │   │   ├── fattn-vec-instance-q5_0-q8_0.cpp
│       │   │   ├── fattn-vec-instance-q5_1-f16.cpp
│       │   │   ├── fattn-vec-instance-q5_1-q4_0.cpp
│       │   │   ├── fattn-vec-instance-q5_1-q4_1.cpp
│       │   │   ├── fattn-vec-instance-q5_1-q5_0.cpp
│       │   │   ├── fattn-vec-instance-q5_1-q5_1.cpp
│       │   │   ├── fattn-vec-instance-q5_1-q8_0.cpp
│       │   │   ├── fattn-vec-instance-q8_0-f16.cpp
│       │   │   ├── fattn-vec-instance-q8_0-q4_0.cpp
│       │   │   ├── fattn-vec-instance-q8_0-q4_1.cpp
│       │   │   ├── fattn-vec-instance-q8_0-q5_0.cpp
│       │   │   ├── fattn-vec-instance-q8_0-q5_1.cpp
│       │   │   └── fattn-vec-instance-q8_0-q8_0.cpp
│       │   ├── tsembd.cpp
│       │   ├── tsembd.hpp
│       │   ├── vecdotq.hpp
│       │   ├── wkv.cpp
│       │   └── wkv.hpp
│       ├── ggml-threading.cpp
│       ├── ggml-threading.h
│       ├── ggml-virtgpu/
│       │   ├── CMakeLists.txt
│       │   ├── apir_cs_ggml-rpc-front.cpp
│       │   ├── backend/
│       │   │   ├── CMakeLists.txt
│       │   │   ├── apir_cs_ggml-rpc-back.cpp
│       │   │   ├── backend-convert.h
│       │   │   ├── backend-dispatched-backend.cpp
│       │   │   ├── backend-dispatched-buffer-type.cpp
│       │   │   ├── backend-dispatched-buffer.cpp
│       │   │   ├── backend-dispatched-device.cpp
│       │   │   ├── backend-dispatched.cpp
│       │   │   ├── backend-dispatched.gen.h
│       │   │   ├── backend-dispatched.h
│       │   │   ├── backend-virgl-apir.h
│       │   │   ├── backend.cpp
│       │   │   └── shared/
│       │   │       ├── api_remoting.h
│       │   │       ├── apir_backend.gen.h
│       │   │       ├── apir_backend.h
│       │   │       ├── apir_cs.h
│       │   │       ├── apir_cs_ggml.h
│       │   │       └── apir_cs_rpc.h
│       │   ├── ggml-backend-buffer-type.cpp
│       │   ├── ggml-backend-buffer.cpp
│       │   ├── ggml-backend-device.cpp
│       │   ├── ggml-backend-reg.cpp
│       │   ├── ggml-backend.cpp
│       │   ├── ggml-remoting.h
│       │   ├── ggmlremoting_functions.yaml
│       │   ├── include/
│       │   │   └── apir_hw.h
│       │   ├── regenerate_remoting.py
│       │   ├── virtgpu-apir.h
│       │   ├── virtgpu-forward-backend.cpp
│       │   ├── virtgpu-forward-buffer-type.cpp
│       │   ├── virtgpu-forward-buffer.cpp
│       │   ├── virtgpu-forward-device.cpp
│       │   ├── virtgpu-forward-impl.h
│       │   ├── virtgpu-forward.gen.h
│       │   ├── virtgpu-shm.cpp
│       │   ├── virtgpu-shm.h
│       │   ├── virtgpu-utils.cpp
│       │   ├── virtgpu-utils.h
│       │   ├── virtgpu.cpp
│       │   └── virtgpu.h
│       ├── ggml-vulkan/
│       │   ├── CMakeLists.txt
│       │   ├── cmake/
│       │   │   └── host-toolchain.cmake.in
│       │   ├── ggml-vulkan.cpp
│       │   └── vulkan-shaders/
│       │       ├── CMakeLists.txt
│       │       ├── abs.comp
│       │       ├── acc.comp
│       │       ├── add.comp
│       │       ├── add1.comp
│       │       ├── add_id.comp
│       │       ├── arange.comp
│       │       ├── argmax.comp
│       │       ├── argsort.comp
│       │       ├── argsort_large.comp
│       │       ├── ceil.comp
│       │       ├── clamp.comp
│       │       ├── concat.comp
│       │       ├── contig_copy.comp
│       │       ├── conv2d_dw.comp
│       │       ├── conv2d_mm.comp
│       │       ├── conv_transpose_1d.comp
│       │       ├── copy.comp
│       │       ├── copy_from_quant.comp
│       │       ├── copy_to_quant.comp
│       │       ├── copy_transpose.comp
│       │       ├── cos.comp
│       │       ├── count_equal.comp
│       │       ├── count_experts.comp
│       │       ├── cumsum.comp
│       │       ├── cumsum_multipass1.comp
│       │       ├── cumsum_multipass2.comp
│       │       ├── dequant_f32.comp
│       │       ├── dequant_funcs.glsl
│       │       ├── dequant_funcs_cm2.glsl
│       │       ├── dequant_head.glsl
│       │       ├── dequant_iq1_m.comp
│       │       ├── dequant_iq1_s.comp
│       │       ├── dequant_iq2_s.comp
│       │       ├── dequant_iq2_xs.comp
│       │       ├── dequant_iq2_xxs.comp
│       │       ├── dequant_iq3_s.comp
│       │       ├── dequant_iq3_xxs.comp
│       │       ├── dequant_iq4_nl.comp
│       │       ├── dequant_iq4_xs.comp
│       │       ├── dequant_mxfp4.comp
│       │       ├── dequant_q2_k.comp
│       │       ├── dequant_q3_k.comp
│       │       ├── dequant_q4_0.comp
│       │       ├── dequant_q4_1.comp
│       │       ├── dequant_q4_k.comp
│       │       ├── dequant_q5_0.comp
│       │       ├── dequant_q5_1.comp
│       │       ├── dequant_q5_k.comp
│       │       ├── dequant_q6_k.comp
│       │       ├── dequant_q8_0.comp
│       │       ├── diag.comp
│       │       ├── diag_mask_inf.comp
│       │       ├── div.comp
│       │       ├── elu.comp
│       │       ├── exp.comp
│       │       ├── feature-tests/
│       │       │   ├── bfloat16.comp
│       │       │   ├── coopmat.comp
│       │       │   ├── coopmat2.comp
│       │       │   └── integer_dot.comp
│       │       ├── fill.comp
│       │       ├── flash_attn.comp
│       │       ├── flash_attn_base.glsl
│       │       ├── flash_attn_cm1.comp
│       │       ├── flash_attn_cm2.comp
│       │       ├── flash_attn_mask_opt.comp
│       │       ├── flash_attn_split_k_reduce.comp
│       │       ├── floor.comp
│       │       ├── gated_delta_net.comp
│       │       ├── geglu.comp
│       │       ├── geglu_erf.comp
│       │       ├── geglu_quick.comp
│       │       ├── gelu.comp
│       │       ├── gelu_erf.comp
│       │       ├── gelu_quick.comp
│       │       ├── generic_binary_head.glsl
│       │       ├── generic_head.glsl
│       │       ├── generic_unary_head.glsl
│       │       ├── get_rows.comp
│       │       ├── get_rows_quant.comp
│       │       ├── glu_head.glsl
│       │       ├── glu_main.glsl
│       │       ├── group_norm.comp
│       │       ├── hardsigmoid.comp
│       │       ├── hardswish.comp
│       │       ├── im2col.comp
│       │       ├── im2col_3d.comp
│       │       ├── l2_norm.comp
│       │       ├── leaky_relu.comp
│       │       ├── log.comp
│       │       ├── mul.comp
│       │       ├── mul_mat_split_k_reduce.comp
│       │       ├── mul_mat_vec.comp
│       │       ├── mul_mat_vec_base.glsl
│       │       ├── mul_mat_vec_iface.glsl
│       │       ├── mul_mat_vec_iq1_m.comp
│       │       ├── mul_mat_vec_iq1_s.comp
│       │       ├── mul_mat_vec_iq2_s.comp
│       │       ├── mul_mat_vec_iq2_xs.comp
│       │       ├── mul_mat_vec_iq2_xxs.comp
│       │       ├── mul_mat_vec_iq3_s.comp
│       │       ├── mul_mat_vec_iq3_xxs.comp
│       │       ├── mul_mat_vec_nc.comp
│       │       ├── mul_mat_vec_p021.comp
│       │       ├── mul_mat_vec_q2_k.comp
│       │       ├── mul_mat_vec_q3_k.comp
│       │       ├── mul_mat_vec_q4_k.comp
│       │       ├── mul_mat_vec_q5_k.comp
│       │       ├── mul_mat_vec_q6_k.comp
│       │       ├── mul_mat_vecq.comp
│       │       ├── mul_mat_vecq_funcs.glsl
│       │       ├── mul_mm.comp
│       │       ├── mul_mm_cm2.comp
│       │       ├── mul_mm_funcs.glsl
│       │       ├── mul_mm_id_funcs.glsl
│       │       ├── mul_mmq.comp
│       │       ├── mul_mmq_funcs.glsl
│       │       ├── mul_mmq_shmem_types.glsl
│       │       ├── multi_add.comp
│       │       ├── neg.comp
│       │       ├── norm.comp
│       │       ├── opt_step_adamw.comp
│       │       ├── opt_step_sgd.comp
│       │       ├── pad.comp
│       │       ├── pool2d.comp
│       │       ├── quantize_q8_1.comp
│       │       ├── reglu.comp
│       │       ├── relu.comp
│       │       ├── repeat.comp
│       │       ├── repeat_back.comp
│       │       ├── rms_norm.comp
│       │       ├── rms_norm_back.comp
│       │       ├── rms_norm_partials.comp
│       │       ├── roll.comp
│       │       ├── rope_funcs.glsl
│       │       ├── rope_head.glsl
│       │       ├── rope_multi.comp
│       │       ├── rope_neox.comp
│       │       ├── rope_norm.comp
│       │       ├── rope_params.glsl
│       │       ├── rope_vision.comp
│       │       ├── round.comp
│       │       ├── rte.glsl
│       │       ├── scale.comp
│       │       ├── sgn.comp
│       │       ├── sigmoid.comp
│       │       ├── silu.comp
│       │       ├── silu_back.comp
│       │       ├── sin.comp
│       │       ├── soft_max.comp
│       │       ├── soft_max_back.comp
│       │       ├── soft_max_large1.comp
│       │       ├── soft_max_large2.comp
│       │       ├── soft_max_large3.comp
│       │       ├── soft_max_large_common.glsl
│       │       ├── softplus.comp
│       │       ├── solve_tri.comp
│       │       ├── sqrt.comp
│       │       ├── square.comp
│       │       ├── ssm_conv.comp
│       │       ├── ssm_scan.comp
│       │       ├── step.comp
│       │       ├── sub.comp
│       │       ├── sum_rows.comp
│       │       ├── sum_rows.glsl
│       │       ├── swiglu.comp
│       │       ├── swiglu_oai.comp
│       │       ├── tanh.comp
│       │       ├── timestep_embedding.comp
│       │       ├── topk_argsort.comp
│       │       ├── topk_moe.comp
│       │       ├── topk_nary_search.comp
│       │       ├── tri.comp
│       │       ├── trunc.comp
│       │       ├── types.glsl
│       │       ├── upscale.comp
│       │       ├── utils.glsl
│       │       ├── vulkan-shaders-gen.cpp
│       │       ├── wkv6.comp
│       │       ├── wkv7.comp
│       │       └── xielu.comp
│       ├── ggml-webgpu/
│       │   ├── CMakeLists.txt
│       │   ├── ggml-webgpu-shader-lib.hpp
│       │   ├── ggml-webgpu.cpp
│       │   ├── pre_wgsl.hpp
│       │   └── wgsl-shaders/
│       │       ├── argmax.wgsl
│       │       ├── argsort.wgsl
│       │       ├── argsort_merge.wgsl
│       │       ├── binary.wgsl
│       │       ├── common_decls.tmpl
│       │       ├── concat.wgsl
│       │       ├── cpy.tmpl.wgsl
│       │       ├── cumsum.wgsl
│       │       ├── embed_wgsl.py
│       │       ├── flash_attn.wgsl
│       │       ├── get_rows.wgsl
│       │       ├── glu.tmpl.wgsl
│       │       ├── memset.wgsl
│       │       ├── mul_mat.wgsl
│       │       ├── mul_mat_decls.tmpl
│       │       ├── mul_mat_reg_tile.wgsl
│       │       ├── mul_mat_subgroup_matrix.wgsl
│       │       ├── mul_mat_vec.wgsl
│       │       ├── pad.wgsl
│       │       ├── repeat.wgsl
│       │       ├── rms_norm.wgsl
│       │       ├── rope.tmpl.wgsl
│       │       ├── scale.wgsl
│       │       ├── set_rows.wgsl
│       │       ├── soft_max.tmpl.wgsl
│       │       ├── sum_rows.wgsl
│       │       └── unary.wgsl
│       ├── ggml-zdnn/
│       │   ├── .gitignore
│       │   ├── CMakeLists.txt
│       │   ├── common.hpp
│       │   ├── ggml-zdnn.cpp
│       │   ├── mmf.cpp
│       │   ├── mmf.hpp
│       │   ├── utils.cpp
│       │   └── utils.hpp
│       ├── ggml-zendnn/
│       │   ├── CMakeLists.txt
│       │   └── ggml-zendnn.cpp
│       ├── ggml.c
│       ├── ggml.cpp
│       └── gguf.cpp
├── grammars/
│   ├── assistant.gbnf
│   ├── chess.gbnf
│   └── colors.gbnf
├── include/
│   └── whisper.h
├── models/
│   ├── .gitignore
│   ├── README.md
│   ├── convert-h5-to-coreml.py
│   ├── convert-h5-to-ggml.py
│   ├── convert-pt-to-ggml.py
│   ├── convert-silero-vad-to-ggml.py
│   ├── convert-whisper-to-coreml.py
│   ├── convert-whisper-to-openvino.py
│   ├── download-coreml-model.sh
│   ├── download-ggml-model.cmd
│   ├── download-ggml-model.sh
│   ├── download-vad-model.cmd
│   ├── download-vad-model.sh
│   ├── generate-coreml-interface.sh
│   ├── generate-coreml-model.sh
│   ├── ggml_to_pt.py
│   ├── requirements-coreml.txt
│   └── requirements-openvino.txt
├── scripts/
│   ├── apple/
│   │   ├── validate-apps.sh
│   │   ├── validate-ios.sh
│   │   ├── validate-macos.sh
│   │   ├── validate-tvos.sh
│   │   └── validate-visionos.sh
│   ├── bench-all-gg.txt
│   ├── bench-all.sh
│   ├── bench-wts.sh
│   ├── bench.py
│   ├── build-info.sh
│   ├── convert-all.sh
│   ├── deploy-wasm.sh
│   ├── gen-authors.sh
│   ├── get-flags.mk
│   ├── quantize-all.sh
│   ├── sha-all.sh
│   ├── sync-ggml-am.sh
│   ├── sync-ggml.last
│   ├── sync-ggml.sh
│   └── sync-llama.sh
├── src/
│   ├── CMakeLists.txt
│   ├── coreml/
│   │   ├── whisper-compat.h
│   │   ├── whisper-compat.m
│   │   ├── whisper-decoder-impl.h
│   │   ├── whisper-decoder-impl.m
│   │   ├── whisper-encoder-impl.h
│   │   ├── whisper-encoder-impl.m
│   │   ├── whisper-encoder.h
│   │   └── whisper-encoder.mm
│   ├── openvino/
│   │   ├── whisper-openvino-encoder.cpp
│   │   └── whisper-openvino-encoder.h
│   ├── whisper-arch.h
│   └── whisper.cpp
└── tests/
    ├── .gitignore
    ├── CMakeLists.txt
    ├── earnings21/
    │   ├── .gitignore
    │   ├── Makefile
    │   ├── README.md
    │   ├── eval.mk
    │   ├── eval.py
    │   └── normalizers/
    │       ├── LICENSE
    │       ├── __init__.py
    │       ├── basic.py
    │       ├── english.json
    │       └── english.py
    ├── en-0-ref.txt
    ├── en-1-ref.txt
    ├── en-2-ref.txt
    ├── es-0-ref.txt
    ├── librispeech/
    │   ├── .gitignore
    │   ├── Makefile
    │   ├── README.md
    │   ├── eval.mk
    │   ├── eval.py
    │   └── normalizers/
    │       ├── LICENSE
    │       ├── __init__.py
    │       ├── basic.py
    │       ├── english.json
    │       └── english.py
    ├── run-tests.sh
    ├── test-c.c
    ├── test-vad-full.cpp
    ├── test-vad.cpp
    └── test-whisper.js

================================================
FILE CONTENTS
================================================

================================================
FILE: .devops/cublas.Dockerfile
================================================
ARG UBUNTU_VERSION=22.04

# This needs to generally match the container host's environment.
ARG CUDA_VERSION=11.7.1

# Target the CUDA build image
ARG BASE_CUDA_DEV_CONTAINER=nvidia/cuda:${CUDA_VERSION}-devel-ubuntu${UBUNTU_VERSION}

FROM ${BASE_CUDA_DEV_CONTAINER} as build

# Unless otherwise specified, we make a fat build.
ARG CUDA_DOCKER_ARCH=all

RUN apt-get update && \
    apt-get install -y build-essential git cmake libsdl2-dev wget git

WORKDIR /app

COPY . .

# Set nvcc architecture
ENV CUDA_DOCKER_ARCH=${CUDA_DOCKER_ARCH}
# Enable cuBLAS
ENV GGML_CUDA=1

RUN make base.en

ENTRYPOINT ["/app/main"]


================================================
FILE: .devops/main-cuda.Dockerfile
================================================
ARG UBUNTU_VERSION=22.04
# This needs to generally match the container host's environment.
ARG CUDA_VERSION=13.0.0
# Target the CUDA build image
ARG BASE_CUDA_DEV_CONTAINER=nvidia/cuda:${CUDA_VERSION}-devel-ubuntu${UBUNTU_VERSION}
# Target the CUDA runtime image
ARG BASE_CUDA_RUN_CONTAINER=nvidia/cuda:${CUDA_VERSION}-runtime-ubuntu${UBUNTU_VERSION}

FROM ${BASE_CUDA_DEV_CONTAINER} AS build
WORKDIR /app

# Unless otherwise specified, we make a fat build.
ARG CUDA_DOCKER_ARCH=all
# Set nvcc architecture
ENV CUDA_DOCKER_ARCH=${CUDA_DOCKER_ARCH}

RUN apt-get update && \
    apt-get install -y build-essential libsdl2-dev wget cmake git \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/* /var/cache/apt/archives/*

# Ref: https://stackoverflow.com/a/53464012
ENV CUDA_MAIN_VERSION=13.0
ENV LD_LIBRARY_PATH /usr/local/cuda-${CUDA_MAIN_VERSION}/compat:$LD_LIBRARY_PATH

COPY .. .
# Enable cuBLAS
RUN make base.en CMAKE_ARGS="-DGGML_CUDA=1 -DCMAKE_CUDA_ARCHITECTURES='75;80;86;90'"

RUN find /app/build -name "*.o" -delete && \
    find /app/build -name "*.a" -delete && \
    rm -rf /app/build/CMakeFiles && \
    rm -rf /app/build/cmake_install.cmake && \
    rm -rf /app/build/_deps

FROM ${BASE_CUDA_RUN_CONTAINER} AS runtime
ENV CUDA_MAIN_VERSION=13.0
ENV LD_LIBRARY_PATH /usr/local/cuda-${CUDA_MAIN_VERSION}/compat:$LD_LIBRARY_PATH
WORKDIR /app

RUN apt-get update && \
  apt-get install -y curl ffmpeg wget cmake git \
  && apt-get clean \
  && rm -rf /var/lib/apt/lists/* /var/cache/apt/archives/*

COPY --from=build /app /app
RUN du -sh /app/*
RUN find /app -type f -size +100M
ENV PATH=/app/build/bin:$PATH
ENTRYPOINT [ "bash", "-c" ]


================================================
FILE: .devops/main-intel.Dockerfile
================================================
ARG ONEAPI_VERSION=2025.1.1-0-devel-ubuntu24.04

FROM intel/oneapi-basekit:$ONEAPI_VERSION AS build
WORKDIR /app

RUN apt-get update && \
    apt-get install -y build-essential libsdl2-dev wget cmake git \
    && rm -rf /var/lib/apt/lists/* /var/cache/apt/archives/*

COPY .. .
# Enable SYCL
ARG GGML_SYCL_F16=OFF
RUN if [ "${GGML_SYCL_F16}" = "ON" ]; then \
        echo "GGML_SYCL_F16 is set" \
        && export OPT_SYCL_F16="-DGGML_SYCL_F16=ON"; \
    fi && \
    make base.en CMAKE_ARGS="-DGGML_SYCL=1 -DCMAKE_C_COMPILER=icx -DCMAKE_CXX_COMPILER=icpx ${OPT_SYCL_F16}"

FROM intel/oneapi-basekit:$ONEAPI_VERSION AS runtime
WORKDIR /app

RUN apt-get update && \
  apt-get install -y curl ffmpeg libsdl2-dev wget cmake git \
  && rm -rf /var/lib/apt/lists/* /var/cache/apt/archives/*

COPY --from=build /app /app
ENV PATH=/app/build/bin:$PATH
ENTRYPOINT [ "bash", "-c" ]


================================================
FILE: .devops/main-musa.Dockerfile
================================================
ARG UBUNTU_VERSION=22.04
# This needs to generally match the container host's environment.
ARG MUSA_VERSION=rc4.2.0
# Target the MUSA build image
ARG BASE_MUSA_DEV_CONTAINER=mthreads/musa:${MUSA_VERSION}-devel-ubuntu${UBUNTU_VERSION}-amd64
# Target the MUSA runtime image
ARG BASE_MUSA_RUN_CONTAINER=mthreads/musa:${MUSA_VERSION}-runtime-ubuntu${UBUNTU_VERSION}-amd64

FROM ${BASE_MUSA_DEV_CONTAINER} AS build
WORKDIR /app

RUN apt-get update && \
    apt-get install -y build-essential libsdl2-dev wget cmake git && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/* /var/cache/apt/archives/* /tmp/* /var/tmp/*

COPY .. .
# Enable muBLAS
RUN make base.en CMAKE_ARGS="-DGGML_MUSA=1"

RUN find /app/build -name "*.o" -delete && \
    find /app/build -name "*.a" -delete && \
    rm -rf /app/build/CMakeFiles && \
    rm -rf /app/build/cmake_install.cmake && \
    rm -rf /app/build/_deps

FROM ${BASE_MUSA_RUN_CONTAINER} AS runtime
WORKDIR /app

RUN apt-get update && \
    apt-get install -y curl ffmpeg wget cmake git && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/* /var/cache/apt/archives/* /tmp/* /var/tmp/*

COPY --from=build /app/build/bin /app/build/bin
COPY --from=build /app/samples /app/samples
COPY --from=build /app/models /app/models

ENV PATH=/app/build/bin:$PATH
ENTRYPOINT [ "bash", "-c" ]


================================================
FILE: .devops/main-vulkan.Dockerfile
================================================
FROM ubuntu:24.04 AS build
WORKDIR /app

RUN apt-get update && \
  apt-get install -y build-essential wget cmake git libvulkan-dev glslc \
  && rm -rf /var/lib/apt/lists/* /var/cache/apt/archives/*

COPY .. .
RUN make base.en CMAKE_ARGS="-DGGML_VULKAN=1"

FROM ubuntu:24.04 AS runtime
WORKDIR /app

RUN apt-get update && \
  apt-get install -y curl ffmpeg libsdl2-dev wget cmake git libvulkan1 mesa-vulkan-drivers \
  && rm -rf /var/lib/apt/lists/* /var/cache/apt/archives/*

COPY --from=build /app /app
ENV PATH=/app/build/bin:$PATH
ENTRYPOINT [ "bash", "-c" ]


================================================
FILE: .devops/main.Dockerfile
================================================
FROM ubuntu:22.04 AS build
WORKDIR /app

RUN apt-get update && \
  apt-get install -y build-essential wget cmake git \
  && rm -rf /var/lib/apt/lists/* /var/cache/apt/archives/*

COPY .. .
RUN make base.en

FROM ubuntu:22.04 AS runtime
WORKDIR /app

RUN apt-get update && \
  apt-get install -y curl ffmpeg libsdl2-dev wget cmake git \
  && rm -rf /var/lib/apt/lists/* /var/cache/apt/archives/*

COPY --from=build /app /app
ENV PATH=/app/build/bin:$PATH
ENTRYPOINT [ "bash", "-c" ]


================================================
FILE: .dockerignore
================================================
build*/
.github/
.devops/

================================================
FILE: .github/workflows/bindings-go.yml
================================================
name: Bindings Tests (Go)
on:
  push:
    paths:
      - bindings/go/**
      - whisper.h
  pull_request:
    paths:
      - bindings/go/**
      - whisper.h

jobs:
  ubuntu-22:
    runs-on: ubuntu-22.04
    steps:
      - uses: actions/setup-go@v6
        with:
          go-version: '^1.23'
      - uses: actions/checkout@v6
      - run: |
          cd bindings/go
          make test


================================================
FILE: .github/workflows/bindings-ruby.yml
================================================
name: Bindings Tests (Ruby)

on:
  push:
    branches:
      - master
  pull_request:
    types: [opened, synchronize, reopened]

jobs:
  ubuntu-22:
    runs-on: ubuntu-22.04
    defaults:
      run:
        working-directory: bindings/ruby
    steps:
      - uses: ruby/setup-ruby@v1
        with:
          ruby-version: '3.2'
      - uses: actions/checkout@v6
      - run: rake test


================================================
FILE: .github/workflows/build.yml
================================================
name: CI

on:
  push:
    branches:
      - master
    tags:
      - 'v*'
    paths: ['.github/workflows/build.yml',
            '**/CMakeLists.txt',
            '**/Makefile',
            '**/*.mk',
            '**/*.cmake',
            '**/*.in',
            '**/*.h',
            '**/*.hpp',
            '**/*.c',
            '**/*.cpp',
            '**/*.cu',
            '**/*.cuh',
            '**/*.cl',
            '**/*.swift',
            '**/*.m',
            '**/*.mm',
            '**/*.metal',
            '**/*.comp',
            '**/*.java']

  pull_request:
    types: [opened, synchronize, reopened]
  workflow_dispatch:
    inputs:
      create_release:
        description: 'Create new release'
        required: true
        type: boolean
      pre_release_tag:
        description: 'Pre-release tag name'
        required: false
        type: string
      run_type:
        description: 'Workflow type to run'
        required: true
        type: choice
        options:
          - full-ci
          - release-only

concurrency:
  group: ${{ github.workflow }}-${{ github.head_ref && github.ref || github.run_id }}
  cancel-in-progress: true

permissions:
  contents: write  # for creating release

env:
  BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
  ubuntu_image: "ubuntu:22.04"
  VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"

jobs:
  determine-tag:
    runs-on: ubuntu-latest
    outputs:
      tag_name: ${{ steps.tag.outputs.name }}
      should_release: ${{ steps.tag.outputs.should_release }}

    steps:
      - name: Checkout with full history
        uses: actions/checkout@v6
        with:
          fetch-depth: 0

      - name: Determine tag name
        id: tag
        shell: bash
        run: |
          BUILD_NUMBER=$(git rev-list --count HEAD)
          SHORT_HASH=$(git rev-parse --short=7 HEAD)
          CUSTOM_TAG="${{ github.event.inputs.pre_release_tag }}"
          SHOULD_RELEASE="false"

          echo "Raw values:"
          echo "BUILD_NUMBER: $BUILD_NUMBER"
          echo "SHORT_HASH: $SHORT_HASH"
          echo "BRANCH_NAME: ${{ env.BRANCH_NAME }}"
          echo "CUSTOM_TAG: $CUSTOM_TAG"

          if [[ "${{ github.ref_type }}" == "tag" ]]; then
            echo "Using pushed tag name"
            TAG_NAME="${{ github.ref_name }}"
            SHOULD_RELEASE="true"
          elif [[ -n "$CUSTOM_TAG" ]]; then
            echo "Using custom tag"
            TAG_NAME="${CUSTOM_TAG}"
            SHOULD_RELEASE="true"
          elif [[ "${{ github.event.inputs.create_release }}" == "true" ]]; then
            echo "Manual release requested"
            SHOULD_RELEASE="true"
            TAG_NAME="b${BUILD_NUMBER}"
          elif [[ "${{ env.BRANCH_NAME }}" == "master" ]]; then
            echo "Using master branch format"
            TAG_NAME="b${BUILD_NUMBER}"
            SHOULD_RELEASE="false"
          else
            echo "Using non-master branch format"
            SAFE_NAME=$(echo "${{ env.BRANCH_NAME }}" | tr '/' '-')
            TAG_NAME="${SAFE_NAME}-b${BUILD_NUMBER}-${SHORT_HASH}"
            SHOULD_RELEASE="false"
          fi

          echo "Final tag name: $TAG_NAME"
          echo "Should release: $SHOULD_RELEASE"
          echo "name=$TAG_NAME" >> $GITHUB_OUTPUT
          echo "should_release=$SHOULD_RELEASE" >> $GITHUB_OUTPUT


  ubuntu-22:
    if: ${{ github.event_name == 'push' || github.event_name == 'pull_request' ||
            github.event.inputs.run_type == 'full-ci' }}
    runs-on: ubuntu-22.04

    strategy:
      fail-fast: false
      matrix:
        arch: [linux/amd64, linux/ppc64le]

    steps:
      - name: Clone
        uses: actions/checkout@v6

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

      - name: Build ${{ matrix.arch }}
        run: |
          docker run --platform ${{ matrix.arch }} --rm \
            -v ${{ github.workspace }}:/workspace \
            -w /workspace ${{ env.ubuntu_image }} /bin/sh -c '
            set -e
            export DEBIAN_FRONTEND=noninteractive
            sed -i "s|archive.ubuntu.com|mirrors.kernel.org|g" /etc/apt/sources.list
            sed -i "s|security.ubuntu.com|mirrors.kernel.org|g" /etc/apt/sources.list

            apt update
            apt install -y build-essential libsdl2-dev cmake git
            cmake -B build
            cmake --build build --config Release -j $(nproc)'

  ubuntu-22-arm64:
    if: ${{ github.event_name == 'push' || github.event_name == 'pull_request' ||
            github.event.inputs.run_type == 'full-ci' }}
    runs-on: ubuntu-22.04

    strategy:
      fail-fast: false
      matrix:
        arch: [linux/arm64]

    steps:
      - name: Clone
        uses: actions/checkout@v6

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

      - name: Build ${{ matrix.arch }}
        run: |
          docker run --platform ${{ matrix.arch }} --rm \
            -v ${{ github.workspace }}:/workspace \
            -w /workspace ${{ env.ubuntu_image }} /bin/sh -c '
            set -e
            export DEBIAN_FRONTEND=noninteractive
            sed -i "s|archive.ubuntu.com|mirrors.kernel.org|g" /etc/apt/sources.list
            sed -i "s|security.ubuntu.com|mirrors.kernel.org|g" /etc/apt/sources.list

            apt update
            apt install -y build-essential libsdl2-dev cmake git
            cmake -B build -DGGML_NATIVE=OFF -DGGML_CPU_ARM_ARCH=armv8-a
            cmake --build build --config Release -j $(nproc)'

  ubuntu-22-arm-v7:
    if: ${{ github.event_name == 'push' || github.event_name == 'pull_request' ||
            github.event.inputs.run_type == 'full-ci' }}
    runs-on: ubuntu-22.04

    strategy:
      fail-fast: false
      matrix:
        arch: [linux/arm/v7]

    steps:
      - name: Clone
        uses: actions/checkout@v6

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

      - name: Build ${{ matrix.arch }}
        run: |
          docker run --platform ${{ matrix.arch }} --rm \
            -v ${{ github.workspace }}:/workspace \
            -w /workspace ${{ env.ubuntu_image }} /bin/sh -c '
            set -e
            export DEBIAN_FRONTEND=noninteractive
            sed -i "s|archive.ubuntu.com|mirrors.kernel.org|g" /etc/apt/sources.list
            sed -i "s|security.ubuntu.com|mirrors.kernel.org|g" /etc/apt/sources.list

            apt update
            apt install -y build-essential libsdl2-dev cmake git
            cmake -B build -DGGML_NATIVE=OFF -DGGML_CPU_ARM_ARCH=armv7-a+fp
            cmake --build build --config Release -j $(nproc)'

  macOS-latest:
    if: ${{ github.event_name == 'push' || github.event_name == 'pull_request' ||
            github.event.inputs.run_type == 'full-ci' }}
    runs-on: macOS-latest

    strategy:
      matrix:
        destination: ['generic/platform=macOS', 'generic/platform=iOS', 'generic/platform=tvOS']

    steps:
      - name: Clone
        id: checkout
        uses: actions/checkout@v6

      - name: ccache
        uses: hendrikmuhs/ccache-action@v1.2.16
        with:
          key: macOS-latest-swift
          evict-old-files: 1d

      - name: Dependencies
        run: |
          brew update
          cmake --version
          brew install sdl2

      - name: Build
        run: |
          sysctl -a
          cmake -B build -G Xcode \
            -DGGML_METAL_USE_BF16=ON \
            -DGGML_METAL_EMBED_LIBRARY=ON \
            -DWHISPER_BUILD_EXAMPLES=OFF \
            -DWHISPER_BUILD_TESTS=OFF \
            -DWHISPER_BUILD_SERVER=OFF \
            -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64"
          cmake --build build --config Release -j $(sysctl -n hw.logicalcpu)


#  freeBSD-latest:
#    runs-on: macos-13
#
#    steps:
#      - name: Clone
#        uses: actions/checkout@v6
#
#      - name: Build
#        uses: cross-platform-actions/action@v0.27.0
#        with:
#          operating_system: freebsd
#          version: '14.2'
#          run: |
#            sudo pkg update
#            sudo pkg install -y gmake sdl2 cmake git
#            cmake -B build
#            cmake --build build --config Release

  ubuntu-22-gcc:
    if: ${{ github.event_name == 'push' || github.event_name == 'pull_request' ||
            github.event.inputs.run_type == 'full-ci' }}
    runs-on: ubuntu-22.04

    strategy:
      fail-fast: false
      matrix:
        build: [Debug, Release]
        arch: [linux/amd64, linux/ppc64le]

    steps:
      - name: Clone
        uses: actions/checkout@v6

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

      - name: Build ${{ matrix.arch }}
        run: |
          docker run --platform ${{ matrix.arch }} --rm \
            -v ${{ github.workspace }}:/workspace \
            -w /workspace ${{ env.ubuntu_image }} /bin/sh -c '
            set -e
            export DEBIAN_FRONTEND=noninteractive
            sed -i "s|archive.ubuntu.com|mirrors.kernel.org|g" /etc/apt/sources.list
            sed -i "s|security.ubuntu.com|mirrors.kernel.org|g" /etc/apt/sources.list

            apt update
            apt install -y build-essential cmake libsdl2-dev git
            cmake . -DWHISPER_SDL2=ON -DCMAKE_BUILD_TYPE=${{ matrix.build }}
            make
            ctest -L gh --output-on-failure'

  ubuntu-22-gcc-arm64:
    if: ${{ github.event_name == 'push' || github.event_name == 'pull_request' ||
            github.event.inputs.run_type == 'full-ci' }}
    runs-on: ubuntu-22.04

    strategy:
      fail-fast: false
      matrix:
        build: [Debug, Release]
        arch: [linux/arm64]

    steps:
      - name: Clone
        uses: actions/checkout@v6

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

      - name: Build ${{ matrix.arch }}
        run: |
          docker run --platform ${{ matrix.arch }} --rm \
            -v ${{ github.workspace }}:/workspace \
            -w /workspace ${{ env.ubuntu_image }} /bin/sh -c '
            set -e
            export DEBIAN_FRONTEND=noninteractive
            sed -i "s|archive.ubuntu.com|mirrors.kernel.org|g" /etc/apt/sources.list
            sed -i "s|security.ubuntu.com|mirrors.kernel.org|g" /etc/apt/sources.list

            apt update
            apt install -y build-essential cmake libsdl2-dev git
            cmake . -DWHISPER_SDL2=ON -DCMAKE_BUILD_TYPE=${{ matrix.build }} -DGGML_NATIVE=OFF -DGGML_CPU_ARM_ARCH=armv8-a
            make
            ctest -L gh --output-on-failure'

  ubuntu-22-gcc-arm-v7:
    if: ${{ github.event_name == 'push' || github.event_name == 'pull_request' ||
            github.event.inputs.run_type == 'full-ci' }}
    runs-on: ubuntu-22.04

    strategy:
      fail-fast: false
      matrix:
        build: [Debug, Release]
        arch: [linux/arm/v7]

    steps:
      - name: Clone
        uses: actions/checkout@v6

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

      - name: Build ${{ matrix.arch }}
        run: |
          docker run --platform ${{ matrix.arch }} --rm \
            -v ${{ github.workspace }}:/workspace \
            -w /workspace ${{ env.ubuntu_image }} /bin/sh -c '
            set -e
            export DEBIAN_FRONTEND=noninteractive
            sed -i "s|archive.ubuntu.com|mirrors.kernel.org|g" /etc/apt/sources.list
            sed -i "s|security.ubuntu.com|mirrors.kernel.org|g" /etc/apt/sources.list

            apt update
            apt install -y build-essential cmake libsdl2-dev git
            cmake . -DWHISPER_SDL2=ON -DCMAKE_BUILD_TYPE=${{ matrix.build }} -DGGML_NATIVE=OFF -DGGML_CPU_ARM_ARCH=armv7-a+fp
            make
            ctest -L gh --output-on-failure'

  ubuntu-22-clang:
    if: ${{ github.event_name == 'push' || github.event_name == 'pull_request' ||
            github.event.inputs.run_type == 'full-ci' }}
    runs-on: ubuntu-22.04

    strategy:
      fail-fast: false
      matrix:
        build: [Debug, Release]
        #arch: [linux/amd64, linux/arm64, linux/arm/v7, linux/ppc64le]
        # TODO: arm/v7 disabled due to clang bug
        #       https://github.com/ggerganov/whisper.cpp/actions/runs/9657764109/job/26637633042?pr=2256#step:4:1990
        arch: [linux/amd64, linux/arm64, linux/ppc64le]

    steps:
      - name: Clone
        uses: actions/checkout@v6

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

      - name: Build ${{ matrix.arch }}
        run: |
          docker run --platform ${{ matrix.arch }} --rm \
            -v ${{ github.workspace }}:/workspace \
            -w /workspace ${{ env.ubuntu_image }} /bin/sh -c '
            set -e
            export DEBIAN_FRONTEND=noninteractive
            sed -i "s|archive.ubuntu.com|mirrors.kernel.org|g" /etc/apt/sources.list
            sed -i "s|security.ubuntu.com|mirrors.kernel.org|g" /etc/apt/sources.list

            apt update
            apt install -y clang build-essential cmake libsdl2-dev git
            cmake . -DWHISPER_SDL2=ON -DCMAKE_BUILD_TYPE=${{ matrix.build }} -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang
            make
            ctest -L gh --output-on-failure'

  ubuntu-22-gcc-sanitized:
    if: ${{ github.event_name == 'push' || github.event_name == 'pull_request' ||
            github.event.inputs.run_type == 'full-ci' }}
    runs-on: ubuntu-22.04

    strategy:
      fail-fast: false
      matrix:
        sanitizer: [ADDRESS, THREAD, UNDEFINED]
        arch: [linux/amd64]

    steps:
      - name: Clone
        uses: actions/checkout@v6

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

      - name: Build ${{ matrix.arch }}
        run: |
          docker run --platform ${{ matrix.arch }} --rm \
            -v ${{ github.workspace }}:/workspace \
            -w /workspace ${{ env.ubuntu_image }} /bin/sh -c '
            set -e
            export DEBIAN_FRONTEND=noninteractive
            sed -i "s|archive.ubuntu.com|mirrors.kernel.org|g" /etc/apt/sources.list
            sed -i "s|security.ubuntu.com|mirrors.kernel.org|g" /etc/apt/sources.list

            apt update
            apt install -y build-essential cmake git
            cmake . -DCMAKE_BUILD_TYPE=Debug \
              -DWHISPER_SANITIZE_${{ matrix.sanitizer }}=ON \
              -DGGML_OPENMP=OFF
            make
            ctest -L gh --output-on-failure'

  ubuntu-22-cmake-sycl:
    if: ${{ github.event_name == 'push' || github.event_name == 'pull_request' ||
            github.event.inputs.run_type == 'full-ci' }}
    runs-on: ubuntu-22.04

    strategy:
      fail-fast: false
      matrix:
        dwhisper_sycl: [ON]
        dcmake_c_compiler: [icx]
        dcmake_cxx_compiler: [icpx]
        arch: [linux/amd64, linux/arm64, linux/arm/v7, linux/ppc64le]

    continue-on-error: true

    steps:
      - name: Clone
        uses: actions/checkout@v6

      - name: add oneAPI to apt
        shell: bash
        run: |
          cd /tmp
          wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
          sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
          rm GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
          sudo add-apt-repository "deb https://apt.repos.intel.com/oneapi all main"

      - name: install oneAPI dpcpp compiler
        shell: bash
        run: |
          sudo apt update
          sudo apt install intel-oneapi-compiler-dpcpp-cpp git

      - name: install oneAPI MKL library
        shell: bash
        run: |
          sudo apt install intel-oneapi-mkl-devel git

      - name: Clone
        id: checkout
        uses: actions/checkout@v6

      - name: Build
        id: cmake_build
        run: |
          source /opt/intel/oneapi/setvars.sh
          mkdir build
          cd build
          cmake -DGGML_SYCL=ON -DCMAKE_C_COMPILER=icx -DCMAKE_CXX_COMPILER=icpx ..
          cmake --build . --config Release -j $(nproc)

  ubuntu-22-cmake-sycl-fp16:
    if: ${{ github.event_name == 'push' || github.event_name == 'pull_request' ||
            github.event.inputs.run_type == 'full-ci' }}
    runs-on: ubuntu-22.04

    strategy:
      fail-fast: false
      matrix:
        dwhisper_sycl: [ON]
        dcmake_c_compiler: [icx]
        dcmake_cxx_compiler: [icpx]
        arch: [linux/amd64, linux/arm64, linux/arm/v7, linux/ppc64le]

    continue-on-error: true

    steps:
      - name: Clone
        uses: actions/checkout@v6

      - name: add oneAPI to apt
        shell: bash
        run: |
          cd /tmp
          wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
          sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
          rm GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
          sudo add-apt-repository "deb https://apt.repos.intel.com/oneapi all main"

      - name: install oneAPI dpcpp compiler
        shell: bash
        run: |
          sudo apt update
          sudo apt install intel-oneapi-compiler-dpcpp-cpp git

      - name: install oneAPI MKL library
        shell: bash
        run: |
          sudo apt install intel-oneapi-mkl-devel

      - name: Clone
        id: checkout
        uses: actions/checkout@v6

      - name: Build
        id: cmake_build
        run: |
          source /opt/intel/oneapi/setvars.sh
          mkdir build
          cd build
          cmake -DGGML_SYCL_F16=ON -DCMAKE_C_COMPILER=icx -DCMAKE_CXX_COMPILER=icpx ..
          cmake --build . --config Release -j $(nproc)

  windows-msys2:
    if: ${{ github.event_name == 'push' || github.event_name == 'pull_request' ||
            github.event.inputs.run_type == 'full-ci' }}
    runs-on: windows-latest

    strategy:
      fail-fast: false
      matrix:
        include:
          - { sys: UCRT64,  env: ucrt-x86_64,  build: Release }
          - { sys: CLANG64, env: clang-x86_64, build: Release }

    steps:
      - name: Clone
        uses: actions/checkout@v6

      - name: Setup ${{ matrix.sys }}
        uses: msys2/setup-msys2@v2
        with:
          update: true
          msystem: ${{matrix.sys}}
          install: >-
            base-devel
            git
            mingw-w64-${{matrix.env}}-toolchain
            mingw-w64-${{matrix.env}}-cmake
            mingw-w64-${{matrix.env}}-SDL2
            mingw-w64-${{matrix.env}}-openblas

      - name: Build using CMake
        shell: msys2 {0}
        run: |
            cmake -B build -DWHISPER_SDL2=ON
            cmake --build build --config ${{ matrix.build }} -j $(nproc)

      - name: Clean after building using CMake
        shell: msys2 {0}
        run: |
            rm -rf build

      - name: Build using CMake w/ OpenBLAS
        shell: msys2 {0}
        run: |
            cmake -B build -DGGML_BLAS=ON -DGGML_BLAS_VENDOR=OpenBLAS
            cmake --build build --config ${{ matrix.build }} -j $(nproc)

  windows:
    if: ${{ github.event_name == 'push' || github.event_name == 'pull_request' ||
            github.event.inputs.run_type == 'full-ci' }}
    runs-on: windows-latest
    needs: determine-tag

    strategy:
      matrix:
        build: [Release]
        arch: [Win32, x64]
        sdl2: [ON]
        include:
          - arch: Win32
            s2arc: x86
            jnaPath: win32-x86
          - arch: x64
            s2arc: x64
            jnaPath: win32-x86-64
          - sdl2: ON
            s2ver: 2.28.5

    steps:
      - name: Clone
        uses: actions/checkout@v6

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

      - name: Fetch SDL2 and set SDL2_DIR
        if: matrix.sdl2 == 'ON'
        run: |
          C:/msys64/usr/bin/wget.exe -qO sdl2.zip https://github.com/libsdl-org/SDL/releases/download/release-${{ matrix.s2ver }}/SDL2-devel-${{ matrix.s2ver }}-VC.zip
          7z x sdl2.zip
          echo "SDL2_DIR=$env:GITHUB_WORKSPACE/SDL2-${{ matrix.s2ver }}/cmake" >> $env:GITHUB_ENV

      - name: Configure
        run: >
          cmake -S . -B ./build -A ${{ matrix.arch }}
          -DCMAKE_BUILD_TYPE=${{ matrix.build }}
          -DBUILD_SHARED_LIBS=ON
          -DWHISPER_SDL2=${{ matrix.sdl2 }}

      - name: Build
        run: |
          cd ./build
          msbuild ALL_BUILD.vcxproj -t:build -p:configuration=${{ matrix.build }} -p:platform=${{ matrix.arch }}

      - name: Copy SDL2.dll
        if: matrix.sdl2 == 'ON'
        run: copy "$env:SDL2_DIR/../lib/${{ matrix.s2arc }}/SDL2.dll" build/bin/${{ matrix.build }}

      - name: Upload SDL2.dll
        if: matrix.sdl2 == 'ON'
        uses: actions/upload-artifact@v6
        with:
          name: ${{ matrix.s2arc }}_SDL2.dll
          path: build/bin/${{ matrix.build }}/SDL2.dll

      - name: Upload whisper dll
        uses: actions/upload-artifact@v6
        with:
          name: whisper_${{ matrix.arch }}.dll
          path: build/bin/${{ matrix.build }}/whisper.dll

      - name: Upload ggml dll
        uses: actions/upload-artifact@v6
        with:
          name: ggml_${{ matrix.arch }}.dll
          path: build/bin/${{ matrix.build }}/ggml.dll

      - name: Upload ggml base dll
        uses: actions/upload-artifact@v6
        with:
          name: ggml_base_${{ matrix.arch }}.dll
          path: build/bin/${{ matrix.build }}/ggml-base.dll

      - name: Upload ggml cpu dll
        uses: actions/upload-artifact@v6
        with:
          name: ggml_cpu_${{ matrix.arch }}.dll
          path: build/bin/${{ matrix.build }}/ggml-cpu.dll

      - name: Pack bin artifacts
        shell: pwsh
        run: |
              Compress-Archive -Path "build/bin/${{ matrix.build }}" -DestinationPath "whisper-bin-${{ matrix.arch }}.zip"

      - name: Upload binaries
        if: matrix.sdl2 == 'ON' && ${{ needs.determine-tag.outputs.should_release }}
        uses: actions/upload-artifact@v6
        with:
          name: whisper-bin-${{ matrix.arch }}.zip
          path: whisper-bin-${{ matrix.arch }}.zip

  windows-blas:
    if: ${{ github.event_name == 'push' || github.event_name == 'pull_request' ||
            github.event.inputs.run_type == 'full-ci' }}
    runs-on: windows-latest

    strategy:
      matrix:
        build: [Release]
        arch: [Win32, x64]
        blas: [ON]
        sdl2: [ON]
        blasver: [0.3.29]
        include:
          - arch: Win32
            s2arc: x86
            blasfile: x86
          - arch: x64
            s2arc: x64
            blasfile: x64_64
          - sdl2: ON
            s2ver: 2.28.5

    steps:
      - name: Clone
        uses: actions/checkout@v6

      - name: Export GitHub Actions cache environment variables
        uses: actions/github-script@v8
        with:
          script: |
            core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
            core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');

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

      - name: Install OpenBLAS and pkgconfiglite
        if: matrix.blas == 'ON'
        run: |
          Invoke-WebRequest "https://github.com/OpenMathLib/OpenBLAS/releases/download/v${{matrix.blasver}}/OpenBLAS-${{matrix.blasver}}_${{matrix.blasfile}}.zip" -OutFile "OpenBLAS-${{matrix.blasver}}.zip"
          Expand-Archive "OpenBLAS-${{matrix.blasver}}.zip" -DestinationPath "OpenBLAS-${{matrix.blasver}}"
          choco install pkgconfiglite

      - name: Fetch SDL2 and set SDL2_DIR
        if: matrix.sdl2 == 'ON'
        run: |
          C:/msys64/usr/bin/wget.exe -qO sdl2.zip https://github.com/libsdl-org/SDL/releases/download/release-${{ matrix.s2ver }}/SDL2-devel-${{ matrix.s2ver }}-VC.zip
          7z x sdl2.zip
          echo "SDL2_DIR=$env:GITHUB_WORKSPACE/SDL2-${{ matrix.s2ver }}/cmake" >> $env:GITHUB_ENV

      - name: Configure
        run: >
          cmake -S . -B ./build -A ${{ matrix.arch }}
          -DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake"
          -DCMAKE_BUILD_TYPE=${{ matrix.build }}
          -DGGML_BLAS=${{ matrix.blas }}
          -DGGML_BLAS_VENDOR=OpenBLAS
          -DBLAS_LIBRARIES="$env:GITHUB_WORKSPACE/OpenBLAS-${{matrix.blasver}}/lib/libopenblas.lib"
          -DBLAS_INCLUDE_DIRS="$env:GITHUB_WORKSPACE/OpenBLAS-${{matrix.blasver}}/include"
          -DWHISPER_SDL2=${{ matrix.sdl2 }}

      - name: Build
        run: |
          cd ./build
          msbuild ALL_BUILD.vcxproj -t:build -p:configuration=${{ matrix.build }} -p:platform=${{ matrix.arch }}

      - name: Copy openblas.dll
        if: matrix.blas == 'ON'
        run: copy "$env:GITHUB_WORKSPACE/OpenBLAS-${{matrix.blasver}}/bin/libopenblas.dll" build/bin/${{ matrix.build }}

      - name: Copy SDL2.dll
        if: matrix.sdl2 == 'ON'
        run: copy "$env:SDL2_DIR/../lib/${{ matrix.s2arc }}/SDL2.dll" build/bin/${{ matrix.build }}

      - name: Pack bin artifacts
        shell: pwsh
        run: |
              Compress-Archive -Path "build/bin/${{ matrix.build }}" -DestinationPath "whisper-blas-bin-${{ matrix.arch }}.zip"

      - name: Upload binaries
        if: matrix.blas == 'ON' && matrix.sdl2 == 'ON' && ${{ needs.determine-tag.outputs.should_release }}
        uses: actions/upload-artifact@v6
        with:
          name: whisper-blas-bin-${{ matrix.arch }}.zip
          path: whisper-blas-bin-${{ matrix.arch }}.zip

  windows-cublas:
    if: ${{ github.event_name == 'push' || github.event_name == 'pull_request' ||
            github.event.inputs.run_type == 'full-ci' }}
    runs-on: windows-2022
    needs: determine-tag
    strategy:
      fail-fast: false
      matrix:
        build: [Release]
        arch: [x64]
        cublas: [ON]
        sdl2: [ON]
        cuda-toolkit: [12.4.0, 11.8.0]
        include:
          - arch: x64
            sdl2: ON
            sdl2_ver: 2.28.5
    steps:
      - name: Clone repository
        uses: actions/checkout@v6

      - name: Install Ninja
        id: install_ninja
        run: |
          choco install ninja

      - name: Install ccache
        uses: hendrikmuhs/ccache-action@v1.2.16
        with:
          key: ${{ github.job }}-${{ matrix.cuda-toolkit }}-${{ matrix.build }}
          variant: sccache
          evict-old-files: 5d

      - name: Install Cuda Toolkit 11.8.0
        if: ${{ matrix.cuda-toolkit == '11.8.0' }}
        run: |
          $CUDA_VERSION = ${{ matrix.cuda-toolkit }}
          $CUDA_TOOLKIT_DIR = "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v$CUDA_VERSION"
          $CUDA_DOWNLOAD = "https://developer.download.nvidia.com/compute/cuda/redist"

          # Components versions
          $CUDART_VER = "11.8.89"
          $NVCC_VER   = "11.8.89"
          $NVRTC_VER  = "11.8.89"
          $CUBLAS_VER = "11.8.1.74"
          $NVTX_VER   = "11.8.86"
          $VS_VER     = "11.8.86"
          $NVPROF_VER = "11.8.87"
          $CCCL_VER   = "11.8.89"

          # Create the directory where the CUDA Toolkit will be installed
          mkdir -p $CUDA_TOOLKIT_DIR

          # Install unzip to extract the downloaded files
          choco install unzip -y

          # Download all the required components
          curl -O "$CUDA_DOWNLOAD/cuda_cudart/windows-x86_64/cuda_cudart-windows-x86_64-${CUDART_VER}-archive.zip"
          curl -O "$CUDA_DOWNLOAD/cuda_nvcc/windows-x86_64/cuda_nvcc-windows-x86_64-${NVCC_VER}-archive.zip"
          curl -O "$CUDA_DOWNLOAD/cuda_nvrtc/windows-x86_64/cuda_nvrtc-windows-x86_64-${NVRTC_VER}-archive.zip"
          curl -O "$CUDA_DOWNLOAD/libcublas/windows-x86_64/libcublas-windows-x86_64-${CUBLAS_VER}-archive.zip"
          curl -O "$CUDA_DOWNLOAD/cuda_nvtx/windows-x86_64/cuda_nvtx-windows-x86_64-${NVTX_VER}-archive.zip"
          curl -O "$CUDA_DOWNLOAD/visual_studio_integration/windows-x86_64/visual_studio_integration-windows-x86_64-${VS_VER}-archive.zip"
          curl -O "$CUDA_DOWNLOAD/cuda_nvprof/windows-x86_64/cuda_nvprof-windows-x86_64-${NVPROF_VER}-archive.zip"
          curl -O "$CUDA_DOWNLOAD/cuda_cccl/windows-x86_64/cuda_cccl-windows-x86_64-${CCCL_VER}-archive.zip"

          # Extract all the downloaded files to the CUDA Toolkit directory
          unzip '*.zip' -d $CUDA_TOOLKIT_DIR

          # Copy all the extracted files to the main CUDA Toolkit directory
          xcopy "$CUDA_TOOLKIT_DIR\cuda_cudart-windows-x86_64-${CUDART_VER}-archive\*" "$CUDA_TOOLKIT_DIR" /E /I /H /Y
          xcopy "$CUDA_TOOLKIT_DIR\cuda_nvcc-windows-x86_64-${NVCC_VER}-archive\*" "$CUDA_TOOLKIT_DIR" /E /I /H /Y
          xcopy "$CUDA_TOOLKIT_DIR\cuda_nvrtc-windows-x86_64-${NVRTC_VER}-archive\*" "$CUDA_TOOLKIT_DIR" /E /I /H /Y
          xcopy "$CUDA_TOOLKIT_DIR\libcublas-windows-x86_64-${CUBLAS_VER}-archive\*" "$CUDA_TOOLKIT_DIR" /E /I /H /Y
          xcopy "$CUDA_TOOLKIT_DIR\cuda_nvtx-windows-x86_64-${NVTX_VER}-archive\*" "$CUDA_TOOLKIT_DIR" /E /I /H /Y
          xcopy "$CUDA_TOOLKIT_DIR\cuda_nvprof-windows-x86_64-${NVPROF_VER}-archive\*" "$CUDA_TOOLKIT_DIR" /E /I /H /Y
          xcopy "$CUDA_TOOLKIT_DIR\cuda_cccl-windows-x86_64-${CCCL_VER}-archive\*" "$CUDA_TOOLKIT_DIR" /E /I /H /Y
          xcopy "$CUDA_TOOLKIT_DIR\visual_studio_integration-windows-x86_64-${VS_VER}-archive\*" "$CUDA_TOOLKIT_DIR" /E /I /H /Y

          # Visual Studio integration
          xcopy "$CUDA_TOOLKIT_DIR\visual_studio_integration-windows-x86_64-${VS_VER}-archive\visual_studio_integration\MSBuildExtensions\*" "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\BuildCustomizations" /E /I /H /Y

          # Set environment variables
          echo "$CUDA_TOOLKIT_DIR\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
          echo "$CUDA_TOOLKIT_DIR\libnvvp" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
          echo "CUDA_PATH=$CUDA_TOOLKIT_DIR" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
          echo "CUDA_PATH_V11_8=$CUDA_TOOLKIT_DIR" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8

      - name: Install Cuda Toolkit 12.4.0
        if: ${{ matrix.cuda-toolkit == '12.4.0' }}
        run: |
          $CUDA_VERSION = ${{ matrix.cuda-toolkit }}
          $CUDA_TOOLKIT_DIR = "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v$CUDA_VERSION"
          $CUDA_DOWNLOAD = "https://developer.download.nvidia.com/compute/cuda/redist"

          # Components versions
          $CUDART_VER   = "12.4.127"
          $NVCC_VER     = "12.4.131"
          $NVRTC_VER    = "12.4.127"
          $CUBLAS_VER   = "12.4.5.8"
          $NVTX_VER     = "12.4.127"
          $PROFILER_VER = "12.4.127"
          $VS_VER       = "12.4.127"
          $NVPROF_VER   = "12.4.128"
          $CCCL_VER     = "12.4.127"

          # Create the directory where the CUDA Toolkit will be installed
          mkdir -p $CUDA_TOOLKIT_DIR

          # Install unzip to extract the downloaded files
          choco install unzip -y

          # Download all the required components
          curl -O "$CUDA_DOWNLOAD/cuda_cudart/windows-x86_64/cuda_cudart-windows-x86_64-${CUDART_VER}-archive.zip"
          curl -O "$CUDA_DOWNLOAD/cuda_nvcc/windows-x86_64/cuda_nvcc-windows-x86_64-${NVCC_VER}-archive.zip"
          curl -O "$CUDA_DOWNLOAD/cuda_nvrtc/windows-x86_64/cuda_nvrtc-windows-x86_64-${NVRTC_VER}-archive.zip"
          curl -O "$CUDA_DOWNLOAD/libcublas/windows-x86_64/libcublas-windows-x86_64-${CUBLAS_VER}-archive.zip"
          curl -O "$CUDA_DOWNLOAD/cuda_nvtx/windows-x86_64/cuda_nvtx-windows-x86_64-${NVTX_VER}-archive.zip"
          curl -O "$CUDA_DOWNLOAD/cuda_profiler_api/windows-x86_64/cuda_profiler_api-windows-x86_64-${PROFILER_VER}-archive.zip"
          curl -O "$CUDA_DOWNLOAD/visual_studio_integration/windows-x86_64/visual_studio_integration-windows-x86_64-${VS_VER}-archive.zip"
          curl -O "$CUDA_DOWNLOAD/cuda_nvprof/windows-x86_64/cuda_nvprof-windows-x86_64-${NVPROF_VER}-archive.zip"
          curl -O "$CUDA_DOWNLOAD/cuda_cccl/windows-x86_64/cuda_cccl-windows-x86_64-${CCCL_VER}-archive.zip"

          # Extract all the downloaded files to the CUDA Toolkit directory
          unzip -q '*.zip' -d $CUDA_TOOLKIT_DIR

          # Copy all the extracted files to the main CUDA Toolkit directory
          xcopy "$CUDA_TOOLKIT_DIR\cuda_cudart-windows-x86_64-${CUDART_VER}-archive\*" "$CUDA_TOOLKIT_DIR" /E /I /H /Y
          xcopy "$CUDA_TOOLKIT_DIR\cuda_nvcc-windows-x86_64-${NVCC_VER}-archive\*"     "$CUDA_TOOLKIT_DIR" /E /I /H /Y
          xcopy "$CUDA_TOOLKIT_DIR\cuda_nvrtc-windows-x86_64-${NVRTC_VER}-archive\*"   "$CUDA_TOOLKIT_DIR" /E /I /H /Y
          xcopy "$CUDA_TOOLKIT_DIR\libcublas-windows-x86_64-${CUBLAS_VER}-archive\*"   "$CUDA_TOOLKIT_DIR" /E /I /H /Y
          xcopy "$CUDA_TOOLKIT_DIR\cuda_nvtx-windows-x86_64-${NVTX_VER}-archive\*"     "$CUDA_TOOLKIT_DIR" /E /I /H /Y
          xcopy "$CUDA_TOOLKIT_DIR\cuda_nvprof-windows-x86_64-${NVPROF_VER}-archive\*" "$CUDA_TOOLKIT_DIR" /E /I /H /Y
          xcopy "$CUDA_TOOLKIT_DIR\cuda_cccl-windows-x86_64-${CCCL_VER}-archive\*" "$CUDA_TOOLKIT_DIR" /E /I /H /Y
          xcopy "$CUDA_TOOLKIT_DIR\cuda_profiler_api-windows-x86_64-${PROFILER_VER}-archive\*" "$CUDA_TOOLKIT_DIR" /E /I /H /Y
          xcopy "$CUDA_TOOLKIT_DIR\visual_studio_integration-windows-x86_64-${VS_VER}-archive\*" "$CUDA_TOOLKIT_DIR" /E /I /H /Y

          # Visual Studio integration
          xcopy "$CUDA_TOOLKIT_DIR\visual_studio_integration-windows-x86_64-${VS_VER}-archive\visual_studio_integration\MSBuildExtensions\*" "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\BuildCustomizations" /E /I /H /Y

          # Set environment variables
          echo "$CUDA_TOOLKIT_DIR\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
          echo "$CUDA_TOOLKIT_DIR\libnvvp" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
          echo "CUDA_PATH=$CUDA_TOOLKIT_DIR" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
          echo "CUDA_PATH_V12_2=$CUDA_TOOLKIT_DIR" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8

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

      - name: Install 7-Zip
        run: choco install 7zip -y

      - name: Fetch SDL2 and set SDL2_DIR
        if: matrix.sdl2 == 'ON'
        run: |
          Invoke-WebRequest -Uri https://github.com/libsdl-org/SDL/releases/download/release-${{ matrix.sdl2_ver }}/SDL2-devel-${{ matrix.sdl2_ver }}-VC.zip -OutFile sdl2.zip
          7z x sdl2.zip
          echo "SDL2_DIR=${{ github.workspace }}\SDL2-${{ matrix.sdl2_ver }}\cmake" | Out-File -FilePath $env:GITHUB_ENV -Append
          echo "${{ github.workspace }}\SDL2-${{ matrix.sdl2_ver }}\cmake" > SDL2_PATH.txt

      - name: Install cmake
        run: choco install cmake

      - name: Build Project
        shell: cmd
        run: |
          call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
          cmake --version
          where cmake
          if "${{ matrix.cuda-toolkit }}" == "11.8.0" (
            set CUDA_FLAGS=-allow-unsupported-compiler -D_ALLOW_COMPILER_AND_STL_VERSION_MISMATCH -D_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR
          ) else (
            set CUDA_FLAGS=
          )
          cmake -S . -B build -G "Ninja Multi-Config" ^
            -DCMAKE_BUILD_TYPE=${{ matrix.build }} ^
            -DGGML_CUDA=${{ matrix.cublas }} ^
            -DWHISPER_SDL2=${{ matrix.sdl2 }} ^
            -DSDL2_DIR="%SDL2_DIR%" ^
            -DCMAKE_POLICY_VERSION_MINIMUM=3.5 ^
            -DCMAKE_CUDA_FLAGS="%CUDA_FLAGS%"
          set /A NINJA_JOBS=%NUMBER_OF_PROCESSORS%-1
          cmake --build build --config ${{ matrix.build }} -j %NUMBER_OF_PROCESSORS%

      - name: Check sccache status after build
        run: |
          sccache --show-stats

      - name: Copy CUDA DLLs
        run: |
          Get-ChildItem "$env:CUDA_PATH\bin\" -Filter "*.dll" |
          Copy-Item -Destination "build/bin/${{ matrix.build }}"

      - name: Copy SDL2.dll
        if: matrix.sdl2 == 'ON'
        run: copy "$env:SDL2_DIR/../lib/${{ matrix.arch }}/SDL2.dll" build/bin/${{ matrix.build }}

      - name: Pack bin artifacts
        shell: pwsh
        run: |
              Compress-Archive -Path "build/bin/${{ matrix.build }}" -DestinationPath "whisper-cublas-${{ matrix.cuda-toolkit }}-bin-${{ matrix.arch }}.zip"

      - name: Upload binaries
        if: ${{ needs.determine-tag.outputs.should_release }}
        uses: actions/upload-artifact@v6
        with:
          name: whisper-cublas-${{ matrix.cuda-toolkit }}-bin-${{ matrix.arch }}.zip
          path: whisper-cublas-${{ matrix.cuda-toolkit }}-bin-${{ matrix.arch }}.zip

  emscripten:
    if: ${{ github.event_name == 'push' || github.event_name == 'pull_request' ||
            github.event.inputs.run_type == 'full-ci' }}
    runs-on: ubuntu-22.04

    strategy:
      matrix:
        build: [Release]

    steps:
      - name: Clone
        uses: actions/checkout@v6

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

      - name: Verify
        run: emcc -v

      - name: Build
        run: |
          emcmake cmake . -DCMAKE_BUILD_TYPE=${{ matrix.build }}
          make

  ios-xcode-build:
    runs-on: macos-latest
    needs: determine-tag

    strategy:
      matrix:
        build: [Release]

    steps:
      - name: Checkout code
        uses: actions/checkout@v6

      - name: Configure
        run: |
          cp models/for-tests-ggml-base.en.bin models/ggml-base.en.bin
          mkdir models/ggml-base.en-encoder.mlmodelc

      - name: Build
        id: cmake_build
        run: |
          sysctl -a
          mkdir build
          cd build
          cmake -G Xcode .. \
            -DGGML_METAL_USE_BF16=ON \
            -DGGML_METAL_EMBED_LIBRARY=ON \
            -DWHISPER_BUILD_EXAMPLES=OFF \
            -DWHISPER_BUILD_TESTS=OFF \
            -DWHISPER_BUILD_SERVER=OFF \
            -DCMAKE_SYSTEM_NAME=iOS \
            -DCMAKE_OSX_DEPLOYMENT_TARGET=14.0 \
            -DCMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM=ggml
          cmake --build . --config Release -j $(sysctl -n hw.logicalcpu) -- CODE_SIGNING_ALLOWED=NO

      - name: xcodebuild for swift package
        id: xcodebuild
        run: |
          ./build-xcframework.sh

      - name: Build objc example
        run: xcodebuild -project examples/whisper.objc/whisper.objc.xcodeproj -scheme whisper.objc -configuration ${{ matrix.build }} -sdk iphoneos CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO FRAMEWORK_FOLDER_PATH=./build-ios build

      - name: Build swiftui example
        run: xcodebuild -project examples/whisper.swiftui/whisper.swiftui.xcodeproj -scheme WhisperCppDemo -configuration ${{ matrix.build }} -sdk iphoneos CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= -destination 'generic/platform=iOS' FRAMEWORK_FOLDER_PATH=./build-ios build

      - name: Pack artifacts
        id: pack_artifacts
        run: |
          zip --symlinks -r whisper-${{ needs.determine-tag.outputs.tag_name }}-xcframework.zip build-apple/whisper.xcframework

      - name: Upload artifacts
        if: ${{ needs.determine-tag.outputs.should_release }}
        uses: actions/upload-artifact@v6
        with:
          path: whisper-${{ needs.determine-tag.outputs.tag_name }}-xcframework.zip
          name: whisper-${{ needs.determine-tag.outputs.tag_name }}-xcframework.zip

  android:
    if: ${{ github.event_name == 'push' || github.event_name == 'pull_request' ||
            github.event.inputs.run_type == 'full-ci' }}
    runs-on: ubuntu-22.04

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

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

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

      - name: Build
        run: |
          cd whisper/examples/whisper.android
          ./gradlew assembleRelease --no-daemon

      - name: Build with external ggml
        run: |
          export PATH_TO_GGML=$PWD/ggml
          cd whisper/examples/whisper.android
          ./gradlew assembleRelease --no-daemon

  android_java:
    runs-on: ubuntu-22.04

    steps:
      - name: Clone
        uses: actions/checkout@v6

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

      - name: Setup Android SDK
        uses: android-actions/setup-android@v3
        with:
          cmdline-tools-version: 9.0

      - name: Build
        run: |
          cd examples/whisper.android.java
          chmod +x ./gradlew
          ./gradlew assembleRelease

  bindings-java:
    if: ${{ github.event_name == 'push' || github.event_name == 'pull_request' ||
            github.event.inputs.run_type == 'full-ci' }}
    needs: ['windows']
    runs-on: windows-latest
    steps:
      - uses: actions/checkout@v6

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

      - name: Download Whisper Windows lib
        uses: actions/download-artifact@v7
        with:
          name: whisper_x64.dll

      - name: Download GGML Windows lib
        uses: actions/download-artifact@v7
        with:
          name: ggml_x64.dll

      - name: Download GGML Base Windows lib
        uses: actions/download-artifact@v7
        with:
          name: ggml_base_x64.dll

      - name: Download GGML CPU Windows lib
        uses: actions/download-artifact@v7
        with:
          name: ggml_cpu_x64.dll

      - name: Download SDL2.dll
        uses: actions/download-artifact@v7
        with:
          name: x64_SDL2.dll

      - name: List downloaded files
        shell: pwsh
        run: |
          Get-ChildItem -Path "." -Recurse -Filter "*.dll"

      - name: Move DLL to correct location
        shell: pwsh
        run: |
          New-Item -Path "build\bin\Release" -ItemType Directory -Force

          Copy-Item -Path "whisper.dll" -Destination "build\bin\Release\whisper.dll" -Force
          Write-Host "Copied whisper.dll to build\bin\Release\whisper.dll directory"

          Copy-Item -Path "ggml.dll" -Destination "build\bin\Release\ggml.dll" -Force
          Write-Host "Copied ggml.dll to build\bin\Release\ggml.dll directory"

          Copy-Item -Path "ggml-base.dll" -Destination "build\bin\Release\ggml-base.dll" -Force
          Write-Host "Copied ggml-base.dll to build\bin\Release\ggml-base.dll directory"

          Copy-Item -Path "ggml-cpu.dll" -Destination "build\bin\Release\ggml-cpu.dll" -Force
          Write-Host "Copied ggml-cpu.dll to build\bin\Release\ggml-cpu.dll directory"

          Copy-Item -Path "SDL2.dll" -Destination "build\bin\Release\SDL2.dll" -Force
          Write-Host "Copied SDL2.dll to build\bin\Release\SDL2.dll directory"

      - name: List build release files
        shell: pwsh
        run: |
          Get-ChildItem -Path "build\Release" -Recurse -Filter "*.dll"

      - name: Build
        run: |
          models\download-ggml-model.cmd tiny.en models/
          cd bindings/java
          chmod +x ./gradlew
          ./gradlew build --info

      - name: Pack jar artifacts
        shell: pwsh
        run: |
              Compress-Archive -Path "bindings/java/build/libs/whispercpp-*.jar" -DestinationPath "whispercpp.jar.zip"

      - name: Upload jar
        uses: actions/upload-artifact@v6
        with:
          name: whispercpp.jar.zip
          path: whispercpp.jar.zip

#      - name: Publish package
#        if: ${{ github.ref == 'refs/heads/master' }}
#        uses: gradle/gradle-build-action@v2.4.2
#        with:
#          arguments: publish
#          build-root-directory: bindings/java
#        env:
#          MAVEN_USERNAME: ${{ secrets.JIRA_USER }}
#          MAVEN_PASSWORD: ${{ secrets.JIRA_PASS }}
#          PGP_SECRET: ${{ secrets.GPG_PRIVATE_KEY }}
#          PGP_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}

  quantize:
    if: ${{ github.event_name == 'push' || github.event_name == 'pull_request' ||
            github.event.inputs.run_type == 'full-ci' }}
    runs-on: ubuntu-22.04

    steps:
      - name: Clone
        uses: actions/checkout@v6

      - name: Test quantize
        run: |
          ./models/download-ggml-model.sh tiny.en
          cmake -B build
          cmake --build build --config Release
          ./build/bin/whisper-quantize models/ggml-tiny.en.bin models/ggml-tiny.en-q4_0.bin q4_0

  release:
    if: ${{ github.event.inputs.create_release == 'true' || github.event.inputs.pre_release_tag != '' || startsWith(github.ref, 'refs/tags/v') }}

    runs-on: ubuntu-latest

    needs:
      - determine-tag
      - ios-xcode-build
      - windows
      - windows-blas
      - windows-cublas

    steps:
      - name: Clone
        id: checkout
        uses: actions/checkout@v6
        with:
          fetch-depth: 0

      - name: ccache
        uses: hendrikmuhs/ccache-action@v1.2.16
        with:
          key: release
          evict-old-files: 1d

      # Downloads all the artifacts from the previous jobs
      - name: Download artifacts
        id: download-artifact
        uses: actions/download-artifact@v7
        with:
          path: ./artifact

      - name: Move artifacts
        id: move_artifacts
        run: mkdir -p ./artifact/release && mv ./artifact/*/*.zip ./artifact/release

      - name: Create release
        id: create_release
        uses: ggml-org/action-create-release@v1
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          tag_name: ${{ needs.determine-tag.outputs.tag_name }}
          prerelease: ${{ github.event.inputs.pre_release_tag != '' }}
          draft: true

      - name: Upload release
        id: upload_release
        uses: actions/github-script@v3
        with:
          github-token: ${{secrets.GITHUB_TOKEN}}
          script: |
            const path = require('path');
            const fs = require('fs');
            const release_id = '${{ steps.create_release.outputs.id }}';
            for (let file of await fs.readdirSync('./artifact/release')) {
              if (path.extname(file) === '.zip') {
                console.log('uploadReleaseAsset', file);
                await github.repos.uploadReleaseAsset({
                  owner: context.repo.owner,
                  repo: context.repo.repo,
                  release_id: release_id,
                  name: file,
                  data: await fs.readFileSync(`./artifact/release/${file}`)
                });
              }
            }

  coreml-base-en:
    if: ${{ (github.event_name == 'push' && github.ref == 'refs/heads/master') ||
            github.event.inputs.create_release == 'true' ||
            github.event.inputs.pre_release_tag != '' ||
            startsWith(github.ref, 'refs/tags/v') }}
    runs-on: macos-latest
    needs: determine-tag

    steps:
      - name: Checkout code
        uses: actions/checkout@v6

      - name: Set environment variables
        id: set_vars
        run: |
          echo "MODEL_NAME=base.en" >> $GITHUB_ENV
          echo "GEN_MODEL_NAME=whisper-${{ needs.determine-tag.outputs.tag_name }}-ggml-base.en-encoder.mlmodelc" >> $GITHUB_ENV

      - name: Download model
        run: |
          ./models/download-ggml-model.sh ${{ env.MODEL_NAME }}

      - name: Generate CoreML model
        run: |
          python3.11 -m venv venv
          source venv/bin/activate
          pip install ane_transformers openai-whisper coremltools
          ./models/generate-coreml-model.sh ${{ env.MODEL_NAME }}

  vad:
    if: ${{ github.event_name == 'push' || github.event_name == 'pull_request' ||
            github.event.inputs.run_type == 'full-ci' }}
    runs-on: ubuntu-latest

    steps:
      - name: Checkout
        uses: actions/checkout@v6

      - name: Build
        shell: bash
        run: |
          cmake -B build
          cmake --build build --config Release

      - name: Test
        shell: bash
        run: |
          ctest -R ^test-vad$ --test-dir build --output-on-failure -VV

# TODO: simplify the following workflows using a matrix
  ggml-ci-x64-cpu-low-perf:
    runs-on: ubuntu-22.04

    steps:
      - name: Clone
        id: checkout
        uses: actions/checkout@v6

      - name: ccache
        uses: ggml-org/ccache-action@v1.2.16
        with:
          key: ggml-ci-x64-cpu-low-perf
          evict-old-files: 1d

      - name: Dependencies
        id: depends
        run: |
          sudo apt-get update
          sudo apt-get install build-essential libcurl4-openssl-dev

      - name: Test
        id: ggml-ci
        run: |
          LLAMA_ARG_THREADS=$(nproc) GG_BUILD_LOW_PERF=1 bash ./ci/run.sh ./tmp/results ./tmp/mnt

  ggml-ci-arm64-cpu-low-perf:
    runs-on: ubuntu-22.04-arm

    steps:
      - name: Clone
        id: checkout
        uses: actions/checkout@v6

      - name: ccache
        uses: ggml-org/ccache-action@v1.2.16
        with:
          key: ggml-ci-arm64-cpu-low-perf
          evict-old-files: 1d

      - name: Dependencies
        id: depends
        run: |
          sudo apt-get update
          sudo apt-get install build-essential libcurl4-openssl-dev

      - name: Test
        id: ggml-ci
        run: |
          LLAMA_ARG_THREADS=$(nproc) GG_BUILD_LOW_PERF=1 bash ./ci/run.sh ./tmp/results ./tmp/mnt

  ggml-ci-x64-cpu-high-perf:
    runs-on: ubuntu-22.04

    steps:
      - name: Clone
        id: checkout
        uses: actions/checkout@v6

      - name: ccache
        uses: ggml-org/ccache-action@v1.2.16
        with:
          key: ggml-ci-x64-cpu-high-perf
          evict-old-files: 1d

      - name: Dependencies
        id: depends
        run: |
          sudo apt-get update
          sudo apt-get install build-essential libcurl4-openssl-dev

      - name: Test
        id: ggml-ci
        run: |
          LLAMA_ARG_THREADS=$(nproc) bash ./ci/run.sh ./tmp/results ./tmp/mnt

  ggml-ci-arm64-cpu-high-perf:
    runs-on: ubuntu-22.04-arm

    steps:
      - name: Clone
        id: checkout
        uses: actions/checkout@v6

      - name: ccache
        uses: ggml-org/ccache-action@v1.2.16
        with:
          key: ggml-ci-arm64-cpu-high-perf
          evict-old-files: 1d

      - name: Dependencies
        id: depends
        run: |
          sudo apt-get update
          sudo apt-get install build-essential libcurl4-openssl-dev

      - name: Test
        id: ggml-ci
        run: |
          LLAMA_ARG_THREADS=$(nproc) GG_BUILD_NO_SVE=1 GG_BUILD_NO_BF16=1 GG_BUILD_EXTRA_TESTS_0=1 bash ./ci/run.sh ./tmp/results ./tmp/mnt

  ggml-ci-arm64-cpu-high-perf-sve:
    runs-on: ubuntu-22.04-arm

    steps:
      - name: Clone
        id: checkout
        uses: actions/checkout@v6

      - name: ccache
        uses: ggml-org/ccache-action@v1.2.16
        with:
          key: ggml-ci-arm64-cpu-high-perf-sve
          evict-old-files: 1d

      - name: Dependencies
        id: depends
        run: |
          sudo apt-get update
          sudo apt-get install build-essential libcurl4-openssl-dev

      - name: Test
        id: ggml-ci
        run: |
          LLAMA_ARG_THREADS=$(nproc) GG_BUILD_NO_BF16=1 GG_BUILD_EXTRA_TESTS_0=1 bash ./ci/run.sh ./tmp/results ./tmp/mnt

  ggml-ci-x64-nvidia-cuda:
    runs-on: [self-hosted, Linux, mnt-root, NVIDIA]

    steps:
      - name: Clone
        id: checkout
        uses: actions/checkout@v6

      - name: Test
        id: ggml-ci
        run: |
          nvidia-smi
          GG_BUILD_CUDA=1 bash ./ci/run.sh ~/results/whisper.cpp /mnt/whisper.cpp

  ggml-ci-x64-nvidia-vulkan-cm:
    runs-on: [self-hosted, Linux, mnt-root, NVIDIA]

    steps:
      - name: Clone
        id: checkout
        uses: actions/checkout@v6

      - name: Test
        id: ggml-ci
        run: |
          vulkaninfo --summary
          GG_BUILD_VULKAN=1 GGML_VK_DISABLE_COOPMAT2=1 bash ./ci/run.sh ~/results/whisper.cpp /mnt/whisper.cpp

  ggml-ci-x64-nvidia-vulkan-cm2:
    runs-on: [self-hosted, Linux, mnt-root, NVIDIA, COOPMAT2]

    steps:
      - name: Clone
        id: checkout
        uses: actions/checkout@v6

      - name: Test
        id: ggml-ci
        run: |
          vulkaninfo --summary
          GG_BUILD_VULKAN=1 bash ./ci/run.sh ~/results/whisper.cpp /mnt/whisper.cpp

  #ggml-ci-x64-cpu-amx:
  #  runs-on: [self-hosted, Linux, X64, CPU, AMX]

  #  steps:
  #    - name: Clone
  #      id: checkout
  #      uses: actions/checkout@v6

  #    - name: Test
  #      id: ggml-ci
  #      run: |
  #        bash ./ci/run.sh ~/results/whisper.cpp /mnt/whisper.cpp

  ggml-ci-mac-metal:
    runs-on: [self-hosted, macOS, ARM64]

    steps:
      - name: Clone
        id: checkout
        uses: actions/checkout@v6

      - name: Test
        id: ggml-ci
        run: |
          GG_BUILD_METAL=1 bash ./ci/run.sh ~/results/whisper.cpp ~/mnt/whisper.cpp

  ggml-ci-mac-vulkan:
    runs-on: [self-hosted, macOS, ARM64]

    steps:
      - name: Clone
        id: checkout
        uses: actions/checkout@v6

      - name: Test
        id: ggml-ci
        run: |
          vulkaninfo --summary
          GG_BUILD_VULKAN=1 bash ./ci/run.sh ~/results/whisper.cpp ~/mnt/whisper.cpp


================================================
FILE: .github/workflows/docker.yml
================================================
name: Publish Docker image

on:
  pull_request:
  push:
    branches:
      - master

jobs:
  push_to_registry:
    name: Push Docker image to Docker Hub
    if: github.event.pull_request.draft == false

    runs-on: ubuntu-22.04
    env:
      COMMIT_SHA: ${{ github.sha }}
    strategy:
      fail-fast: false
      matrix:
        config:
          - { tag: "main", dockerfile: ".devops/main.Dockerfile", platform: "linux/amd64" }
          - { tag: "main-musa", dockerfile: ".devops/main-musa.Dockerfile", platform: "linux/amd64" }
          - { tag: "main-intel", dockerfile: ".devops/main-intel.Dockerfile", platform: "linux/amd64" }
          - { tag: "main-cuda", dockerfile: ".devops/main-cuda.Dockerfile", platform: "linux/amd64" }
          - { tag: "main-vulkan", dockerfile: ".devops/main-vulkan.Dockerfile", platform: "linux/amd64" }

    steps:
      - name: Check out the repo
        uses: actions/checkout@v6

      - name: Set up QEMU
        uses: docker/setup-qemu-action@v3
        with:
          image: tonistiigi/binfmt:qemu-v7.0.0-28

      - name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v3

      - name: Log in to Docker Hub
        uses: docker/login-action@v3
        with:
          registry: ghcr.io
          username: ${{ github.repository_owner }}
          password: ${{ secrets.GITHUB_TOKEN }}

      - name: Free up disk space
        run: |
          sudo apt-get remove -y '^dotnet-.*' '^llvm-.*' '^mysql-.*' '^postgresql-.*'
          sudo apt-get autoremove -y
          sudo apt-get autoclean

          sudo rm -rf /usr/share/dotnet
          sudo rm -rf /usr/local/lib/android
          sudo rm -rf /opt/ghc
          sudo rm -rf /opt/hostedtoolcache/CodeQL

          docker system prune -af

          df -h

      - name: Generate tags
        id: tags
        run: |
          TAGS="ghcr.io/${{ github.repository }}:${{ matrix.config.tag }}"
          if [ "${{ github.event_name }}" == "push" ]; then
            TAGS="$TAGS,ghcr.io/${{ github.repository }}:${{ matrix.config.tag }}-${{ env.COMMIT_SHA }}"
          fi
          echo "tags=$TAGS" >> $GITHUB_OUTPUT

      - name: Build and push Docker image (tagged)
        uses: docker/build-push-action@v6
        with:
          context: .
          push: ${{ github.event_name == 'push' }}
          platforms: ${{ matrix.config.platform }}
          tags: ${{ steps.tags.outputs.tags }}
          file: ${{ matrix.config.dockerfile }}


================================================
FILE: .github/workflows/examples-wasm.yml
================================================
name: Examples WASM
on:
  push:
    branches: ["master"]

  workflow_dispatch:

permissions:
  contents: read
  pages: write
  id-token: write

concurrency:
  group: "pages"
  cancel-in-progress: false

jobs:
  deploy-wasm-github-pages:
    environment:
      name: github-pages
      url: ${{ steps.deployment.outputs.page_url }}
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v6

      - name: Setup Pages
        uses: actions/configure-pages@v5

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

      - name: Build WASM Examples
        # Enable for real build later in whisper.cpp
        run: |
          mkdir -p build-em && cd build-em
          emcmake cmake .. -DCMAKE_BUILD_TYPE=Release
          make -j

      - name: Create staging directory
        run: mkdir -p staging

      - name: Create .nojekyll file in staging directory
        run: touch staging/.nojekyll

      - name: Copy application files
        run: |
          build_dir=build-em/bin

          ls ${build_dir}

          # command.wasm
          target_dir=staging/command.wasm
          mkdir -p ${target_dir}
          cp ${build_dir}/command.wasm/{index.html,command.js,helpers.js} ${target_dir}
          cp ${build_dir}/libcommand.js ${target_dir}

          # bench.wasm
          target_dir=staging/bench.wasm
          mkdir -p ${target_dir}
          cp ${build_dir}/bench.wasm/{index.html,bench.js,helpers.js} ${target_dir}
          cp ${build_dir}/libbench.js ${target_dir}

          # stream.wasm
          target_dir=staging/stream.wasm
          mkdir -p ${target_dir}
          cp ${build_dir}/stream.wasm/{index.html,stream.js,helpers.js} ${target_dir}
          cp ${build_dir}/libstream.js ${target_dir}

          # wchess.wasm
          target_dir=staging/wchess.wasm
          mkdir -p ${target_dir}
          cp -r ${build_dir}/wchess.wasm/{index.html,css,img,js} ${target_dir}
          cp ${build_dir}/wchess.wasm.js ${target_dir}

          # whisper.wasm (this will be the main example page)
          target_dir=staging
          mkdir -p ${target_dir}
          cp ${build_dir}/whisper.wasm/{index.html,main.js,helpers.js} ${target_dir}
          cp ${build_dir}/libmain.js ${target_dir}

          # Copy Cross-Origin Isolation service worker
          cp -v examples/coi-serviceworker.js staging/

      - name: List files in staging directory (for debugging)
        run: |
          echo "Files in staging directory:"
          find staging -type f | sort

      - name: Upload artifact
        uses: actions/upload-pages-artifact@v4
        with:
          path: ./staging

      - name: Deploy to GitHub Pages
        id: deployment
        uses: actions/deploy-pages@v4


================================================
FILE: .github/workflows/examples.yml
================================================
name: Examples Tests
on:
  push:
    paths:
      - examples/addon.node/**
      - whisper.h
  pull_request:
    paths:
      - examples/addon.node/**
      - whisper.h

jobs:
  addon_node-ubuntu-22:
    runs-on: ubuntu-22.04
    strategy:
      matrix:
        node-version: [ 16.x, 18.x ]
    steps:
      - name: Clone
        uses: actions/checkout@v6

      - name: Dependencies
        run: |
          sudo apt-get update
          sudo apt-get install build-essential git
          sudo apt-get install cmake
          sudo apt-get install libsdl2-dev

      - name: Use Node.js ${{ matrix.node-version }}
        uses: actions/setup-node@v6
        with:
          node-version: ${{ matrix.node-version }}
          cache: 'npm'

      - name: Install package.json dependencies
        working-directory: ./examples/addon.node
        run: npm install

      - name: Compile addon.node
        run: npx cmake-js compile -T addon.node -B Release

      - name: Download test model
        run: |
          bash ./models/download-ggml-model.sh base.en
      - name: Test
        run: |
          cd examples/addon.node
          npm run test


================================================
FILE: .gitignore
================================================
*.o
*.a
*.d
.cache/
.coreml/
.test/
.venv/
.vs/
.vscode/
.DS_Store
.vimspector.json
/CMakeSettings.json
/talk-llama.dSYM/

build/
build-*/
build_*/
tmp/

# SPM
.build/
.swiftpm
*.metallib

ggml-metal-embed.metal
ggml-metal-embed.metal.tmp

/main
/stream
/command
/talk
/talk-llama
/bench
/quantize
/server
/lsp

arm_neon.h
sync.sh
libwhisper.a
libwhisper.so
compile_commands.json

examples/arm_neon.h
examples/whisper.objc/whisper.objc.xcodeproj/xcshareddata
examples/whisper.objc/whisper.objc.xcodeproj/xcuserdata/
examples/whisper.objc/whisper.objc.xcodeproj/project.xcworkspace/xcuserdata

extra/bench-gg.txt

models/*.mlmodel
models/*.mlmodelc
models/*.mlpackage
models/*-encoder-openvino.xml
models/*-encoder-openvino-cache/
bindings/java/.gradle/
bindings/java/.idea/
.idea/

benchmark_results.csv
cmake-build-debug/
.cxx/
.gradle/
local.properties
.log
.exe


================================================
FILE: AUTHORS
================================================
# date: Tue Feb  4 13:03:35 EET 2025
# this file is auto-generated by scripts/gen-authors.sh

0/0 <zero@imaskeleton.me>
0cc4m <picard12@live.de>
0xsourcecode <134374803+0xsourcecode@users.noreply.github.com>
65a <10104049+65a@users.noreply.github.com>
AIWintermuteAI <32562299+AIWintermuteAI@users.noreply.github.com>
AT <manyoso@users.noreply.github.com>
Aarni Koskela <akx@iki.fi>
Aaron Pham <29749331+aarnphm@users.noreply.github.com>
Aaron Taylor <aaron@exphat.com>
Abhilash Majumder <30946547+abhilash1910@users.noreply.github.com>
Abitofevrything <54505189+abitofevrything@users.noreply.github.com>
Adam Jones <domdomegg+git@gmail.com>
Adrien Gallouët <adrien@gallouet.fr>
Adrien Gallouët <angt@huggingface.co>
AfryMask <AfryMask@163.com>
Ahmad Bilal <ahmad.bilal@empglabs.com>
Ahmad Tameem <113388789+Tameem-10xE@users.noreply.github.com>
AidanBeltonS <87009434+AidanBeltonS@users.noreply.github.com>
AidanBeltonS <aidan.belton@codeplay.com>
Akarshan Biswas <akarshan.biswas@gmail.com>
Akarshan Biswas <akarshanbiswas@fedoraproject.org>
Akash Mahajan <akash7190@gmail.com>
Akash Mahajan <akashmjn@stanford.edu>
Al Hoang <3811822-hoanga@users.noreply.gitlab.com>
Alan <unknown>
Albert Jin <albert.jin@gmail.com>
Alberto Cabrera Pérez <alberto.cabrera@codeplay.com>
Alberto Cabrera Pérez <alberto.cabrera@intel.com>
Aleksander Andrzejewski <18704749+aleksanderandrzejewski@users.noreply.github.com>
Alex Azarov <alex@azarov.by>
Alex Bacart <13940752+alex-bacart@users.noreply.github.com>
Alex Evgrashin <aevgrashin@yandex.ru>
Alex O'Connell <35843486+acon96@users.noreply.github.com>
Alexandr Graschenkov <alexandr.graschenkov91@gmail.com>
Alexandru Mariuti <alex@mariuti.com>
Alexey Kharlamov <alexey@kharlamov.biz>
Alfredo Montesinos <alfredo.montesinos@g.austincc.edu>
Ali Alameh <ali.alameh@isae.edu.lb>
Alter <0x7c48@gmail.com>
Ananta Bastola <anantarajbastola@gmail.com>
Andreas Kieslinger <47689530+aendk@users.noreply.github.com>
Andreas Lubbe <git@lubbe.org>
Andreu Huguet <andreuhuguet@gmail.com>
Andrew Huynh <a5thuynh@gmail.com>
Andrew Minh Nguyen <40281306+amqdn@users.noreply.github.com>
Andrew S <andrews54757@gmail.com>
Andy Maloney <asmaloney@gmail.com>
Anton Kostin <masguit42@users.noreply.github.com>
Artyom Mezin <psycho.fading@gmail.com>
Asad Memon <asad.lionpk@gmail.com>
Ashraful Islam <ashraful.meche@gmail.com>
AsukaMinato <asukaminato@nyan.eu.org>
AustinMroz <austinmroz@utexas.edu>
Avik Sengupta <avik@sengupta.net>
Bader-eddine Ouaich <49657842+baderouaich@users.noreply.github.com>
Baffin Lee <baffinlee@gmail.com>
Ben Ashbaugh <ben.ashbaugh@intel.com>
Ben Nortier <bjnortier@gmail.com>
Benjamin Heiniger <benjamin.heiniger@bluewin.ch>
Bernhard M. Wiedemann <githubbmwprimary@lsmod.de>
Binozo <70137898+Binozo@users.noreply.github.com>
Bo-Yi Wu <appleboy.tw@gmail.com>
Boris Bliznioukov <blib@mail.com>
Borislav Stanimirov <b.stanimirov@abv.bg>
Brad Murray <59848399+bradmurray-dt@users.noreply.github.com>
Brian Murray <brian@bmurray.ca>
CRD716 <crd716@gmail.com>
Canis Lupus <Canis-UK@users.noreply.github.com>
Carlos Zoido <mrgalleta@gmail.com>
Carolinabanana <140120812+Carolinabanana@users.noreply.github.com>
CarterLi999 <664681047@qq.com>
ChangSeok Oh <shivamidow@users.noreply.github.com>
Changyeon Kim <cyzero.kim@samsung.com>
Chaoqun <27287694+OpenWaygate@users.noreply.github.com>
Charles Xu <63788048+chaxu01@users.noreply.github.com>
Charles Xu <charles.xu@arm.com>
Chen Xi <xi2.chen@intel.com>
Chen Xi <xixichen08@foxmail.com>
Chenguang Li <87689256+noemotiovon@users.noreply.github.com>
Chia-Hsiang Cheng <88014292+garychia@users.noreply.github.com>
Chidi Williams <williamschidi1@gmail.com>
Chris Elrod <elrodc@gmail.com>
Christian <12550267+iceychris@users.noreply.github.com>
Christian Kastner <ckk@kvr.at>
Clifford Heath <clifford.heath@gmail.com>
Clint Herron <hanclinto@gmail.com>
Colin <github@whoisc.cc>
Conrad Kramer <conrad@conradkramer.com>
Corey Earwood <iamcgn+github@gmail.com>
CrispStrobe <154636388+CrispStrobe@users.noreply.github.com>
DAN™ <dranger003@gmail.com>
DGdev91 <DGdev91@users.noreply.github.com>
Damian Czaja <trojan295@protonmail.com>
Dan Johansson <164997844+eddnjjn@users.noreply.github.com>
Dan Johansson <dan.johansson@arm.com>
Daniel Bevenius <daniel.bevenius@gmail.com>
Daniel Valdivia <18384552+dvaldivia@users.noreply.github.com>
Daniel Ziegenberg <daniel@ziegenberg.at>
Daniele <57776841+daniandtheweb@users.noreply.github.com>
Dave <dave-fl@users.noreply.github.com>
Dave Airlie <airlied@gmail.com>
Dave Airlie <airlied@redhat.com>
Daven Sanassy <daven@vochlea.co.uk>
David <dnhkng@gmail.com>
David Thorpe <djt@mutablelogic.com>
DavidKorczynski <david@adalogics.com>
Davidson Francis <davidsondfgl@gmail.com>
Dener Stassun <denerstassun@gmail.com>
Dibakar Gope <dibakar.gope@arm.com>
Didzis Gosko <didzis@users.noreply.github.com>
Diego Devesa <slarengh@gmail.com>
Digipom <admin@digipom.com>
Dimo <dimo@ieee.org>
Djip007 <3705339+Djip007@users.noreply.github.com>
Djip007 <djip.perois@free.fr>
Dody Suria Wijaya <dodysw@gmail.com>
Dou Xinpeng <15529241576@163.com>
Dou Xinpeng <81913537+Dou-Git@users.noreply.github.com>
Dr. Tom Murphy VII Ph.D <499244+tom7@users.noreply.github.com>
Duncan McConnell <ddmcconnell4@gmail.com>
Egor Egorov <me@egorfine.com>
Elkana Bardugo <ttv200@gmail.com>
Emmanuel Schmidbauer <eschmidbauer@gmail.com>
Engininja2 <139037756+Engininja2@users.noreply.github.com>
Eric Curtin <ericcurtin17@gmail.com>
Eric Swanson <eswanson@alloscomp.com>
Eric Tendian <erictendian@gmail.com>
Eric Zhang <34133756+EZForever@users.noreply.github.com>
Erik Scholz <Green-Sky@users.noreply.github.com>
Evan Jones <evan.q.jones@gmail.com>
Evan Martin <evan.martin@gmail.com>
Eve <139727413+netrunnereve@users.noreply.github.com>
Evgeny Kuznetsov <evgeny@kuznetsov.md>
F1L1P <78918286+F1L1Pv2@users.noreply.github.com>
Faisal Zaghloul <quic_fzaghlou@quicinc.com>
Fangjun Kuang <csukuangfj@gmail.com>
Felix <stenbackfelix@gmail.com>
Finn Voorhees <finnvoorhees@gmail.com>
FirstTimeEZ <179362031+FirstTimeEZ@users.noreply.github.com>
FlippFuzz <41221030+FlippFuzz@users.noreply.github.com>
Frankie Robertson <frankier@users.noreply.github.com>
Gang Chen <goncha@gmail.com>
Gavin Cai <gavin1818@hotmail.com>
George Hindle <george@georgehindle.com>
Georgi Gerganov <ggerganov@gmail.com>
Gilad S <7817232+giladgd@users.noreply.github.com>
Gilad S <giladgd@users.noreply.github.com>
Gilad S. <7817232+giladgd@users.noreply.github.com>
GitAritron <103900385+GitAritron@users.noreply.github.com>
GiviMAD <GiviMAD@users.noreply.github.com>
Gleicon Moraes <gleicon@gmail.com>
Gregor Jasny <gjasny@googlemail.com>
Guillaume Wenzek <gwenzek@users.noreply.github.com>
HY. Kelvin Lee <34256578+hykelvinlee42@users.noreply.github.com>
Halalaluyafail3 <55773281+Halalaluyafail3@users.noreply.github.com>
Hang <bebound@gmail.com>
Haus1 <haus.xda@gmail.com>
Herman Semenov <GermanAizek@yandex.ru>
HimariO <dsfhe49854@gmail.com>
Hong Bo PENG <penghb@cn.ibm.com>
Hrishikesh Barman <geekodour@users.noreply.github.com>
Hugo <hugo@whynothugo.nl>
Ian Bicking <ian@ianbicking.org>
Ian Bull <irbull@eclipsesource.com>
Ihar Hrachyshka <ihrachys@redhat.com>
Ikko Ashimine <eltociear@gmail.com>
Ikko Eltociear Ashimine <eltociear@gmail.com>
InconsolableCellist <23345188+InconsolableCellist@users.noreply.github.com>
Ismatulla Mansurov <47342870+sapoepsilon@users.noreply.github.com>
Ivan <nekotekina@gmail.com>
Ivan Filipov <159561759+vanaka11@users.noreply.github.com>
Ivan Gorin <ivangorin21@gmail.com>
Ivo von Putzer Reibegg <ivo.putzer@gmail.com>
JJ <103335846+computerscienceiscool@users.noreply.github.com>
Jack Mousseau <jmousseau@users.noreply.github.com>
JacobLinCool <jacoblincool@gmail.com>
Jakub Ráček <blizzcz@gmail.com>
Jared Van Bortel <jared@nomic.ai>
Jay Binks <jaybinks@gmail.com>
Jayant <jayantyadav202@gmail.com>
Jeff Bolz <jbolz@nvidia.com>
Jeroen Mostert <jeroen.mostert@cm.com>
Jhen-Jie Hong <developer@jhen.me>
Jhen-Jie Hong <iainst0409@gmail.com>
JidongZhang-THU <1119708529@qq.com>
Jo Liss <joliss42@gmail.com>
Joe Todd <joe.todd@codeplay.com>
Johan <jr.raffin@gmail.com>
Johannes Gäßler <johannesg@5d6.de>
John Balis <phobossystems@gmail.com>
JohnnyB <jboero@users.noreply.github.com>
Jonathan Soo <jcsoo@agora.com>
Jonno <1160532+razodactyl@users.noreply.github.com>
Joonas Pihlajamaa <joonas.pihlajamaa@iki.fi>
Jose <34888496+Jerry-Master@users.noreply.github.com>
Josh Bleecher Snyder <josharian@gmail.com>
Josscii <jossciiweiyi@gmail.com>
Judd <foldl@users.noreply.github.com>
Jumper775 <78500318+jumpers775@users.noreply.github.com>
Jun Hee Yoo <contact.jhyoo@gmail.com>
Junil Kim <logyourself@gmail.com>
Justina Cho <justcho5@gmail.com>
Justine Tunney <jtunney@gmail.com>
Justine Tunney <jtunney@mozilla.com>
KITAITI Makoto <KitaitiMakoto@gmail.com>
KP Kaiser <kirk@zothcorp.com>
Kamilake <exjang0@gmail.com>
Karol Kontny <82021046+kkontny@users.noreply.github.com>
Karthick <j.karthic2004@gmail.com>
Kartik Saranathan <278928+Kartiku@users.noreply.github.com>
Kasumi <90275229+kasumi-1@users.noreply.github.com>
Kawrakow <48489457+ikawrakow@users.noreply.github.com>
Kendrick Taylor <kendrick@circuitsix.com>
Kevin Brothaler <admin@digipom.com>
Kevin Gibbons <bakkot@gmail.com>
Konosuke Sakai <konosuke@konosuke.work>
Konstantin Zhuravlyov <konstantin.zhuravlyov@amd.com>
Kreijstal <rainb@tfwno.gf>
Kylin <56434533+KyL0N@users.noreply.github.com>
LBlue <153975653+lbluep@users.noreply.github.com>
Larry Battle <larry.battle.tech@gmail.com>
Laytan Laats <laytanlaats@hotmail.com>
Leo Moll <leo.moll@yeasoft.com>
Lexevolution <31176843+Lexevolution@users.noreply.github.com>
LittleLoli <26589867+WhichWho@users.noreply.github.com>
Lucas Zanek <57494138+LucasZNK@users.noreply.github.com>
Luis Herrera <herrera-luis@users.noreply.github.com>
Lukas Rist <glaslos@gmail.com>
M. A. Ali <73258591+MightyStud@users.noreply.github.com>
M. Eren Akbiyik <erenakbiyik@gmail.com>
Ma Mingfei <mingfei.ma@intel.com>
Maciek <maciek.mab122@gmail.com>
Mahesh Madhav <67384846+heshpdx@users.noreply.github.com>
Marcin Mielniczuk <marmistrz.dev@zoho.eu>
Mark Karpelès <MagicalTux@users.noreply.github.com>
Mark Zhuang <zhuangqiubin@gmail.com>
Markus Tavenrath <mtavenrath@users.noreply.github.com>
Martin Delille <martin@delille.org>
Martin Warnaar <martinwarnaar@gmail.com>
Masaya, Kato <62578291+msy-kato@users.noreply.github.com>
Matheus de Sousa <23645013+keyehzy@users.noreply.github.com>
Mathieu Baudier <mbaudier@argeo.org>
Mathijs de Bruin <mathijs@mathijsfietst.nl>
Matija Pevec <mightymatth@users.noreply.github.com>
Matt Stephenson <mstephenson6@users.noreply.github.com>
Max Krasnyansky <max.krasnyansky@gmail.com>
Max Krasnyansky <quic_maxk@quicinc.com>
Maximiliano Levi <8160966+maxilevi@users.noreply.github.com>
Meng, Hengyu <hengyu.meng@intel.com>
Mengqing Cao <cmq0113@163.com>
Michael Podvitskiy <podvitskiymichael@gmail.com>
Michael Rienstra <mrienstra@gmail.com>
Mikhail Grigorev <sleuthhound@gmail.com>
Mohammadreza Hendiani <hendiani.mohammadreza@gmail.com>
Mohit Agarwal <mohit@sdf.org>
Molly Sophia <mollysophia379@gmail.com>
Murilo Santana <mvrilo@gmail.com>
NETZkultur GmbH <mulholland@netzkultur.de>
Natsu <chino@hotococoa.moe>
Neil Chudleigh <nchudleigh@users.noreply.github.com>
Neo Zhang <14088817+arthw@users.noreply.github.com>
Neo Zhang Jianyu <jianyu.zhang@intel.com>
Neuman Vong <neuman.vong@gmail.com>
Nicholai Tukanov <nicholaitukanov@gmail.com>
Nicholas Albion <nalbion@yahoo.com>
Nico Bosshard <nico@bosshome.ch>
Nicolò Scipione <nicolo.scipione@codeplay.com>
Niels Mayer <Niels.Mayer@gmail.com>
Nikita Sarychev <42014488+sARY77@users.noreply.github.com>
Nikolaj Olsson <nikse.dk@gmail.com>
Okabintaro <103938900+Okabintaro@users.noreply.github.com>
Oleg Sidorov <me@whitebox.io>
Oleg Sidorov <oleg@sidorov.nl>
Olivier Chafik <ochafik@users.noreply.github.com>
Ondrej Kokes <ondrej.kokes@gmail.com>
Ouadie EL FAROUKI <ouadie.elfarouki@codeplay.com>
PAB <pierreantoine.bannier@gmail.com>
Paul Tsochantaris <ptsochantaris@icloud.com>
Pedro Probst <pprobst@insiberia.net>
Peng <hzp1024@qq.com>
Peter <peter277@users.noreply.github.com>
Philipp Zabel <philipp.zabel@gmail.com>
Philippe Normand <phil@base-art.net>
Philippe Normand <philn@igalia.com>
Plamen Minev <pacominev@gmail.com>
Prashant Vithule <119530321+Vithulep@users.noreply.github.com>
Przemysław Pawełczyk <przemoc@gmail.com>
Qianhe Chen <54462604+chenqianhe@users.noreply.github.com>
R0CKSTAR <xiaodong.ye@mthreads.com>
R0CKSTAR <yeahdongcn@gmail.com>
Radoslav Gerganov <rgerganov@gmail.com>
Radosław Gryta <radek.gryta@gmail.com>
Rahul Vadhyar <107788610+RahulVadhyar@users.noreply.github.com>
Raiya Araki <83504221+rai62@users.noreply.github.com>
Reinforce-II <fate@eastal.com>
Reinis Muiznieks <muiznieks.reinis@gmail.com>
RelatedTitle <r3latedtitle@gmail.com>
Rémy Oudompheng <oudomphe@phare.normalesup.org>
RhinoDevel <RhinoDevel@users.noreply.github.com>
Rich Jones <miserlou@gmail.com>
Robert Ormandi <52251610+ormandi@users.noreply.github.com>
Robin <robin.xw@hotmail.com>
Roddur Dasgupta <roddurd@gmail.com>
Roland Rabien <figbug@gmail.com>
Romain Biessy <romain.biessy@codeplay.com>
Ronsor <ronsor@ronsor.pw>
Rotem Dan <rotemdan@gmail.com>
Ryan Hitchman <hitchmanr@gmail.com>
Ryan Metcalfe <107415876+RyanMetcalfeInt8@users.noreply.github.com>
RyanChang <ftes90015@gmail.com>
SRHMorris <69468379+SRHMorris@users.noreply.github.com>
SXX <sxx1136965276@gmail.com>
Sacha Arbonel <sacha.arbonel@hotmail.fr>
Salman Faroz <stsfaroz@gmail.com>
Salvatore Mesoraca <s.mesoraca16@gmail.com>
Sam <49637763+Onlyartist9@users.noreply.github.com>
Sam Pullara <spullara@gmail.com>
Samuel Durante <44513615+samueldurantes@users.noreply.github.com>
Sanchit Gandhi <93869735+sanchit-gandhi@users.noreply.github.com>
Sandro Hanea <40202887+sandrohanea@users.noreply.github.com>
Sergio López <slp@redhat.com>
Sergio López <slp@sinrega.org>
Shanshan Shen <467638484@qq.com>
Shijie <821898965@qq.com>
Shupei Fan <dymarkfan@outlook.com>
Siddharth Ramakrishnan <srr2141@columbia.edu>
Sigbjørn Skjæret <sigbjorn.skjaeret@scala.com>
Simon Moisselin <simon.moisstoll@gmail.com>
Sindre Sorhus <sindresorhus@gmail.com>
Slava Primenko <primenko.s@gmail.com>
Srihari-mcw <96763064+Srihari-mcw@users.noreply.github.com>
Stavros Panakakis <53979866+Stavrospanakakis@users.noreply.github.com>
Stefan Sydow <s.sydow@heinlein-video.de>
Stefan Sydow <stefan@sydow.email>
Syahmi Azhar <prsyahmi@gmail.com>
Syed Jafri <syedjafri97@gmail.com>
Sơn Phan Trung <phantrungson17@gmail.com>
Taisei Mima <bhbstar.me@gmail.com>
Takeshi Inoue <inoue.takeshi@gmail.com>
Tamotsu Takahashi <ttakah+github@gmail.com>
Taras Glek <taras@thegp.com>
Tauseef Mohiuddin <35351464+tauseefmohammed2@users.noreply.github.com>
Thamster <Thamster@users.noreply.github.com>
Thijs Raymakers <thijs@raymakers.nl>
Thomas Fitzsimmons <fitzsim@fitzsim.org>
Tiago Fassoni <tiagofassoni@users.noreply.github.com>
Tienshiao Ma <tienshiao@tienshiao.org>
Tim Miller <drasticactions@users.noreply.github.com>
Timothy Cronin <40186632+4imothy@users.noreply.github.com>
Tobrun <tobrun.van.nuland@gmail.com>
Todd <taf2@users.noreply.github.com>
Toliver <teejae@gmail.com>
Tong Li <31761981+litongjava@users.noreply.github.com>
Tony Wasserka <4840017+neobrain@users.noreply.github.com>
Topping1 <78745143+Topping1@users.noreply.github.com>
Travis Cline <travis.cline@gmail.com>
UEXTM.com <84163508+uextm@users.noreply.github.com>
UsernamesLame <156965854+UsernamesLame@users.noreply.github.com>
Vadim Peretokin <vperetokin@hey.com>
Valentin Gosu <1454649+valenting@users.noreply.github.com>
Vin Misra <vinith@alum.mit.edu>
Vulcan <93451215+trholding@users.noreply.github.com>
WhiteOlivierus <36532695+WhiteOlivierus@users.noreply.github.com>
William Tambellini <william.tambellini@gmail.com>
William Tambellini <wtambellini@sdl.com>
Wilson Silva <wilson.dsigns@gmail.com>
Xiang (Kevin) Li <kevinli020508@gmail.com>
Xiao-Yong Jin <jinxiaoyong@gmail.com>
XiaotaoChen <chenxiaotao1234@gmail.com>
Xingchen Song(宋星辰) <xingchensong1996@163.com>
Xinpeng Dou <81913537+Dou-Git@users.noreply.github.com>
Xuan Son Nguyen <thichthat@gmail.com>
Yajing Tang <phillis@google.com>
Yang Shen <aplshenyang@gmail.com>
Yunès <jean.baptiste.yunes@free.fr>
Yuri Khrustalev <ykhrustalev@users.noreply.github.com>
Yusuf Redžić <48274562+redzic@users.noreply.github.com>
ZaBlazzingZephyrus <119159668+blazingzephyr@users.noreply.github.com>
Zhenwei Jin <109658203+kylo5aby@users.noreply.github.com>
Zhiyuan Li <lizhiyuan@uniartisan.com>
Zhiyuan Li <uniartisan2017@gmail.com>
Zigfrid Zvezdin <ziggerZZ@gmail.com>
Zollner <24618122+Zolliner@users.noreply.github.com>
a3sh <38979186+A3shTnT@users.noreply.github.com>
ag2s20150909 <19373730+ag2s20150909@users.noreply.github.com>
agray3 <agray3@users.noreply.github.com>
ai-at-home <149282006+ai-at-home@users.noreply.github.com>
aldorof <aldorof@users.noreply.github.com>
alonfaraj <alonfaraj@gmail.com>
amd-dwang <dong.wang@amd.com>
amritahs-ibm <amritahs@linux.vnet.ibm.com>
andypayne <apayne@gmail.com>
ardfork <134447697+ardfork@users.noreply.github.com>
arizhih <40765267+arizhih@users.noreply.github.com>
automaticcat <daogiatuank54@gmail.com>
bandoti <141645996+bandoti@users.noreply.github.com>
be-next <jerome.ramette@gmail.com>
bert hubert <bert@hubertnet.nl>
billyct <billy_allen@126.com>
bmwl <brian.marshall@tolko.com>
bobqianic <129547291+bobqianic@users.noreply.github.com>
bocytko <bocytko+github@gmail.com>
boolemancer <48014766+boolemancer@users.noreply.github.com>
boolemancer <boolemancer@gmail.com>
bradmit <151883577+bradmit@users.noreply.github.com>
brunofaustino <b.fa.amorim@gmail.com>
bssrdf <merlintiger@hotmail.com>
byte-6174 <88070277+byte-6174@users.noreply.github.com>
cdosoftei <ciprian.dosoftei@gmail.com>
clach04 <Chris.Clark@actian.com>
compilade <113953597+compilade@users.noreply.github.com>
compilade <git@compilade.net>
conradg <conradjgodfrey@gmail.com>
crummyh <elijah@crums.us>
ddpasa <112642920+ddpasa@users.noreply.github.com>
denersc <denerstassun@gmail.com>
dscripka <dscripka@users.noreply.github.com>
duthils <duthils@duthils.net>
ecneladis <ecneladis@users.noreply.github.com>
faker <nspyia2002@gmail.com>
fitzsim <fitzsim@fitzsim.org>
fj-y-saito <85871716+fj-y-saito@users.noreply.github.com>
fraxy-v <65565042+fraxy-v@users.noreply.github.com>
genevera (she/her) <genevera@users.noreply.github.com>
geniusnut <geniusnut@gmail.com>
gilbertgong <gilbert.gong@gmail.com>
gn64 <yukikaze.jp@gmail.com>
goldwaving <77494627+goldwaving@users.noreply.github.com>
greeshmay <greeshmay@gmail.com>
haopeng <657407891@qq.com>
hipudding <huafengchun@gmail.com>
hsinhoyeh <yhh92u@gmail.com>
hydai <z54981220@gmail.com>
iamthad <thadeus.j.fleming@gmail.com>
issixx <46835150+issixx@users.noreply.github.com>
james wolf <contractorwolf@hotmail.com>
jdomke <28772296+jdomke@users.noreply.github.com>
jettoblack <jettoblack@gmail.com>
jiez <373447296@qq.com>
joecryptotoo <80373433+joecryptotoo@users.noreply.github.com>
jorismertz <35079666+jorismertz@users.noreply.github.com>
junchao-loongson <68935141+junchao-loongson@users.noreply.github.com>
junkfood <69683722+JunkFood02@users.noreply.github.com>
jwijffels <jwijffels@bnosac.be>
k.h.lai <adrian.k.h.lai@outlook.com>
kamranjon <kamranjon@gmail.com>
katsu560 <katsu560oo-@docomo.ne.jp>
kennethge <57784063+kenneth-ge@users.noreply.github.com>
keyehzy <msamuel@aluno.puc-rio.br>
kunnis <kunnis@users.noreply.github.com>
l3utterfly <gc.pthzfoldr@gmail.com>
leejet <leejet714@gmail.com>
leo-pony <nengjunma@outlook.com>
lhez <quic_lih@quicinc.com>
litong <31761981+litongjava@users.noreply.github.com>
liuwei-git <14815172+liuwei-git@users.noreply.github.com>
lnyan <lkwq007@gmail.com>
luoyu-intel <yu.luo@intel.com>
m.bell <m.bell@techsmith.com>
mahorozte <41834471+mahorozte@users.noreply.github.com>
mashizora <30516315+mashizora@users.noreply.github.com>
matt23654 <matthew.webber@protonmail.com>
matteo <matteogeniaccio@yahoo.it>
mgrachten <maarten@grachten.eu>
mkiol <mkiol@users.noreply.github.com>
mky_coder <47767389+mkycoder@users.noreply.github.com>
novag <7754358+novag@users.noreply.github.com>
pajowu <pajowu@pajowu.de>
pengxin99 <pengxin.yuan@intel.com>
petterreinholdtsen <pere-github@hungry.com>
polarmoon <90010972+polarmoon@users.noreply.github.com>
rlapray <lapray.romain@gmail.com>
sandrohanea <40202887+sandrohanea@users.noreply.github.com>
semiformal-net <84111142+semiformal-net@users.noreply.github.com>
shibukazu <61775791+shibukazu@users.noreply.github.com>
shikokuchuo <53399081+shikokuchuo@users.noreply.github.com>
slaren <slarengh@gmail.com>
slashlib <slashlib@users.noreply.github.com>
snadampal <87143774+snadampal@users.noreply.github.com>
someone13574 <81528246+someone13574@users.noreply.github.com>
st-gr <38470677+st-gr@users.noreply.github.com>
stduhpf <stephduh@live.fr>
stormofice <58337328+stormofice@users.noreply.github.com>
texmex76 <40733439+texmex76@users.noreply.github.com>
thefinaldegree <thefinaldegree@gmail.com>
thewh1teagle <61390950+thewh1teagle@users.noreply.github.com>
toboil-features <160222185+toboil-features@users.noreply.github.com>
trixirt <trix@redhat.com>
ulatekh <ulatekh@yahoo.com>
undef <undefdev@gmail.com>
uvos <devnull@uvos.xyz>
uvos <philipp@uvos.xyz>
valVk <valVk@users.noreply.github.com>
venkr <venkateshrameshkumar+1@gmail.com>
vicalloy <zbirder@gmail.com>
wangshuai09 <391746016@qq.com>
woachk <24752637+woachk@users.noreply.github.com>
xctan <axunlei@gmail.com>
xdrudis <xavierdrudis@yahoo.es>
yuri@FreeBSD <yuri@FreeBSD>
zhangjixiong <code.zjx@gmail.com>
zhentaoyu <zhentao.yu@intel.com>
zhouwg <6889919+zhouwg@users.noreply.github.com>
zhouwg <zhouwg2000@gmail.com>
谢乃闻 <sienaiwun@users.noreply.github.com>
布客飞龙 <562826179@qq.com>
Артём Земляк <azemlyak@smart-consulting.ru>


================================================
FILE: CMakeLists.txt
================================================
cmake_minimum_required(VERSION 3.5) # for add_link_options and implicit target directories.
project("whisper.cpp" C CXX)
project("whisper.cpp" VERSION 1.8.4)
include(CheckIncludeFileCXX)

set(SOVERSION 1)

#set(CMAKE_WARN_DEPRECATED YES)
set(CMAKE_WARN_UNUSED_CLI YES)

set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

if (NOT XCODE AND NOT MSVC AND NOT CMAKE_BUILD_TYPE)
    set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type" FORCE)
    set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
endif()

# Add path to modules
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/")

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)

if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
    set(WHISPER_STANDALONE ON)

    include(git-vars)

    # configure project version
    configure_file(${CMAKE_SOURCE_DIR}/bindings/javascript/package-tmpl.json ${CMAKE_SOURCE_DIR}/bindings/javascript/package.json @ONLY)
else()
    set(WHISPER_STANDALONE OFF)
endif()

if (EMSCRIPTEN)
    set(BUILD_SHARED_LIBS_DEFAULT OFF)

    set(CMAKE_CXX_STANDARD 17)
    set(CMAKE_CXX_STANDARD_REQUIRED ON)

    option(WHISPER_WASM_SINGLE_FILE "whisper: embed WASM inside the generated whisper.js" ON)

    # TODO: without these, we get the following error:
    #       wasm-ld: error: --shared-memory is disallowed by whisper.cpp.o because it was not compiled with 'atomics' or 'bulk-memory' features.
    set(CMAKE_C_FLAGS   "${CMAKE_C_FLAGS}   -pthread")
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")

    set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s TOTAL_STACK=5242880")
    set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -s TOTAL_STACK=5242880")

    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated")
else()
    if (MINGW)
        set(BUILD_SHARED_LIBS_DEFAULT OFF)
    else()
        set(BUILD_SHARED_LIBS_DEFAULT ON)
    endif()
endif()

option(BUILD_SHARED_LIBS "build shared libraries" ${BUILD_SHARED_LIBS_DEFAULT})

#
# option list
#

# debug
option(WHISPER_ALL_WARNINGS           "whisper: enable all compiler warnings"                   ON)
option(WHISPER_ALL_WARNINGS_3RD_PARTY "whisper: enable all compiler warnings in 3rd party libs" OFF)

# build
option(WHISPER_FATAL_WARNINGS  "whisper: enable -Werror flag"               OFF)
option(WHISPER_USE_SYSTEM_GGML "whisper: use system-installed GGML library" OFF)

# sanitizers
option(WHISPER_SANITIZE_THREAD    "whisper: enable thread sanitizer"    OFF)
option(WHISPER_SANITIZE_ADDRESS   "whisper: enable address sanitizer"   OFF)
option(WHISPER_SANITIZE_UNDEFINED "whisper: enable undefined sanitizer" OFF)

# extra artifacts
option(WHISPER_BUILD_TESTS    "whisper: build tests"          ${WHISPER_STANDALONE})
option(WHISPER_BUILD_EXAMPLES "whisper: build examples"       ${WHISPER_STANDALONE})
option(WHISPER_BUILD_SERVER   "whisper: build server example" ${WHISPER_STANDALONE})

# 3rd party libs
option(WHISPER_CURL "whisper: use libcurl to download model from an URL" OFF)
option(WHISPER_SDL2 "whisper: support for libSDL2" OFF)

if (CMAKE_SYSTEM_NAME MATCHES "Linux")
    option(WHISPER_FFMPEG "whisper: support building and linking with ffmpeg libs (avcodec, swresample, ...)" OFF)
endif()

option(WHISPER_COREML                "whisper: enable Core ML framework"  OFF)
option(WHISPER_COREML_ALLOW_FALLBACK "whisper: allow non-CoreML fallback" OFF)
option(WHISPER_OPENVINO              "whisper: support for OpenVINO"      OFF)

# Required for relocatable CMake package
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/build-info.cmake)

# override ggml options
set(GGML_SANITIZE_THREAD    ${WHISPER_SANITIZE_THREAD})
set(GGML_SANITIZE_ADDRESS   ${WHISPER_SANITIZE_ADDRESS})
set(GGML_SANITIZE_UNDEFINED ${WHISPER_SANITIZE_UNDEFINED})
set(GGML_ALL_WARNINGS       ${WHISPER_ALL_WARNINGS})
set(GGML_FATAL_WARNINGS     ${WHISPER_FATAL_WARNINGS})

# transition helpers
function (whisper_option_depr TYPE OLD NEW)
    if (${OLD})
        message(${TYPE} "${OLD} is deprecated and will be removed in the future.\nUse ${NEW} instead\n")
        set(${NEW} ON)
    endif()
endfunction()

whisper_option_depr(FATAL_ERROR WHISPER_CUBLAS              GGML_CUDA)
whisper_option_depr(WARNING     WHISPER_CUDA                GGML_CUDA)
whisper_option_depr(WARNING     WHISPER_KOMPUTE             GGML_KOMPUTE)
whisper_option_depr(WARNING     WHISPER_METAL               GGML_METAL)
whisper_option_depr(WARNING     WHISPER_METAL_EMBED_LIBRARY GGML_METAL_EMBED_LIBRARY)
whisper_option_depr(WARNING     WHISPER_NATIVE              GGML_NATIVE)
whisper_option_depr(WARNING     WHISPER_OPENMP              GGML_OPENMP)
whisper_option_depr(WARNING     WHISPER_RPC                 GGML_RPC)
whisper_option_depr(WARNING     WHISPER_SYCL                GGML_SYCL)
whisper_option_depr(WARNING     WHISPER_SYCL_F16            GGML_SYCL_F16)
whisper_option_depr(WARNING     WHISPER_CCACHE              GGML_CCACHE)

if (GGML_CUDA AND NOT MSVC)
    #GGML_CUDA enabled, add the necessary compile options -Wno-deprecated-gpu-targets
    add_compile_options(-Wno-deprecated-gpu-targets)
endif()

#
# build the library
#

if (NOT TARGET ggml)
    if (WHISPER_USE_SYSTEM_GGML)
        find_package(ggml REQUIRED)
        if (NOT ggml_FOUND)
            message(FATAL_ERROR "System-installed GGML library not found.")
        endif()
        add_library(ggml ALIAS ggml::ggml)
    else()
        add_subdirectory(ggml)
        if(WIN32)
            # The following adds a _DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR macro and is a workaround for
            # the Windows C++ standard library which does not support constexpr mutexes.
            # From the release notes://github.com/microsoft/STL/wiki/Changelog
            #  Disable constexpr mutex constructor on Windows
            #  Fixed mutex's constructor to be constexpr. #3824 #4000 #4339
            #  Note: Programs that aren't following the documented restrictions on binary compatibility may encounter
            #  null dereferences in mutex machinery. You must follow this rule:
            #  When you mix binaries built by different supported versions of the toolset, the Redistributable version
            #  must be at least as new as the latest toolset used by any app component.
            #  You can define _DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR as an escape hatch.
            #
            # Specifically to whisper.cpp this would cause a crash when using the Java bindings.
            # resulting in a Invalid memory access error.
            target_compile_definitions(ggml-base PRIVATE _DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR)
        endif()
    endif()
    # ... otherwise assume ggml is added by a parent CMakeLists.txt
endif()
add_subdirectory(src)

#
# install
#

include(GNUInstallDirs)
include(CMakePackageConfigHelpers)

set(WHISPER_BUILD_NUMBER        ${BUILD_NUMBER})
set(WHISPER_BUILD_COMMIT        ${BUILD_COMMIT})
set(WHISPER_INSTALL_VERSION     ${CMAKE_PROJECT_VERSION})

set(WHISPER_INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_INCLUDEDIR} CACHE PATH "Location of header  files")
set(WHISPER_LIB_INSTALL_DIR     ${CMAKE_INSTALL_LIBDIR}     CACHE PATH "Location of library files")
set(WHISPER_BIN_INSTALL_DIR     ${CMAKE_INSTALL_BINDIR}     CACHE PATH "Location of binary  files")

get_directory_property(WHISPER_TRANSIENT_DEFINES COMPILE_DEFINITIONS)

set_target_properties(whisper PROPERTIES PUBLIC_HEADER ${CMAKE_CURRENT_SOURCE_DIR}/include/whisper.h)
install(TARGETS whisper LIBRARY PUBLIC_HEADER)

target_compile_definitions(whisper PRIVATE
    WHISPER_VERSION="${PROJECT_VERSION}"
)

configure_package_config_file(
        ${CMAKE_CURRENT_SOURCE_DIR}/cmake/whisper-config.cmake.in
        ${CMAKE_CURRENT_BINARY_DIR}/whisper-config.cmake
    INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/whisper
    PATH_VARS
    WHISPER_INCLUDE_INSTALL_DIR
    WHISPER_LIB_INSTALL_DIR
    WHISPER_BIN_INSTALL_DIR )

write_basic_package_version_file(
    ${CMAKE_CURRENT_BINARY_DIR}/whisper-version.cmake
    VERSION ${WHISPER_INSTALL_VERSION}
    COMPATIBILITY SameMajorVersion)

install(FILES ${CMAKE_CURRENT_BINARY_DIR}/whisper-config.cmake
              ${CMAKE_CURRENT_BINARY_DIR}/whisper-version.cmake
        DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/whisper)

configure_file(cmake/whisper.pc.in
        "${CMAKE_CURRENT_BINARY_DIR}/whisper.pc"
        @ONLY)

install(FILES "${CMAKE_CURRENT_BINARY_DIR}/whisper.pc"
        DESTINATION lib/pkgconfig)

#
# programs, examples and tests
#

if (WHISPER_BUILD_TESTS AND NOT CMAKE_JS_VERSION)
    include(CTest)
    add_subdirectory(tests)
endif ()

if (WHISPER_BUILD_EXAMPLES)
    add_subdirectory(examples)
endif()

if (MSVC)
    set(MSVC_WARNING_FLAGS
        /wd4101  # Unreferenced local variable
        /wd4005  # Macro redefinition
        /wd4065  # switch statement contains 'default' but no 'case' labels
        /wd4267  # Conversion from 'size_t' to a smaller type, possible loss of data
        /wd4244  # Conversion from one type to another type, possible loss of ata
        /wd4805  # Unsafe mix of type
        /wd4305  # Truncation from 'type1' to 'type2' (often double to float)
        /wd4996  # Function or variable may be unsafe/deprecated
    )
    function(disable_msvc_warnings target_name)
        if(TARGET ${target_name})
            target_compile_options(${target_name} PRIVATE ${MSVC_WARNING_FLAGS})
        endif()
    endfunction()

    if (WHISPER_BUILD_EXAMPLES)
        disable_msvc_warnings(whisper)
        disable_msvc_warnings(common)
        disable_msvc_warnings(common-sdl)
        disable_msvc_warnings(lsp)
        disable_msvc_warnings(wchess-core)
        disable_msvc_warnings(whisper-command)
        disable_msvc_warnings(whisper-cli)
        disable_msvc_warnings(whisper-server)
        disable_msvc_warnings(whisper-stream)
        disable_msvc_warnings(whisper-talk-llama)
        disable_msvc_warnings(whisper-bench)
        disable_msvc_warnings(quantize)
        disable_msvc_warnings(vad-speech-segments)
    endif()
endif()


================================================
FILE: LICENSE
================================================
MIT License

Copyright (c) 2023-2026 The ggml authors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.


================================================
FILE: Makefile
================================================
#
# Audio samples
#

.PHONY: build
build:
	cmake -B build $(CMAKE_ARGS)
	cmake --build build --config Release

# download a few audio samples into folder "./samples":
.PHONY: samples
samples:
	@echo "Downloading samples..."
	@mkdir -p samples
	@wget --quiet --show-progress -O samples/gb0.ogg https://upload.wikimedia.org/wikipedia/commons/2/22/George_W._Bush%27s_weekly_radio_address_%28November_1%2C_2008%29.oga
	@wget --quiet --show-progress -O samples/gb1.ogg https://upload.wikimedia.org/wikipedia/commons/1/1f/George_W_Bush_Columbia_FINAL.ogg
	@wget --quiet --show-progress -O samples/hp0.ogg https://upload.wikimedia.org/wikipedia/en/d/d4/En.henryfphillips.ogg
	@wget --quiet --show-progress -O samples/mm1.wav https://cdn.openai.com/whisper/draft-20220913a/micro-machines.wav
	@wget --quiet --show-progress -O samples/a13.mp3 https://upload.wikimedia.org/wikipedia/commons/transcoded/6/6f/Apollo13-wehaveaproblem.ogg/Apollo13-wehaveaproblem.ogg.mp3
	@wget --quiet --show-progress -O samples/diffusion2023-07-03.flac https://archive.org/download/diffusion2023-07-03/diffusion2023-07-03.flac

#
# Models
#

# if not already downloaded, the following targets download the specified model and
# runs it on all samples in the folder "./samples":

.PHONY: tiny.en
.PHONY: tiny
.PHONY: base.en
.PHONY: base
.PHONY: small.en
.PHONY: small
.PHONY: medium.en
.PHONY: medium
.PHONY: large-v1
.PHONY: large-v2
.PHONY: large-v3
.PHONY: large-v3-turbo

tiny.en tiny base.en base small.en small medium.en medium large-v1 large-v2 large-v3 large-v3-turbo:
	bash ./models/download-ggml-model.sh $@
	cmake -B build $(CMAKE_ARGS)
	cmake --build build --config Release
	@echo ""
	@echo "==============================================="
	@echo "Running $@ on all samples in ./samples ..."
	@echo "==============================================="
	@echo ""
	@for f in samples/*.{flac,mp3,ogg,wav}; do \
		echo "----------------------------------------------" ; \
		echo "[+] Running $@ on $$f ... (run 'ffplay $$f' to listen)" ; \
		echo "----------------------------------------------" ; \
		echo "" ; \
		./build/bin/whisper-cli -m models/ggml-$@.bin -f $$f ; \
		echo "" ; \
	done


================================================
FILE: README.md
================================================
# whisper.cpp

![whisper.cpp](https://user-images.githubusercontent.com/1991296/235238348-05d0f6a4-da44-4900-a1de-d0707e75b763.jpeg)

[![Actions Status](https://github.com/ggml-org/whisper.cpp/workflows/CI/badge.svg)](https://github.com/ggml-org/whisper.cpp/actions)
[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](https://opensource.org/licenses/MIT)
[![Conan Center](https://shields.io/conan/v/whisper-cpp)](https://conan.io/center/whisper-cpp)
[![npm](https://img.shields.io/npm/v/whisper.cpp.svg)](https://www.npmjs.com/package/whisper.cpp/)

Stable: [v1.8.1](https://github.com/ggml-org/whisper.cpp/releases/tag/v1.8.1) / [Roadmap](https://github.com/orgs/ggml-org/projects/4/)

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

- Plain C/C++ implementation without dependencies
- Apple Silicon first-class citizen - optimized via ARM NEON, Accelerate framework, Metal and [Core ML](#core-ml-support)
- AVX intrinsics support for x86 architectures
- [VSX intrinsics support for POWER architectures](#power-vsx-intrinsics)
- Mixed F16 / F32 precision
- [Integer quantization support](#quantization)
- Zero memory allocations at runtime
- [Vulkan support](#vulkan-gpu-support)
- Support for CPU-only inference
- [Efficient GPU support for NVIDIA](#nvidia-gpu-support)
- [OpenVINO Support](#openvino-support)
- [Ascend NPU Support](#ascend-npu-support)
- [Moore Threads GPU Support](#moore-threads-gpu-support)
- [C-style API](https://github.com/ggml-org/whisper.cpp/blob/master/include/whisper.h)
- [Voice Activity Detection (VAD)](#voice-activity-detection-vad)

Supported platforms:

- [x] Mac OS (Intel and Arm)
- [x] [iOS](examples/whisper.objc)
- [x] [Android](examples/whisper.android)
- [x] [Java](bindings/java/README.md)
- [x] Linux / [FreeBSD](https://github.com/ggml-org/whisper.cpp/issues/56#issuecomment-1350920264)
- [x] [WebAssembly](examples/whisper.wasm)
- [x] Windows ([MSVC](https://github.com/ggml-org/whisper.cpp/blob/master/.github/workflows/build.yml#L117-L144) and [MinGW](https://github.com/ggml-org/whisper.cpp/issues/168))
- [x] [Raspberry Pi](https://github.com/ggml-org/whisper.cpp/discussions/166)
- [x] [Docker](https://github.com/ggml-org/whisper.cpp/pkgs/container/whisper.cpp)

The entire high-level implementation of the model is contained in [whisper.h](include/whisper.h) and [whisper.cpp](src/whisper.cpp).
The rest of the code is part of the [`ggml`](https://github.com/ggml-org/ggml) machine learning library.

Having such a lightweight implementation of the model allows to easily integrate it in different platforms and applications.
As an example, here is a video of running the model on an iPhone 13 device - fully offline, on-device: [whisper.objc](examples/whisper.objc)

https://user-images.githubusercontent.com/1991296/197385372-962a6dea-bca1-4d50-bf96-1d8c27b98c81.mp4

You can also easily make your own offline voice assistant application: [command](examples/command)

https://user-images.githubusercontent.com/1991296/204038393-2f846eae-c255-4099-a76d-5735c25c49da.mp4

On Apple Silicon, the inference runs fully on the GPU via Metal:

https://github.com/ggml-org/whisper.cpp/assets/1991296/c82e8f86-60dc-49f2-b048-d2fdbd6b5225

## Quick start

First clone the repository:

```bash
git clone https://github.com/ggml-org/whisper.cpp.git
```

Navigate into the directory:

```
cd whisper.cpp
```

Then, download one of the Whisper [models](models/README.md) converted in [`ggml` format](#ggml-format). For example:

```bash
sh ./models/download-ggml-model.sh base.en
```

Now build the [whisper-cli](examples/cli) example and transcribe an audio file like this:

```bash
# build the project
cmake -B build
cmake --build build -j --config Release

# transcribe an audio file
./build/bin/whisper-cli -f samples/jfk.wav
```

---

For a quick demo, simply run `make base.en`.

The command downloads the `base.en` model converted to custom `ggml` format and runs the inference on all `.wav` samples in the folder `samples`.

For detailed usage instructions, run: `./build/bin/whisper-cli -h`

Note that the [whisper-cli](examples/cli) example currently runs only with 16-bit WAV files, so make sure to convert your input before running the tool.
For example, you can use `ffmpeg` like this:

```bash
ffmpeg -i input.mp3 -ar 16000 -ac 1 -c:a pcm_s16le output.wav
```

## More audio samples

If you want some extra audio samples to play with, simply run:

```
make -j samples
```

This will download a few more audio files from Wikipedia and convert them to 16-bit WAV format via `ffmpeg`.

You can download and run the other models as follows:

```
make -j tiny.en
make -j tiny
make -j base.en
make -j base
make -j small.en
make -j small
make -j medium.en
make -j medium
make -j large-v1
make -j large-v2
make -j large-v3
make -j large-v3-turbo
```

## Memory usage

| Model  | Disk    | Mem     |
| ------ | ------- | ------- |
| tiny   | 75 MiB  | ~273 MB |
| base   | 142 MiB | ~388 MB |
| small  | 466 MiB | ~852 MB |
| medium | 1.5 GiB | ~2.1 GB |
| large  | 2.9 GiB | ~3.9 GB |

## POWER VSX Intrinsics

`whisper.cpp` supports POWER architectures and includes code which
significantly speeds operation on Linux running on POWER9/10, making it
capable of faster-than-realtime transcription on underclocked Raptor
Talos II. Ensure you have a BLAS package installed, and replace the
standard cmake setup with:

```bash
# build with GGML_BLAS defined
cmake -B build -DGGML_BLAS=1
cmake --build build -j --config Release
./build/bin/whisper-cli [ .. etc .. ]
```

## Quantization

`whisper.cpp` supports integer quantization of the Whisper `ggml` models.
Quantized models require less memory and disk space and depending on the hardware can be processed more efficiently.

Here are the steps for creating and using a quantized model:

```bash
# quantize a model with Q5_0 method
cmake -B build
cmake --build build -j --config Release
./build/bin/quantize models/ggml-base.en.bin models/ggml-base.en-q5_0.bin q5_0

# run the examples as usual, specifying the quantized model file
./build/bin/whisper-cli -m models/ggml-base.en-q5_0.bin ./samples/gb0.wav
```

## Core ML support

On Apple Silicon devices, the Encoder inference can be executed on the Apple Neural Engine (ANE) via Core ML. This can result in significant
speed-up - more than x3 faster compared with CPU-only execution. Here are the instructions for generating a Core ML model and using it with `whisper.cpp`:

- Install Python dependencies needed for the creation of the Core ML model:

  ```bash
  pip install ane_transformers
  pip install openai-whisper
  pip install coremltools
  ```

  - To ensure `coremltools` operates correctly, please confirm that [Xcode](https://developer.apple.com/xcode/) is installed and execute `xcode-select --install` to install the command-line tools.
  - Python 3.11 is recommended.
  - MacOS Sonoma (version 14) or newer is recommended, as older versions of MacOS might experience issues with transcription hallucination.
  - [OPTIONAL] It is recommended to utilize a Python version management system, such as [Miniconda](https://docs.conda.io/en/latest/miniconda.html) for this step:
    - To create an environment, use: `conda create -n py311-whisper python=3.11 -y`
    - To activate the environment, use: `conda activate py311-whisper`

- Generate a Core ML model. For example, to generate a `base.en` model, use:

  ```bash
  ./models/generate-coreml-model.sh base.en
  ```

  This will generate the folder `models/ggml-base.en-encoder.mlmodelc`

- Build `whisper.cpp` with Core ML support:

  ```bash
  # using CMake
  cmake -B build -DWHISPER_COREML=1
  cmake --build build -j --config Release
  ```

- Run the examples as usual. For example:

  ```text
  $ ./build/bin/whisper-cli -m models/ggml-base.en.bin -f samples/jfk.wav

  ...

  whisper_init_state: loading Core ML model from 'models/ggml-base.en-encoder.mlmodelc'
  whisper_init_state: first run on a device may take a while ...
  whisper_init_state: Core ML model loaded

  system_info: n_threads = 4 / 10 | AVX = 0 | AVX2 = 0 | AVX512 = 0 | FMA = 0 | NEON = 1 | ARM_FMA = 1 | F16C = 0 | FP16_VA = 1 | WASM_SIMD = 0 | BLAS = 1 | SSE3 = 0 | VSX = 0 | COREML = 1 |

  ...
  ```

  The first run on a device is slow, since the ANE service compiles the Core ML model to some device-specific format.
  Next runs are faster.

For more information about the Core ML implementation please refer to PR [#566](https://github.com/ggml-org/whisper.cpp/pull/566).

## OpenVINO support

On platforms that support [OpenVINO](https://github.com/openvinotoolkit/openvino), the Encoder inference can be executed
on OpenVINO-supported devices including x86 CPUs and Intel GPUs (integrated & discrete).

This can result in significant speedup in encoder performance. Here are the instructions for generating the OpenVINO model and using it with `whisper.cpp`:

- First, setup python virtual env. and install python dependencies. Python 3.10 is recommended.

  Windows:

  ```powershell
  cd models
  python -m venv openvino_conv_env
  openvino_conv_env\Scripts\activate
  python -m pip install --upgrade pip
  pip install -r requirements-openvino.txt
  ```

  Linux and macOS:

  ```bash
  cd models
  python3 -m venv openvino_conv_env
  source openvino_conv_env/bin/activate
  python -m pip install --upgrade pip
  pip install -r requirements-openvino.txt
  ```

- Generate an OpenVINO encoder model. For example, to generate a `base.en` model, use:

  ```
  python convert-whisper-to-openvino.py --model base.en
  ```

  This will produce ggml-base.en-encoder-openvino.xml/.bin IR model files. It's recommended to relocate these to the same folder as `ggml` models, as that
  is the default location that the OpenVINO extension will search at runtime.

- Build `whisper.cpp` with OpenVINO support:

  Download OpenVINO package from [release page](https://github.com/openvinotoolkit/openvino/releases). The recommended version to use is [2024.6.0](https://github.com/openvinotoolkit/openvino/releases/tag/2024.6.0). Ready to use Binaries of the required libraries can be found in the [OpenVino Archives](https://storage.openvinotoolkit.org/repositories/openvino/packages/2024.6/)

  After downloading & extracting package onto your development system, set up required environment by sourcing setupvars script. For example:

  Linux:

  ```bash
  source /path/to/l_openvino_toolkit_ubuntu22_2023.0.0.10926.b4452d56304_x86_64/setupvars.sh
  ```

  Windows (cmd):

  ```powershell
  C:\Path\To\w_openvino_toolkit_windows_2023.0.0.10926.b4452d56304_x86_64\setupvars.bat
  ```

  And then build the project using cmake:

  ```bash
  cmake -B build -DWHISPER_OPENVINO=1
  cmake --build build -j --config Release
  ```

- Run the examples as usual. For example:

  ```text
  $ ./build/bin/whisper-cli -m models/ggml-base.en.bin -f samples/jfk.wav

  ...

  whisper_ctx_init_openvino_encoder: loading OpenVINO model from 'models/ggml-base.en-encoder-openvino.xml'
  whisper_ctx_init_openvino_encoder: first run on a device may take a while ...
  whisper_openvino_init: path_model = models/ggml-base.en-encoder-openvino.xml, device = GPU, cache_dir = models/ggml-base.en-encoder-openvino-cache
  whisper_ctx_init_openvino_encoder: OpenVINO model loaded

  system_info: n_threads = 4 / 8 | AVX = 1 | AVX2 = 1 | AVX512 = 0 | FMA = 1 | NEON = 0 | ARM_FMA = 0 | F16C = 1 | FP16_VA = 0 | WASM_SIMD = 0 | BLAS = 0 | SSE3 = 1 | VSX = 0 | COREML = 0 | OPENVINO = 1 |

  ...
  ```

  The first time run on an OpenVINO device is slow, since the OpenVINO framework will compile the IR (Intermediate Representation) model to a device-specific 'blob'. This device-specific blob will get
  cached for the next run.

For more information about the OpenVINO implementation please refer to PR [#1037](https://github.com/ggml-org/whisper.cpp/pull/1037).

## NVIDIA GPU support

With NVIDIA cards the processing of the models is done efficiently on the GPU via cuBLAS and custom CUDA kernels.
First, make sure you have installed `cuda`: https://developer.nvidia.com/cuda-downloads

Now build `whisper.cpp` with CUDA support:

```
cmake -B build -DGGML_CUDA=1
cmake --build build -j --config Release
```

or for newer NVIDIA GPU's (RTX 5000 series):
```
cmake -B build -DGGML_CUDA=1 -DCMAKE_CUDA_ARCHITECTURES="86"
cmake --build build -j --config Release
```

## Vulkan GPU support
Cross-vendor solution which allows you to accelerate workload on your GPU.
First, make sure your graphics card driver provides support for Vulkan API.

Now build `whisper.cpp` with Vulkan support:
```
cmake -B build -DGGML_VULKAN=1
cmake --build build -j --config Release
```

## BLAS CPU support via OpenBLAS

Encoder processing can be accelerated on the CPU via OpenBLAS.
First, make sure you have installed `openblas`: https://www.openblas.net/

Now build `whisper.cpp` with OpenBLAS support:

```
cmake -B build -DGGML_BLAS=1
cmake --build build -j --config Release
```

## Ascend NPU support

Ascend NPU provides inference acceleration via [`CANN`](https://www.hiascend.com/en/software/cann) and AI cores.

First, check if your Ascend NPU device is supported:

**Verified devices**
| Ascend NPU                    | Status  |
|:-----------------------------:|:-------:|
| Atlas 300T A2                 | Support |
| Atlas 300I Duo                | Support |

Then, make sure you have installed [`CANN toolkit`](https://www.hiascend.com/en/software/cann/community) . The lasted version of CANN is recommanded.

Now build `whisper.cpp` with CANN support:

```
cmake -B build -DGGML_CANN=1
cmake --build build -j --config Release
```

Run the inference examples as usual, for example:

```
./build/bin/whisper-cli -f samples/jfk.wav -m models/ggml-base.en.bin -t 8
```

*Notes:*

- If you have trouble with Ascend NPU device, please create a issue with **[CANN]** prefix/tag.
- If you run successfully with your Ascend NPU device, please help update the table `Verified devices`.

## Moore Threads GPU support

With Moore Threads cards the processing of the models is done efficiently on the GPU via muBLAS and custom MUSA kernels.
First, make sure you have installed `MUSA SDK rc4.2.0`: https://developer.mthreads.com/sdk/download/musa?equipment=&os=&driverVersion=&version=4.2.0

Now build `whisper.cpp` with MUSA support:

```
cmake -B build -DGGML_MUSA=1
cmake --build build -j --config Release
```

or specify the architecture for your Moore Threads GPU. For example, if you have a MTT S80 GPU, you can specify the architecture as follows:

```
cmake -B build -DGGML_MUSA=1 -DMUSA_ARCHITECTURES="21"
cmake --build build -j --config Release
```

## FFmpeg support (Linux only)

If you want to support more audio formats (such as Opus and AAC), you can turn on the `WHISPER_FFMPEG` build flag to enable FFmpeg integration.

First, you need to install required libraries:

```bash
# Debian/Ubuntu
sudo apt install libavcodec-dev libavformat-dev libavutil-dev

# RHEL/Fedora
sudo dnf install libavcodec-free-devel libavformat-free-devel libavutil-free-devel
```

Then you can build the project as follows:

```bash
cmake -B build -D WHISPER_FFMPEG=yes
cmake --build build
```

Run the following example to confirm it's working:

```bash
# Convert an audio file to Opus format
ffmpeg -i samples/jfk.wav jfk.opus

# Transcribe the audio file
./build/bin/whisper-cli --model models/ggml-base.en.bin --file jfk.opus
```

## Docker

### Prerequisites

- Docker must be installed and running on your system.
- Create a folder to store big models & intermediate files (ex. /whisper/models)

### Images

We have multiple Docker images available for this project:

1. `ghcr.io/ggml-org/whisper.cpp:main`: This image includes the main executable file as well as `curl` and `ffmpeg`. (platforms: `linux/amd64`, `linux/arm64`)
2. `ghcr.io/ggml-org/whisper.cpp:main-cuda`: Same as `main` but compiled with CUDA support. (platforms: `linux/amd64`)
3. `ghcr.io/ggml-org/whisper.cpp:main-musa`: Same as `main` but compiled with MUSA support. (platforms: `linux/amd64`)
4. `ghcr.io/ggml-org/whisper.cpp:main-vulkan`: Same as `main` but compiled with Vulkan support. (platforms: `linux/amd64`)

### Usage

```shell
# download model and persist it in a local folder
docker run -it --rm \
  -v path/to/models:/models \
  whisper.cpp:main "./models/download-ggml-model.sh base /models"

# transcribe an audio file
docker run -it --rm \
  -v path/to/models:/models \
  -v path/to/audios:/audios \
  whisper.cpp:main "whisper-cli -m /models/ggml-base.bin -f /audios/jfk.wav"

# transcribe an audio file in samples folder
docker run -it --rm \
  -v path/to/models:/models \
  whisper.cpp:main "whisper-cli -m /models/ggml-base.bin -f ./samples/jfk.wav"

# run the web server
docker run -it --rm -p "8080:8080" \
  -v path/to/models:/models \
  whisper.cpp:main "whisper-server --host 127.0.0.1 -m /models/ggml-base.bin"
  
# run the bench too on the small.en model using 4 threads
docker run -it --rm \
  -v path/to/models:/models \
  whisper.cpp:main "whisper-bench -m /models/ggml-small.en.bin -t 4"
```

## Installing with Conan

You can install pre-built binaries for whisper.cpp or build it from source using [Conan](https://conan.io/). Use the following command:

```
conan install --requires="whisper-cpp/[*]" --build=missing
```

For detailed instructions on how to use Conan, please refer to the [Conan documentation](https://docs.conan.io/2/).

## Limitations

- Inference only

## Real-time audio input example

This is a naive example of performing real-time inference on audio from your microphone.
The [stream](examples/stream) tool samples the audio every half a second and runs the transcription continuously.
More info is available in [issue #10](https://github.com/ggml-org/whisper.cpp/issues/10).
You will need to have [sdl2](https://wiki.libsdl.org/SDL2/Installation) installed for it to work properly.

```bash
cmake -B build -DWHISPER_SDL2=ON
cmake --build build -j --config Release
./build/bin/whisper-stream -m ./models/ggml-base.en.bin -t 8 --step 500 --length 5000
```

https://user-images.githubusercontent.com/1991296/194935793-76afede7-cfa8-48d8-a80f-28ba83be7d09.mp4

## Confidence color-coding

Adding the `--print-colors` argument will print the transcribed text using an experimental color coding strategy
to highlight words with high or low confidence:

```bash
./build/bin/whisper-cli -m models/ggml-base.en.bin -f samples/gb0.wav --print-colors
```

<img width="965" alt="image" src="https://user-images.githubusercontent.com/1991296/197356445-311c8643-9397-4e5e-b46e-0b4b4daa2530.png">

## Controlling the length of the generated text segments (experimental)

For example, to limit the line length to a maximum of 16 characters, simply add `-ml 16`:

```text
$ ./build/bin/whisper-cli -m ./models/ggml-base.en.bin -f ./samples/jfk.wav -ml 16

whisper_model_load: loading model from './models/ggml-base.en.bin'
...
system_info: n_threads = 4 / 10 | AVX2 = 0 | AVX512 = 0 | NEON = 1 | FP16_VA = 1 | WASM_SIMD = 0 | BLAS = 1 |

main: processing './samples/jfk.wav' (176000 samples, 11.0 sec), 4 threads, 1 processors, lang = en, task = transcribe, timestamps = 1 ...

[00:00:00.000 --> 00:00:00.850]   And so my
[00:00:00.850 --> 00:00:01.590]   fellow
[00:00:01.590 --> 00:00:04.140]   Americans, ask
[00:00:04.140 --> 00:00:05.660]   not what your
[00:00:05.660 --> 00:00:06.840]   country can do
[00:00:06.840 --> 00:00:08.430]   for you, ask
[00:00:08.430 --> 00:00:09.440]   what you can do
[00:00:09.440 --> 00:00:10.020]   for your
[00:00:10.020 --> 00:00:11.000]   country.
```

## Word-level timestamp (experimental)

The `--max-len` argument can be used to obtain word-level timestamps. Simply use `-ml 1`:

```text
$ ./build/bin/whisper-cli -m ./models/ggml-base.en.bin -f ./samples/jfk.wav -ml 1

whisper_model_load: loading model from './models/ggml-base.en.bin'
...
system_info: n_threads = 4 / 10 | AVX2 = 0 | AVX512 = 0 | NEON = 1 | FP16_VA = 1 | WASM_SIMD = 0 | BLAS = 1 |

main: processing './samples/jfk.wav' (176000 samples, 11.0 sec), 4 threads, 1 processors, lang = en, task = transcribe, timestamps = 1 ...

[00:00:00.000 --> 00:00:00.320]
[00:00:00.320 --> 00:00:00.370]   And
[00:00:00.370 --> 00:00:00.690]   so
[00:00:00.690 --> 00:00:00.850]   my
[00:00:00.850 --> 00:00:01.590]   fellow
[00:00:01.590 --> 00:00:02.850]   Americans
[00:00:02.850 --> 00:00:03.300]  ,
[00:00:03.300 --> 00:00:04.140]   ask
[00:00:04.140 --> 00:00:04.990]   not
[00:00:04.990 --> 00:00:05.410]   what
[00:00:05.410 --> 00:00:05.660]   your
[00:00:05.660 --> 00:00:06.260]   country
[00:00:06.260 --> 00:00:06.600]   can
[00:00:06.600 --> 00:00:06.840]   do
[00:00:06.840 --> 00:00:07.010]   for
[00:00:07.010 --> 00:00:08.170]   you
[00:00:08.170 --> 00:00:08.190]  ,
[00:00:08.190 --> 00:00:08.430]   ask
[00:00:08.430 --> 00:00:08.910]   what
[00:00:08.910 --> 00:00:09.040]   you
[00:00:09.040 --> 00:00:09.320]   can
[00:00:09.320 --> 00:00:09.440]   do
[00:00:09.440 --> 00:00:09.760]   for
[00:00:09.760 --> 00:00:10.020]   your
[00:00:10.020 --> 00:00:10.510]   country
[00:00:10.510 --> 00:00:11.000]  .
```

## Speaker segmentation via tinydiarize (experimental)

More information about this approach is available here: https://github.com/ggml-org/whisper.cpp/pull/1058

Sample usage:

```py
# download a tinydiarize compatible model
./models/download-ggml-model.sh small.en-tdrz

# run as usual, adding the "-tdrz" command-line argument
./build/bin/whisper-cli -f ./samples/a13.wav -m ./models/ggml-small.en-tdrz.bin -tdrz
...
main: processing './samples/a13.wav' (480000 samples, 30.0 sec), 4 threads, 1 processors, lang = en, task = transcribe, tdrz = 1, timestamps = 1 ...
...
[00:00:00.000 --> 00:00:03.800]   Okay Houston, we've had a problem here. [SPEAKER_TURN]
[00:00:03.800 --> 00:00:06.200]   This is Houston. Say again please. [SPEAKER_TURN]
[00:00:06.200 --> 00:00:08.260]   Uh Houston we've had a problem.
[00:00:08.260 --> 00:00:11.320]   We've had a main beam up on a volt. [SPEAKER_TURN]
[00:00:11.320 --> 00:00:13.820]   Roger main beam interval. [SPEAKER_TURN]
[00:00:13.820 --> 00:00:15.100]   Uh uh [SPEAKER_TURN]
[00:00:15.100 --> 00:00:18.020]   So okay stand, by thirteen we're looking at it. [SPEAKER_TURN]
[00:00:18.020 --> 00:00:25.740]   Okay uh right now uh Houston the uh voltage is uh is looking good um.
[00:00:27.620 --> 00:00:29.940]   And we had a a pretty large bank or so.
```

## Karaoke-style movie generation (experimental)

The [whisper-cli](examples/cli) example provides support for output of karaoke-style movies, where the
currently pronounced word is highlighted. Use the `-owts` argument and run the generated bash script.
This requires to have `ffmpeg` installed.

Here are a few _"typical"_ examples:

```bash
./build/bin/whisper-cli -m ./models/ggml-base.en.bin -f ./samples/jfk.wav -owts
source ./samples/jfk.wav.wts
ffplay ./samples/jfk.wav.mp4
```

https://user-images.githubusercontent.com/1991296/199337465-dbee4b5e-9aeb-48a3-b1c6-323ac4db5b2c.mp4

---

```bash
./build/bin/whisper-cli -m ./models/ggml-base.en.bin -f ./samples/mm0.wav -owts
source ./samples/mm0.wav.wts
ffplay ./samples/mm0.wav.mp4
```

https://user-images.githubusercontent.com/1991296/199337504-cc8fd233-0cb7-4920-95f9-4227de3570aa.mp4

---

```bash
./build/bin/whisper-cli -m ./models/ggml-base.en.bin -f ./samples/gb0.wav -owts
source ./samples/gb0.wav.wts
ffplay ./samples/gb0.wav.mp4
```

https://user-images.githubusercontent.com/1991296/199337538-b7b0c7a3-2753-4a88-a0cd-f28a317987ba.mp4

---

## Video comparison of different models

Use the [scripts/bench-wts.sh](https://github.com/ggml-org/whisper.cpp/blob/master/scripts/bench-wts.sh) script to generate a video in the following format:

```bash
./scripts/bench-wts.sh samples/jfk.wav
ffplay ./samples/jfk.wav.all.mp4
```

https://user-images.githubusercontent.com/1991296/223206245-2d36d903-cf8e-4f09-8c3b-eb9f9c39d6fc.mp4

---

## Benchmarks

In order to have an objective comparison of the performance of the inference across different system configurations,
use the [whisper-bench](examples/bench) tool. The tool simply runs the Encoder part of the model and prints how much time it
took to execute it. The results are summarized in the following Github issue:

[Benchmark results](https://github.com/ggml-org/whisper.cpp/issues/89)

Additionally a script to run whisper.cpp with different models and audio files is provided [bench.py](scripts/bench.py).

You can run it with the following command, by default it will run against any standard model in the models folder.

```bash
python3 scripts/bench.py -f samples/jfk.wav -t 2,4,8 -p 1,2
```

It is written in python with the intention of being easy to modify and extend for your benchmarking use case.

It outputs a csv file with the results of the benchmarking.

## `ggml` format

The original models are converted to a custom binary format. This allows to pack everything needed into a single file:

- model parameters
- mel filters
- vocabulary
- weights

You can download the converted models using the [models/download-ggml-model.sh](models/download-ggml-model.sh) script
or manually from here:

- https://huggingface.co/ggerganov/whisper.cpp

For more details, see the conversion script [models/convert-pt-to-ggml.py](models/convert-pt-to-ggml.py) or [models/README.md](models/README.md).

## [Bindings](https://github.com/ggml-org/whisper.cpp/discussions/categories/bindings)

- [x] Rust: [tazz4843/whisper-rs](https://github.com/tazz4843/whisper-rs) | [#310](https://github.com/ggml-org/whisper.cpp/discussions/310)
- [x] JavaScript: [bindings/javascript](bindings/javascript) | [#309](https://github.com/ggml-org/whisper.cpp/discussions/309)
  - React Native (iOS / Android): [whisper.rn](https://github.com/mybigday/whisper.rn)
- [x] Go: [bindings/go](bindings/go) | [#312](https://github.com/ggml-org/whisper.cpp/discussions/312)
- [x] Java:
  - [GiviMAD/whisper-jni](https://github.com/GiviMAD/whisper-jni)
- [x] Ruby: [bindings/ruby](bindings/ruby) | [#507](https://github.com/ggml-org/whisper.cpp/discussions/507)
- [x] Objective-C / Swift: [ggml-org/whisper.spm](https://github.com/ggml-org/whisper.spm) | [#313](https://github.com/ggml-org/whisper.cpp/discussions/313)
  - [exPHAT/SwiftWhisper](https://github.com/exPHAT/SwiftWhisper)
- [x] .NET: | [#422](https://github.com/ggml-org/whisper.cpp/discussions/422)
  - [sandrohanea/whisper.net](https://github.com/sandrohanea/whisper.net)
  - [NickDarvey/whisper](https://github.com/NickDarvey/whisper)
- [x] Python: | [#9](https://github.com/ggml-org/whisper.cpp/issues/9)
  - [stlukey/whispercpp.py](https://github.com/stlukey/whispercpp.py) (Cython)
  - [AIWintermuteAI/whispercpp](https://github.com/AIWintermuteAI/whispercpp) (Updated fork of aarnphm/whispercpp)
  - [aarnphm/whispercpp](https://github.com/aarnphm/whispercpp) (Pybind11)
  - [abdeladim-s/pywhispercpp](https://github.com/abdeladim-s/pywhispercpp) (Pybind11)
- [x] R: [bnosac/audio.whisper](https://github.com/bnosac/audio.whisper)
- [x] Unity: [macoron/whisper.unity](https://github.com/Macoron/whisper.unity)

## XCFramework
The XCFramework is a precompiled version of the library for iOS, visionOS, tvOS,
and macOS. It can be used in Swift projects without the need to compile the
library from source. For example, the v1.7.5 version of the XCFramework can be
used as follows:

```swift
// swift-tools-version: 5.10
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
    name: "Whisper",
    targets: [
        .executableTarget(
            name: "Whisper",
            dependencies: [
                "WhisperFramework"
            ]),
        .binaryTarget(
            name: "WhisperFramework",
            url: "https://github.com/ggml-org/whisper.cpp/releases/download/v1.7.5/whisper-v1.7.5-xcframework.zip",
            checksum: "c7faeb328620d6012e130f3d705c51a6ea6c995605f2df50f6e1ad68c59c6c4a"
        )
    ]
)
```

## Voice Activity Detection (VAD)
Support for Voice Activity Detection (VAD) can be enabled using the `--vad`
argument to `whisper-cli`. In addition to this option a VAD model is also
required.

The way this works is that first the audio samples are passed through
the VAD model which will detect speech segments. Using this information,
only the speech segments that are detected are extracted from the original audio
input and passed to whisper for processing. This reduces the amount of audio
data that needs to be processed by whisper and can significantly speed up the
transcription process.

The following VAD models are currently supported:

### Silero-VAD
[Silero-vad](https://github.com/snakers4/silero-vad) is a lightweight VAD model
written in Python that is fast and accurate.

Models can be downloaded by running the following command on Linux or MacOS:
```console
$ ./models/download-vad-model.sh silero-v6.2.0
Downloading ggml model silero-v6.2.0 from 'https://huggingface.co/ggml-org/whisper-vad' ...
ggml-silero-v6.2.0.bin        100%[==============================================>] 864.35K  --.-KB/s    in 0.04s
Done! Model 'silero-v6.2.0' saved in '/path/models/ggml-silero-v6.2.0.bin'
You can now use it like this:

  $ ./build/bin/whisper-cli -vm /path/models/ggml-silero-v6.2.0.bin --vad -f samples/jfk.wav -m models/ggml-base.en.bin

```
And the following command on Windows:
```console
> .\models\download-vad-model.cmd silero-v6.2.0
Downloading vad model silero-v6.2.0...
Done! Model silero-v6.2.0 saved in C:\Users\danie\work\ai\whisper.cpp\ggml-silero-v6.2.0.bin
You can now use it like this:

C:\path\build\bin\Release\whisper-cli.exe -vm C:\path\ggml-silero-v6.2.0.bin --vad -m models/ggml-base.en.bin -f samples\jfk.wav

```

To see a list of all available models, run the above commands without any
arguments.

This model can be also be converted manually to ggml using the following command:
```console
$ python3 -m venv venv && source venv/bin/activate
$ (venv) pip install silero-vad
$ (venv) $ python models/convert-silero-vad-to-ggml.py --output models/silero.bin
Saving GGML Silero-VAD model to models/silero-v6.2.0-ggml.bin
```
And it can then be used with whisper as follows:
```console
$ ./build/bin/whisper-cli \
   --file ./samples/jfk.wav \
   --model ./models/ggml-base.en.bin \
   --vad \
   --vad-model ./models/silero-v6.2.0-ggml.bin
```

### VAD Options

* --vad-threshold: Threshold probability for speech detection. A probability
for a speech segment/frame above this threshold will be considered as speech.

* --vad-min-speech-duration-ms: Minimum speech duration in milliseconds. Speech
segments shorter than this value will be discarded to filter out brief noise or
false positives.

* --vad-min-silence-duration-ms: Minimum silence duration in milliseconds. Silence
periods must be at least this long to end a speech segment. Shorter silence
periods will be ignored and included as part of the speech.

* --vad-max-speech-duration-s: Maximum speech duration in seconds. Speech segments
longer than this will be automatically split into multiple segments at silence
points exceeding 98ms to prevent excessively long segments.

* --vad-speech-pad-ms: Speech padding in milliseconds. Adds this amount of padding
before and after each detected speech segment to avoid cutting off speech edges.

* --vad-samples-overlap: Amount of audio to extend from each speech segment into
the next one, in seconds (e.g., 0.10 = 100ms overlap). This ensures speech isn't
cut off abruptly between segments when they're concatenated together.

## Examples

There are various examples of using the library for different projects in the [examples](examples) folder.
Some of the examples are even ported to run in the browser using WebAssembly. Check them out!

| Example                                             | Web                                   | Description                                                                                                                     |
| --------------------------------------------------- | ------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
| [whisper-cli](examples/cli)                         | [whisper.wasm](examples/whisper.wasm) | Tool for translating and transcribing audio using Whisper                                                                       |
| [whisper-bench](examples/bench)                     | [bench.wasm](examples/bench.wasm)     | Benchmark the performance of Whisper on your machine                                                                            |
| [whisper-stream](examples/stream)                   | [stream.wasm](examples/stream.wasm)   | Real-time transcription of raw microphone capture                                                                               |
| [whisper-command](examples/command)                 | [command.wasm](examples/command.wasm) | Basic voice assistant example for receiving voice commands from the mic                                                         |
| [whisper-server](examples/server)                   |                                       | HTTP transcription server with OAI-like API                                                                                     |
| [whisper-talk-llama](examples/talk-llama)           |                                       | Talk with a LLaMA bot                                                                                                           |
| [whisper.objc](examples/whisper.objc)               |                                       | iOS mobile application using whisper.cpp                                                                                        |
| [whisper.swiftui](examples/whisper.swiftui)         |                                       | SwiftUI iOS / macOS application using whisper.cpp                                                                               |
| [whisper.android](examples/whisper.android)         |                                       | Android mobile application using whisper.cpp                                                                                    |
| [whisper.nvim](examples/whisper.nvim)               |                                       | Speech-to-text plugin for Neovim                                                                                                |
| [generate-karaoke.sh](examples/generate-karaoke.sh) |                                       | Helper script to easily [generate a karaoke video](https://youtu.be/uj7hVta4blM) of raw audio capture                           |
| [livestream.sh](examples/livestream.sh)             |                                       | [Livestream audio transcription](https://github.com/ggml-org/whisper.cpp/issues/185)                                            |
| [yt-wsp.sh](examples/yt-wsp.sh)                     |                                       | Download + transcribe and/or translate any VOD [(original)](https://gist.github.com/DaniruKun/96f763ec1a037cc92fe1a059b643b818) |
| [wchess](examples/wchess)                           | [wchess.wasm](examples/wchess)        | Voice-controlled chess                                                                                                          |

## [Discussions](https://github.com/ggml-org/whisper.cpp/discussions)

If you have any kind of feedback about this project feel free to use the Discussions section and open a new topic.
You can use the [Show and tell](https://github.com/ggml-org/whisper.cpp/discussions/categories/show-and-tell) category
to share your own projects that use `whisper.cpp`. If you have a question, make sure to check the
[Frequently asked questions (#126)](https://github.com/ggml-org/whisper.cpp/discussions/126) discussion.


================================================
FILE: README_sycl.md
================================================
# whisper.cpp for SYCL

[Background](#background)

[OS](#os)

[Intel GPU](#intel-gpu)

[Linux](#linux)

[Environment Variable](#environment-variable)

[Known Issue](#known-issue)

[Todo](#todo)

## Background

SYCL is a higher-level programming model to improve programming productivity on various hardware accelerators—such as CPUs, GPUs, and FPGAs. It is a single-source embedded domain-specific language based on pure C++17.

oneAPI is a specification that is open and standards-based, supporting multiple architecture types including but not limited to GPU, CPU, and FPGA. The spec has both direct programming and API-based programming paradigms.

Intel uses the SYCL as direct programming language to support CPU, GPUs and FPGAs.

To avoid  re-inventing the wheel, this code refers other code paths in llama.cpp (like OpenBLAS, cuBLAS, CLBlast). We use a open-source tool [SYCLomatic](https://github.com/oneapi-src/SYCLomatic) (Commercial release [Intel® DPC++ Compatibility Tool](https://www.intel.com/content/www/us/en/developer/tools/oneapi/dpc-compatibility-tool.html)) migrate to SYCL.

The whisper.cpp for SYCL is used to support Intel GPUs.

For Intel CPU, recommend to use whisper.cpp for X86 (Intel MKL build).

## OS

|OS|Status|Verified|
|-|-|-|
|Linux|Support|Ubuntu 22.04|
|Windows|Ongoing| |


## Intel GPU

|Intel GPU| Status | Verified Model|
|-|-|-|
|Intel Data Center Max Series| Support| Max 1550|
|Intel Data Center Flex Series| Support| Flex 170|
|Intel Arc Series| Support| Arc 770|
|Intel built-in Arc GPU| Support| built-in Arc GPU in Meteor Lake|
|Intel iGPU| Support| iGPU in i5-1250P, i7-1165G7|


## Linux

### Setup Environment

1. Install Intel GPU driver.

a. Please install Intel GPU driver by official guide: [Install GPU Drivers](https://dgpu-docs.intel.com/driver/installation.html).

Note: for iGPU, please install the client GPU driver.

b. Add user to group: video, render.

```
sudo usermod -aG render username
sudo usermod -aG video username
```

Note: re-login to enable it.

c. Check

```
sudo apt install clinfo
sudo clinfo -l
```

Output (example):

```
Platform #0: Intel(R) OpenCL Graphics
 `-- Device #0: Intel(R) Arc(TM) A770 Graphics


Platform #0: Intel(R) OpenCL HD Graphics
 `-- Device #0: Intel(R) Iris(R) Xe Graphics [0x9a49]
```

2. Install Intel® oneAPI Base toolkit.


a. Please follow the procedure in [Get the Intel® oneAPI Base Toolkit ](https://www.intel.com/content/www/us/en/developer/tools/oneapi/base-toolkit.html).

Recommend to install to default folder: **/opt/intel/oneapi**.

Following guide use the default folder as example. If you use other folder, please modify the following guide info with your folder.

b. Check

```
source /opt/intel/oneapi/setvars.sh

sycl-ls
```

There should be one or more level-zero devices. Like **[ext_oneapi_level_zero:gpu:0]**.

Output (example):
```
[opencl:acc:0] Intel(R) FPGA Emulation Platform for OpenCL(TM), Intel(R) FPGA Emulation Device OpenCL 1.2  [2023.16.10.0.17_160000]
[opencl:cpu:1] Intel(R) OpenCL, 13th Gen Intel(R) Core(TM) i7-13700K OpenCL 3.0 (Build 0) [2023.16.10.0.17_160000]
[opencl:gpu:2] Intel(R) OpenCL Graphics, Intel(R) Arc(TM) A770 Graphics OpenCL 3.0 NEO  [23.30.26918.50]
[ext_oneapi_level_zero:gpu:0] Intel(R) Level-Zero, Intel(R) Arc(TM) A770 Graphics 1.3 [1.3.26918]

```

2. Build locally:

```
mkdir -p build
cd build
source /opt/intel/oneapi/setvars.sh

#for FP16
#cmake .. -DWHISPER_SYCL=ON -DCMAKE_C_COMPILER=icx -DCMAKE_CXX_COMPILER=icpx -DWHISPER_SYCL_F16=ON 

#for FP32
cmake .. -DWHISPER_SYCL=ON -DCMAKE_C_COMPILER=icx -DCMAKE_CXX_COMPILER=icpx

#build example/main only
#cmake --build . --config Release --target main

#build all binary
cmake --build . --config Release -v

```

or

```
./examples/sycl/build.sh
```

Note:

- By default, it will build for all binary files. It will take more time. To reduce the time, we recommend to build for **example/main** only.

### Run

1. Put model file to folder **models**

2. Enable oneAPI running environment

```
source /opt/intel/oneapi/setvars.sh
```

3. List device ID

Run without parameter:

```
./build/bin/ls-sycl-device

or

./build/bin/main
```

Check the ID in startup log, like:

```
found 4 SYCL devices:
  Device 0: Intel(R) Arc(TM) A770 Graphics,	compute capability 1.3,
    max compute_units 512,	max work group size 1024,	max sub group size 32,	global mem size 16225243136
  Device 1: Intel(R) FPGA Emulation Device,	compute capability 1.2,
    max compute_units 24,	max work group size 67108864,	max sub group size 64,	global mem size 67065057280
  Device 2: 13th Gen Intel(R) Core(TM) i7-13700K,	compute capability 3.0,
    max compute_units 24,	max work group size 8192,	max sub group size 64,	global mem size 67065057280
  Device 3: Intel(R) Arc(TM) A770 Graphics,	compute capability 3.0,
    max compute_units 512,	max work group size 1024,	max sub group size 32,	global mem size 16225243136

```

|Attribute|Note|
|-|-|
|compute capability 1.3|Level-zero running time, recommended |
|compute capability 3.0|OpenCL running time, slower than level-zero in most cases|

4. Set device ID and execute whisper.cpp

Set device ID = 0 by **GGML_SYCL_DEVICE=0**

```
GGML_SYCL_DEVICE=0 ./build/bin/main -m models/ggml-base.en.bin -f samples/jfk.wav
```
or run by script:

```
./examples/sycl/run_whisper.sh
```



5. Check the device ID in output

Like:
```
Using device **0** (Intel(R) Arc(TM) A770 Graphics) as main device
```


## Environment Variable

#### Build

|Name|Value|Function|
|-|-|-|
|WHISPER_SYCL|ON (mandatory)|Enable build with SYCL code path. <br>For FP32/FP16, WHISPER_SYCL=ON is mandatory.|
|WHISPER_SYCL_F16|ON (optional)|Enable FP16 build with SYCL code path.For FP32, do not set it.|
|CMAKE_C_COMPILER|icx|Use icx compiler for SYCL code path|
|CMAKE_CXX_COMPILER|icpx|use icpx for SYCL code path|

#### Running


|Name|Value|Function|
|-|-|-|
|GGML_SYCL_DEVICE|0 (default) or 1|Set the device id used. Check the device ids by default running output|
|GGML_SYCL_DEBUG|0 (default) or 1|Enable log function by macro: GGML_SYCL_DEBUG|

## Known Issue

- Error:  `error while loading shared libraries: libsycl.so.7: cannot open shared object file: No such file or directory`.

  Miss to enable oneAPI running environment.

  Install oneAPI base toolkit and enable it by: `source /opt/intel/oneapi/setvars.sh`.


- Hang during startup

  llama.cpp use mmap as default way to read model file and copy to GPU. In some system, memcpy will be abnormal and block.

  Solution: add **--no-mmap**.

## Todo

- Support to build in Windows.

- Support multiple cards.


================================================
FILE: bindings/CMakeLists.txt
================================================
if (EMSCRIPTEN)
    add_subdirectory(javascript)

    add_custom_command(
        OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/javascript/publish.log
        DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/javascript/whisper.js
        DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/javascript/libwhisper.worker.js
        DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/javascript/package.json
        WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/javascript
        COMMAND npm publish
        COMMAND touch publish.log
        COMMENT "Publishing npm module v${PROJECT_VERSION}"
        VERBATIM
        )

    add_custom_target(publish-npm
        DEPENDS javascript/publish.log
        )
endif()


================================================
FILE: bindings/go/.gitignore
================================================
build
models


================================================
FILE: bindings/go/LICENSE
================================================
MIT License

Copyright (c) 2022 David Thorpe

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.


================================================
FILE: bindings/go/Makefile
================================================
ifndef UNAME_S
UNAME_S := $(shell uname -s)
endif

ifndef UNAME_P
UNAME_P := $(shell uname -p)
endif

ifndef UNAME_M
UNAME_M := $(shell uname -m)
endif

GGML_METAL_PATH_RESOURCES := $(abspath ../..)
BUILD_DIR := build_go
MODELS_DIR := models
EXAMPLES_DIR := $(wildcard examples/*)
INCLUDE_PATH := $(abspath ../../include):$(abspath ../../ggml/include)
LIBRARY_PATH := $(abspath ../../${BUILD_DIR}/src):$(abspath ../../${BUILD_DIR}/ggml/src)

ifeq ($(GGML_CUDA),1)
	LIBRARY_PATH := $(LIBRARY_PATH):$(CUDA_PATH)/targets/$(UNAME_M)-linux/lib/
	BUILD_FLAGS := -ldflags "-extldflags '-lcudart -lcuda -lcublas'"
endif

ifeq ($(UNAME_S),Darwin)
	LIBRARY_PATH := $(LIBRARY_PATH):$(abspath ../../${BUILD_DIR}/ggml/src/ggml-blas):$(abspath ../../${BUILD_DIR}/ggml/src/ggml-metal)
	EXT_LDFLAGS := -framework Foundation -framework Metal -framework MetalKit -lggml-metal -lggml-blas
endif

all: clean whisper examples

whisper: mkdir
	cmake -S ../.. -B ../../${BUILD_DIR} \
		-DCMAKE_BUILD_TYPE=Release \
		-DBUILD_SHARED_LIBS=OFF
	cmake --build ../../${BUILD_DIR} --target whisper

test: model-small whisper modtidy
ifeq ($(UNAME_S),Darwin)
	@C_INCLUDE_PATH=${INCLUDE_PATH} LIBRARY_PATH=${LIBRARY_PATH} GGML_METAL_PATH_RESOURCES=${GGML_METAL_PATH_RESOURCES} go test -ldflags "-extldflags '$(EXT_LDFLAGS)'" -v .
	@C_INCLUDE_PATH=${INCLUDE_PATH} LIBRARY_PATH=${LIBRARY_PATH} GGML_METAL_PATH_RESOURCES=${GGML_METAL_PATH_RESOURCES} go test -ldflags "-extldflags '$(EXT_LDFLAGS)'" -v ./pkg/whisper/...
else
	@C_INCLUDE_PATH=${INCLUDE_PATH} LIBRARY_PATH=${LIBRARY_PATH} go test -v .
	@C_INCLUDE_PATH=${INCLUDE_PATH} LIBRARY_PATH=${LIBRARY_PATH} go test -v ./pkg/whisper/...
endif

examples: $(EXAMPLES_DIR)

model-small: mkdir examples/go-model-download
	@${BUILD_DIR}/go-model-download -out models ggml-small.en.bin

$(EXAMPLES_DIR): mkdir whisper modtidy
	@echo Build example $(notdir $@)
ifeq ($(UNAME_S),Darwin)
	@C_INCLUDE_PATH=${INCLUDE_PATH} LIBRARY_PATH=${LIBRARY_PATH} GGML_METAL_PATH_RESOURCES=${GGML_METAL_PATH_RESOURCES} go build ${BUILD_FLAGS} -ldflags "-extldflags '$(EXT_LDFLAGS)'" -o ${BUILD_DIR}/$(notdir $@) ./$@
else
	@C_INCLUDE_PATH=${INCLUDE_PATH} LIBRARY_PATH=${LIBRARY_PATH} go build ${BUILD_FLAGS} -o ${BUILD_DIR}/$(notdir $@) ./$@
endif

mkdir:
	@echo Mkdir ${BUILD_DIR}
	@install -d ${BUILD_DIR}
	@echo Mkdir ${MODELS_DIR}
	@install -d ${MODELS_DIR}

modtidy:
	@go mod tidy

clean:
	@echo Clean
	@rm -fr $(BUILD_DIR)
	@go clean


================================================
FILE: bindings/go/README.md
================================================
# Go bindings for Whisper

This package provides Go bindings for whisper.cpp. They have been tested on:

  * Darwin (OS X) 12.6 on x64_64
  * Debian Linux on arm64
  * Fedora Linux on x86_64

The "low level" bindings are in the `bindings/go` directory and there is a more
Go-style package in the `bindings/go/pkg/whisper` directory. The most simple usage
is as follows:

```go
import (
	"github.com/ggerganov/whisper.cpp/bindings/go/pkg/whisper"
)

func main() {
	var modelpath string // Path to the model
	var samples []float32 // Samples to process

	// Load the model
	model, err := whisper.New(modelpath)
	if err != nil {
		panic(err)
	}
	defer model.Close()

	// Process samples
	context, err := model.NewContext()
	if err != nil {
		panic(err)
	}
	if err := context.Process(samples, nil, nil, nil); err != nil {
		return err
	}

	// Print out the results
	for {
		segment, err := context.NextSegment()
		if err != nil {
			break
		}
		fmt.Printf("[%6s->%6s] %s\n", segment.Start, segment.End, segment.Text)
	}
}
```

## Building & Testing

In order to build, you need to have the Go compiler installed. You can get it from [here](https://golang.org/dl/). Run the tests with:

```bash
git clone https://github.com/ggml-org/whisper.cpp.git
cd whisper.cpp/bindings/go
make test
```

This will compile a static `libwhisper.a` in a `build` folder, download a model file, then run the tests. To build the examples:

```bash
make examples
```

To build using cuda support add `GGML_CUDA=1`:

```bash
GGML_CUDA=1 make examples
```

The examples are placed in the `build` directory. Once built, you can download all the models with the following command:

```bash
./build/go-model-download -out models
```

And you can then test a model against samples with the following command:

```bash
./build/go-whisper -model models/ggml-tiny.en.bin samples/jfk.wav
```

## Using the bindings

To use the bindings in your own software,

  1. Import `github.com/ggerganov/whisper.cpp/bindings/go/pkg/whisper` (or `github.com/ggerganov/whisper.cpp/bindings/go` into your package;
  2. Compile `libwhisper.a` (you can use `make whisper` in the `bindings/go` directory);
  3. Link your go binary against whisper by setting the environment variables `C_INCLUDE_PATH` and `LIBRARY_PATH`
     to point to the `whisper.h` file directory and `libwhisper.a` file directory respectively.

Look at the `Makefile` in the `bindings/go` directory for an example.

The API Documentation:

  * https://pkg.go.dev/github.com/ggerganov/whisper.cpp/bindings/go
  * https://pkg.go.dev/github.com/ggerganov/whisper.cpp/bindings/go/pkg/whisper

Getting help:

  * Follow the discussion for the go bindings [here](https://github.com/ggml-org/whisper.cpp/discussions/312)

## License

The license for the Go bindings is the same as the license for the rest of the whisper.cpp project, which is the MIT License. See the `LICENSE` file for more details.



================================================
FILE: bindings/go/doc.go
================================================
/*
github.com/ggml-org/whisper.cpp/bindings/go
provides a speech-to-text service bindings for the Go programming language.
*/
package whisper


================================================
FILE: bindings/go/examples/go-model-download/context.go
================================================
package main

import (
	"context"
	"os"
	"os/signal"
)

// ContextForSignal returns a context object which is cancelled when a signal
// is received. It returns nil if no signal parameter is provided
func ContextForSignal(signals ...os.Signal) context.Context {
    if len(signals) == 0 {
        return nil
    }

    ch := make(chan os.Signal, 1) // Buffered channel with space for 1 signal
    ctx, cancel := context.WithCancel(context.Background())

    // Send message on channel when signal received
    signal.Notify(ch, signals...)

    // When any signal is received, call cancel
    go func() {
        <-ch
        cancel()
    }()

    // Return success
    return ctx
}



================================================
FILE: bindings/go/examples/go-model-download/main.go
================================================
package main

import (
	"context"
	"flag"
	"fmt"
	"io"
	"net/http"
	"net/url"
	"os"
	"path/filepath"
	"strings"
	"syscall"
	"time"
)

///////////////////////////////////////////////////////////////////////////////
// CONSTANTS

const (
	srcUrl  = "https://huggingface.co/ggerganov/whisper.cpp/resolve/main/" // The location of the models
	srcExt  = ".bin"                                                       // Filename extension
	bufSize = 1024 * 64                                                    // Size of the buffer used for downloading the model
)

var (
	// The models which will be downloaded, if no model is specified as an argument
	modelNames = []string{
		"tiny", "tiny-q5_1", "tiny-q8_0",
		"tiny.en", "tiny.en-q5_1", "tiny.en-q8_0",
		"base", "base-q5_1", "base-q8_0",
		"base.en", "base.en-q5_1", "base.en-q8_0",
		"small", "small-q5_1", "small-q8_0",
		"small.en", "small.en-q5_1", "small.en-q8_0",
		"medium", "medium-q5_0", "medium-q8_0",
		"medium.en", "medium.en-q5_0", "medium.en-q8_0",
		"large-v1",
		"large-v2", "large-v2-q5_0", "large-v2-q8_0",
		"large-v3", "large-v3-q5_0",
		"large-v3-turbo", "large-v3-turbo-q5_0", "large-v3-turbo-q8_0",
	}
)

var (
	// The output folder. When not set, use current working directory.
	flagOut = flag.String("out", "", "Output folder")

	// HTTP timeout parameter - will timeout if takes longer than this to download a model
	flagTimeout = flag.Duration("timeout", 30*time.Minute, "HTTP timeout")

	// Quiet parameter - will not print progress if set
	flagQuiet = flag.Bool("quiet", false, "Quiet mode")
)

///////////////////////////////////////////////////////////////////////////////
// MAIN

func main() {
	flag.Usage = func() {
		name := filepath.Base(flag.CommandLine.Name())
		fmt.Fprintf(flag.CommandLine.Output(), `
			Usage: %s [options] [<model>...]

			Options:
  			-out string     Specify the output folder where models will be saved.
                  			Default: Current working directory.
  			-timeout duration Set the maximum duration for downloading a model.
            			      Example: 10m, 1h (default: 30m0s).
  			-quiet           Suppress all output except errors.

			Examples:
  			1. Download a specific model:
     			%s -out ./models tiny-q8_0

			  2. Download all models:
     			%s -out ./models

			`, name, name, name)

		flag.PrintDefaults()
	}
	flag.Parse()

	// Get output path
	out, err := GetOut()
	if err != nil {
		fmt.Fprintln(os.Stderr, "Error:", err)
		os.Exit(-1)
	}

	// Create context which quits on SIGINT or SIGQUIT
	ctx := ContextForSignal(os.Interrupt, syscall.SIGQUIT)

	// Progress filehandle
	progress := os.Stdout
	if *flagQuiet {
		progress, err = os.Open(os.DevNull)
		if err != nil {
			fmt.Fprintln(os.Stderr, "Error:", err)
			os.Exit(-1)
		}
		defer progress.Close()
	}

	// Download models - exit on error or interrupt
	for _, model := range GetModels() {
		url, err := URLForModel(model)
		if err != nil {
			fmt.Fprintln(os.Stderr, "Error:", err)
			continue
		} else if path, err := Download(ctx, progress, url, out); err == nil || err == io.EOF {
			continue
		} else if err == context.Canceled {
			os.Remove(path)
			fmt.Fprintln(progress, "\nInterrupted")
			break
		} else if err == context.DeadlineExceeded {
			os.Remove(path)
			fmt.Fprintln(progress, "Timeout downloading model")
			continue
		} else {
			os.Remove(path)
			fmt.Fprintln(os.Stderr, "Error:", err)
			break
		}
	}
}

///////////////////////////////////////////////////////////////////////////////
// PUBLIC METHODS

// GetOut returns the path to the output directory
func GetOut() (string, error) {
	if *flagOut == "" {
		return os.Getwd()
	}
	if info, err := os.Stat(*flagOut); err != nil {
		return "", err
	} else if !info.IsDir() {
		return "", fmt.Errorf("not a directory: %s", info.Name())
	} else {
		return *flagOut, nil
	}
}

// GetModels returns the list of models to download
func GetModels() []string {
	if flag.NArg() == 0 {
		fmt.Println("No model specified.")
		fmt.Println("Preparing to download all models...")

		// Calculate total download size
		fmt.Println("Calculating total download size...")
		totalSize, err := CalculateTotalDownloadSize(modelNames)
		if err != nil {
			fmt.Println("Error calculating download sizes:", err)
			os.Exit(1)
		}

		fmt.Println("View available models: https://huggingface.co/ggerganov/whisper.cpp/tree/main")
		fmt.Printf("Total download size: %.2f GB\n", float64(totalSize)/(1024*1024*1024))
		fmt.Println("Would you like to download all models? (y/N)")

		// Prompt for user input
		var response string
		fmt.Scanln(&response)
		if response != "y" && response != "Y" {
			fmt.Println("Aborting. Specify a model to download.")
			os.Exit(0)
		}

		return modelNames // Return all models if confirmed
	}
	return flag.Args() // Return specific models if arguments are provided
}

func CalculateTotalDownloadSize(models []string) (int64, error) {
	var totalSize int64
	client := http.Client{}

	for _, model := range models {
		modelURL, err := URLForModel(model)
		if err != nil {
			return 0, err
		}

		// Issue a HEAD request to get the file size
		req, err := http.NewRequest("HEAD", modelURL, nil)
		if err != nil {
			return 0, err
		}

		resp, err := client.Do(req)
		if err != nil {
			return 0, err
		}
		resp.Body.Close()

		if resp.StatusCode != http.StatusOK {
			fmt.Printf("Warning: Unable to fetch size for %s (HTTP %d)\n", model, resp.StatusCode)
			continue
		}

		size := resp.ContentLength
		totalSize += size
	}
	return totalSize, nil
}

// URLForModel returns the URL for the given model on huggingface.co
func URLForModel(model string) (string, error) {
	// Ensure "ggml-" prefix is added only once
	if !strings.HasPrefix(model, "ggml-") {
		model = "ggml-" + model
	}

	// Ensure ".bin" extension is added only once
	if filepath.Ext(model) != srcExt {
		model += srcExt
	}

	// Parse the base URL
	url, err := url.Parse(srcUrl)
	if err != nil {
		return "", err
	}

	// Ensure no trailing slash in the base URL
	url.Path = fmt.Sprintf("%s/%s", strings.TrimSuffix(url.Path, "/"), model)
	return url.String(), nil
}

// Download downloads the model from the given URL to the given output directory
func Download(ctx context.Context, p io.Writer, model, out string) (string, error) {
	// Create HTTP client
	client := http.Client{
		Timeout: *flagTimeout,
	}

	// Initiate the download
	req, err := http.NewRequest("GET", model, nil)
	if err != nil {
		return "", err
	}
	resp, err := client.Do(req)
	if err != nil {
		return "", err
	}
	defer resp.Body.Close()
	if resp.StatusCode != http.StatusOK {
		return "", fmt.Errorf("%s: %s", model, resp.Status)
	}

	// If output file exists and is the same size as the model, skip
	path := filepath.Join(out, filepath.Base(model))
	if info, err := os.Stat(path); err == nil && info.Size() == resp.ContentLength {
		fmt.Fprintln(p, "Skipping", model, "as it already exists")
		return "", nil
	}

	// Create file
	w, err := os.Create(path)
	if err != nil {
		return "", err
	}
	defer w.Close()

	// Report
	fmt.Fprintln(p, "Downloading", model, "to", out)

	// Progressively download the model
	data := make([]byte, bufSize)
	count, pct := int64(0), int64(0)
	ticker := time.NewTicker(5 * time.Second)
	for {
		select {
		case <-ctx.Done():
			// Cancelled, return error
			return path, ctx.Err()
		case <-ticker.C:
			pct = DownloadReport(p, pct, count, resp.ContentLength)
		default:
			// Read body
			n, err := resp.Body.Read(data)
			if n > 0 {
				if m, err := w.Write(data[:n]); err != nil {
					return path, err
				} else {
					count += int64(m)
				}
			}

			if err != nil {
				if err == io.EOF {
					DownloadReport(p, pct, count, resp.ContentLength)
					return path, nil
				}
				return path, err
			}
		}
	}
}

// Report periodically reports the download progress when percentage changes
func DownloadReport(w io.Writer, pct, count, total int64) int64 {
	pct_ := count * 100 / total
	if pct_ > pct {
		fmt.Fprintf(w, "  ...%d MB written (%d%%)\n", count/1e6, pct_)
	}
	return pct_
}


================================================
FILE: bindings/go/examples/go-whisper/color.go
================================================
package main

import "fmt"

///////////////////////////////////////////////////////////////////////////////
// CONSTANTS

const (
	Reset     = "\033[0m"
	RGBPrefix = "\033[38;5;" // followed by RGB values in decimal format separated by colons
	RGBSuffix = "m"
)

///////////////////////////////////////////////////////////////////////////////
// PUBLIC METHODS

// Colorize text with RGB values, from 0 to 23
func Colorize(text string, v int) string {
	// https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit
	// Grayscale colors are in the range 232-255
	return RGBPrefix + fmt.Sprint(v%24+232) + RGBSuffix + text + Reset
}


================================================
FILE: bindings/go/examples/go-whisper/flags.go
================================================
package main

import (
	"flag"
	"fmt"
	"strings"
	"time"

	// Packages
	whisper "github.com/ggerganov/whisper.cpp/bindings/go/pkg/whisper"
)

///////////////////////////////////////////////////////////////////////////////
// TYPES

type Flags struct {
	*flag.FlagSet
}

///////////////////////////////////////////////////////////////////////////////
// LIFECYCLE

func NewFlags(name string, args []string) (*Flags, error) {
	flags := &Flags{
		FlagSet: flag.NewFlagSet(name, flag.ContinueOnError),
	}

	// Register the command line arguments
	registerFlags(flags)

	// Parse command line
	if err := flags.Parse(args); err != nil {
		return nil, err
	}

	// Return success
	return flags, nil
}

///////////////////////////////////////////////////////////////////////////////
// PUBLIC METHODS

func (flags *Flags) GetModel() string {
	return flags.Lookup("model").Value.String()
}

func (flags *Flags) GetLanguage() string {
	return flags.Lookup("language").Value.String()
}

func (flags *Flags) IsTranslate() bool {
	return flags.Lookup("translate").Value.(flag.Getter).Get().(bool)
}

func (flags *Flags) GetOffset() time.Duration {
	return flags.Lookup("offset").Value.(flag.Getter).Get().(time.Duration)
}

func (flags *Flags) GetDuration() time.Duration {
	return flags.Lookup("duration").Value.(flag.Getter).Get().(time.Duration)
}

func (flags *Flags) GetThreads() uint {
	return flags.Lookup("threads").Value.(flag.Getter).Get().(uint)
}

func (flags *Flags) GetOut() string {
	return strings.ToLower(flags.Lookup("out").Value.String())
}

func (flags *Flags) IsTokens() bool {
	return flags.Lookup("tokens").Value.String() == "true"
}

func (flags *Flags) IsColorize() bool {
	return flags.Lookup("colorize").Value.String() == "true"
}

func (flags *Flags) GetMaxLen() uint {
	return flags.Lookup("max-len").Value.(flag.Getter).Get().(uint)
}

func (flags *Flags) GetMaxTokens() uint {
	return flags.Lookup("max-tokens").Value.(flag.Getter).Get().(uint)
}

func (flags *Flags) GetWordThreshold() float32 {
	return float32(flags.Lookup("word-thold").Value.(flag.Getter).Get().(float64))
}

func (flags *Flags) SetParams(context whisper.Context) error {
	if lang := flags.GetLanguage(); lang != "" && lang != "auto" {
		fmt.Fprintf(flags.Output(), "Setting language to %q\n", lang)
		if err := context.SetLanguage(lang); err != nil {
			return err
		}
	}
	if flags.IsTranslate() && context.IsMultilingual() {
		fmt.Fprintf(flags.Output(), "Setting translate to true\n")
		context.SetTranslate(true)
	}
	if offset := flags.GetOffset(); offset != 0 {
		fmt.Fprintf(flags.Output(), "Setting offset to %v\n", offset)
		context.SetOffset(offset)
	}
	if duration := flags.GetDuration(); duration != 0 {
		fmt.Fprintf(flags.Output(), "Setting duration to %v\n", duration)
		context.SetDuration(duration)
	}
	if threads := flags.GetThreads(); threads != 0 {
		fmt.Fprintf(flags.Output(), "Setting threads to %d\n", threads)
		context.SetThreads(threads)
	}
	if max_len := flags.GetMaxLen(); max_len != 0 {
		fmt.Fprintf(flags.Output(), "Setting max_segment_length to %d\n", max_len)
		context.SetMaxSegmentLength(max_len)
	}
	if max_tokens := flags.GetMaxTokens(); max_tokens != 0 {
		fmt.Fprintf(flags.Output(), "Setting max_tokens to %d\n", max_tokens)
		context.SetMaxTokensPerSegment(max_tokens)
	}
	if word_threshold := flags.GetWordThreshold(); word_threshold != 0 {
		fmt.Fprintf(flags.Output(), "Setting word_threshold to %f\n", word_threshold)
		context.SetTokenThreshold(word_threshold)
	}

	// Return success
	return nil
}

///////////////////////////////////////////////////////////////////////////////
// PRIVATE METHODS

func registerFlags(flag *Flags) {
	flag.String("model", "", "Path to the model file")
	flag.String("language", "", "Spoken language")
	flag.Bool("translate", false, "Translate from source language to english")
	flag.Duration("offset", 0, "Time offset")
	flag.Duration("duration", 0, "Duration of audio to process")
	flag.Uint("threads", 0, "Number of threads to use")
	flag.Uint("max-len", 0, "Maximum segment length in characters")
	flag.Uint("max-tokens", 0, "Maximum tokens per segment")
	flag.Float64("word-thold", 0, "Maximum segment score")
	flag.Bool("tokens", false, "Display tokens")
	flag.Bool("colorize", false, "Colorize tokens")
	flag.String("out", "", "Output format (srt, none or leave as empty string)")
}


================================================
FILE: bindings/go/examples/go-whisper/main.go
================================================
package main

import (
	"flag"
	"fmt"
	"os"
	"path/filepath"

	// Packages
	whisper "github.com/ggerganov/whisper.cpp/bindings/go/pkg/whisper"
)

func main() {
	flags, err := NewFlags(filepath.Base(os.Args[0]), os.Args[1:])
	if err == flag.ErrHelp {
		os.Exit(0)
	} else if err != nil {
		fmt.Fprintln(os.Stderr, err)
		os.Exit(1)
	} else if flags.GetModel() == "" {
		fmt.Fprintln(os.Stderr, "Use -model flag to specify which model file to use")
		os.Exit(1)
	} else if flags.NArg() == 0 {
		fmt.Fprintln(os.Stderr, "No input files specified")
		os.Exit(1)
	}

	// Load model
	model, err := whisper.New(flags.GetModel())
	if err != nil {
		fmt.Fprintln(os.Stderr, err)
		os.Exit(1)
	}
	defer model.Close()

	// Process files
	for _, filename := range flags.Args() {
		if err := Process(model, filename, flags); err != nil {
			fmt.Fprintln(os.Stderr, err)
			continue
		}
	}
}


================================================
FILE: bindings/go/examples/go-whisper/process.go
================================================
package main

import (
	"fmt"
	"io"
	"os"
	"time"

	// Package imports
	whisper "github.com/ggerganov/whisper.cpp/bindings/go/pkg/whisper"
	wav "github.com/go-audio/wav"
)

func Process(model whisper.Model, path string, flags *Flags) error {
	var data []float32

	// Create processing context
	context, err := model.NewContext()
	if err != nil {
		return err
	}

	// Set the parameters
	if err := flags.SetParams(context); err != nil {
		return err
	}

	fmt.Printf("\n%s\n", context.SystemInfo())

	// Open the file
	fmt.Fprintf(flags.Output(), "Loading %q\n", path)
	fh, err := os.Open(path)
	if err != nil {
		return err
	}
	defer fh.Close()

	// Decode the WAV file - load the full buffer
	dec := wav.NewDecoder(fh)
	if buf, err := dec.FullPCMBuffer(); err != nil {
		return err
	} else if dec.SampleRate != whisper.SampleRate {
		return fmt.Errorf("unsupported sample rate: %d", dec.SampleRate)
	} else if dec.NumChans != 1 {
		return fmt.Errorf("unsupported number of channels: %d", dec.NumChans)
	} else {
		data = buf.AsFloat32Buffer().Data
	}

	// Segment callback when -tokens is specified
	var cb whisper.SegmentCallback
	if flags.IsTokens() {
		cb = func(segment whisper.Segment) {
			fmt.Fprintf(flags.Output(), "%02d [%6s->%6s] ", segment.Num, segment.Start.Truncate(time.Millisecond), segment.End.Truncate(time.Millisecond))
			for _, token := range segment.Tokens {
				if flags.IsColorize() && context.IsText(token) {
					fmt.Fprint(flags.Output(), Colorize(token.Text, int(token.P*24.0)), " ")
				} else {
					fmt.Fprint(flags.Output(), token.Text, " ")
				}
			}
			fmt.Fprintln(flags.Output(), "")
			fmt.Fprintln(flags.Output(), "")
		}
	}

	// Process the data
	fmt.Fprintf(flags.Output(), "  ...processing %q\n", path)
	context.ResetTimings()
	if err := context.Process(data, nil, cb, nil); err != nil {
		return err
	}

	context.PrintTimings()

	// Print out the results
	switch {
	case flags.GetOut() == "srt":
		return OutputSRT(os.Stdout, context)
	case flags.GetOut() == "none":
		return nil
	default:
		return Output(os.Stdout, context, flags.IsColorize())
	}
}

// Output text as SRT file
func OutputSRT(w io.Writer, context whisper.Context) error {
	n := 1
	for {
		segment, err := context.NextSegment()
		if err == io.EOF {
			return nil
		} else if err != nil {
			return err
		}
		fmt.Fprintln(w, n)
		fmt.Fprintln(w, srtTimestamp(segment.Start), " --> ", srtTimestamp(segment.End))
		fmt.Fprintln(w, segment.Text)
		fmt.Fprintln(w, "")
		n++
	}
}

// Output text to terminal
func Output(w io.Writer, context whisper.Context, colorize bool) error {
	for {
		segment, err := context.NextSegment()
		if err == io.EOF {
			return nil
		} else if err != nil {
			return err
		}
		fmt.Fprintf(w, "[%6s->%6s]", segment.Start.Truncate(time.Millisecond), segment.End.Truncate(time.Millisecond))
		if colorize {
			for _, token := range segment.Tokens {
				if !context.IsText(token) {
					continue
				}
				fmt.Fprint(w, " ", Colorize(token.Text, int(token.P*24.0)))
			}
			fmt.Fprint(w, "\n")
		} else {
			fmt.Fprintln(w, " ", segment.Text)
		}
	}
}

// Return srtTimestamp
func srtTimestamp(t time.Duration) string {
	return fmt.Sprintf("%02d:%02d:%02d,%03d", t/time.Hour, (t%time.Hour)/time.Minute, (t%time.Minute)/time.Second, (t%time.Second)/time.Millisecond)
}


================================================
FILE: bindings/go/go.mod
================================================
module github.com/ggerganov/whisper.cpp/bindings/go

go 1.23

require (
	github.com/go-audio/wav v1.1.0
	github.com/stretchr/testify v1.9.0
)

require (
	github.com/davecgh/go-spew v1.1.1 // indirect
	github.com/go-audio/audio v1.0.0 // indirect
	github.com/go-audio/riff v1.0.0 // indirect
	github.com/pmezard/go-difflib v1.0.0 // indirect
	gopkg.in/yaml.v3 v3.0.1 // indirect
)


================================================
FILE: bindings/go/go.sum
================================================
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/go-audio/audio v1.0.0 h1:zS9vebldgbQqktK4H0lUqWrG8P0NxCJVqcj7ZpNnwd4=
github.com/go-audio/audio v1.0.0/go.mod h1:6uAu0+H2lHkwdGsAY+j2wHPNPpPoeg5AaEFh9FlA+Zs=
github.com/go-audio/riff v1.0.0 h1:d8iCGbDvox9BfLagY94fBynxSPHO80LmZCaOsmKxokA=
github.com/go-audio/riff v1.0.0/go.mod h1:l3cQwc85y79NQFCRB7TiPoNiaijp6q8Z0Uv38rVG498=
github.com/go-audio/wav v1.1.0 h1:jQgLtbqBzY7G+BM8fXF7AHUk1uHUviWS4X39d5rsL2g=
github.com/go-audio/wav v1.1.0/go.mod h1:mpe9qfwbScEbkd8uybLuIpTgHyrISw/OTuvjUW2iGtE=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=


================================================
FILE: bindings/go/params.go
================================================
package whisper

import (
	"fmt"
)

///////////////////////////////////////////////////////////////////////////////
// CGO

/*
#include <whisper.h>
*/
import "C"

///////////////////////////////////////////////////////////////////////////////
// PUBLIC METHODS

func (p *Params) SetTranslate(v bool) {
	p.translate = toBool(v)
}

func (p *Params) SetSplitOnWord(v bool) {
	p.split_on_word = toBool(v)
}

func (p *Params) SetNoContext(v bool) {
	p.no_context = toBool(v)
}

func (p *Params) SetSingleSegment(v bool) {
	p.single_segment = toBool(v)
}

func (p *Params) SetPrintSpecial(v bool) {
	p.print_special = toBool(v)
}

func (p *Params) SetPrintProgress(v bool) {
	p.print_progress = toBool(v)
}

func (p *Params) SetPrintRealtime(v bool) {
	p.print_realtime = toBool(v)
}

func (p *Params) SetPrintTimestamps(v bool) {
	p.print_timestamps = toBool(v)
}

// Voice Activity Detection (VAD)
func (p *Params) SetVAD(v bool) {
	p.vad = toBool(v)
}

func (p *Params) SetVADModelPath(path string) {
	p.vad_model_path = C.CString(path)
}

func (p *Params) SetVADThreshold(t float32) {
	p.vad_params.threshold = C.float(t)
}

func (p *Params) SetVADMinSpeechMs(ms int) {
	p.vad_params.min_speech_duration_ms = C.int(ms)
}

func (p *Params) SetVADMinSilenceMs(ms int) {
	p.vad_params.min_silence_duration_ms = C.int(ms)
}

func (p *Params) SetVADMaxSpeechSec(s float32) {
	p.vad_params.max_speech_duration_s = C.float(s)
}

func (p *Params) SetVADSpeechPadMs(ms int) {
	p.vad_params.speech_pad_ms = C.int(ms)
}

func (p *Params) SetVADSamplesOverlap(sec float32) {
	p.vad_params.samples_overlap = C.float(sec)
}

// Set language id
func (p *Params) SetLanguage(lang int) error {
	if lang == -1 {
		p.language = nil
		return nil
	}
	str := C.whisper_lang_str(C.int(lang))
	if str == nil {
		return ErrInvalidLanguage
	} else {
		p.language = str
	}
	return nil
}

// Get language id
func (p *Params) Language() int {
	if p.language == nil {
		return -1
	}
	return int(C.whisper_lang_id(p.language))
}

// Threads available
func (p *Params) Threads() int {
	return int(p.n_threads)
}

// Set number of threads to use
func (p *Params) SetThreads(threads int) {
	p.n_threads = C.int(threads)
}

// Set start offset in ms
func (p *Params) SetOffset(offset_ms int) {
	p.offset_ms = C.int(offset_ms)
}

// Set audio duration to process in ms
func (p *Params) SetDuration(duration_ms int) {
	p.duration_ms = C.int(duration_ms)
}

// Set timestamp token probability threshold (~0.01)
func (p *Params) SetTokenThreshold(t float32) {
	p.thold_pt = C.float(t)
}

// Set timestamp token sum probability threshold (~0.01)
func (p *Params) SetTokenSumThreshold(t float32) {
	p.thold_ptsum = C.float(t)
}

// Set max segment length in characters
func (p *Params) SetMaxSegmentLength(n int) {
	p.max_len = C.int(n)
}

func (p *Params) SetTokenTimestamps(b bool) {
	p.token_timestamps = toBool(b)
}

// Set max tokens per segment (0 = no limit)
func (p *Params) SetMaxTokensPerSegment(n int) {
	p.max_tokens = C.int(n)
}

// Set audio encoder context
func (p *Params) SetAudioCtx(n int) {
	p.audio_ctx = C.int(n)
}

func (p *Params) SetMaxContext(n int) {
	p.n_max_text_ctx = C.int(n)
}

func (p *Params) SetBeamSize(n int) {
	p.beam_search.beam_size = C.int(n)
}

func (p *Params) SetEntropyThold(t float32) {
	p.entropy_thold = C.float(t)
}

func (p *Params) SetTemperature(t float32) {
	p.temperature = C.float(t)
}

// Sets the fallback temperature incrementation
// Pass -1.0 to disable this feature
func (p *Params) SetTemperatureFallback(t float32) {
	p.temperature_inc = C.float(t)
}

// Set initial prompt
func (p *Params) SetInitialPrompt(prompt string) {
	p.initial_prompt = C.CString(prompt)
}

func (p *Params) SetCarryInitialPrompt(v bool) {
	p.carry_initial_prompt = toBool(v)
}

///////////////////////////////////////////////////////////////////////////////
// PRIVATE METHODS

func toBool(v bool) C.bool {
	if v {
		return C.bool(true)
	}
	return C.bool(false)
}

///////////////////////////////////////////////////////////////////////////////
// STRINGIFY

func (p *Params) String() string {
	str := "<whisper.params"
	str += fmt.Sprintf(" strategy=%v", p.strategy)
	str += fmt.Sprintf(" n_threads=%d", p.n_threads)
	if p.language != nil {
		str += fmt.Sprintf(" language=%s", C.GoString(p.language))
	}
	str += fmt.Sprintf(" n_max_text_ctx=%d", p.n_max_text_ctx)
	str += fmt.Sprintf(" offset_ms=%d", p.offset_ms)
	str += fmt.Sprintf(" duration_ms=%d", p.duration_ms)
	str += fmt.Sprintf(" audio_ctx=%d", p.audio_ctx)
	str += fmt.Sprintf(" initial_prompt=%s", C.GoString(p.initial_prompt))
	str += fmt.Sprintf(" entropy_thold=%f", p.entropy_thold)
	str += fmt.Sprintf(" temperature=%f", p.temperature)
	str += fmt.Sprintf(" temperature_inc=%f", p.temperature_inc)
	str += fmt.Sprintf(" beam_size=%d", p.beam_search.beam_size)
	if p.translate {
		str += " translate"
	}
	if p.no_context {
		str += " no_context"
	}
	if p.single_segment {
		str += " single_segment"
	}
	if p.print_special {
		str += " print_special"
	}
	if p.print_progress {
		str += " print_progress"
	}
	if p.print_realtime {
		str += " print_realtime"
	}
	if p.print_timestamps {
		str += " print_timestamps"
	}
	if p.token_timestamps {
		str += " token_timestamps"
	}
	if p.carry_initial_prompt {
		str += " carry_initial_prompt"
	}

	return str + ">"
}


================================================
FILE: bindings/go/pkg/whisper/consts.go
================================================
package whisper

import (
	"errors"

	// Bindings
	whisper "github.com/ggerganov/whisper.cpp/bindings/go"
)

///////////////////////////////////////////////////////////////////////////////
// ERRORS

var (
	ErrUnableToLoadModel    = errors.New("unable to load model")
	ErrInternalAppError     = errors.New("internal application error")
	ErrProcessingFailed     = errors.New("processing failed")
	ErrUnsupportedLanguage  = errors.New("unsupported language")
	ErrModelNotMultilingual = errors.New("model is not multilingual")
)

///////////////////////////////////////////////////////////////////////////////
// CONSTANTS

// SampleRate is the sample rate of the audio data.
const SampleRate = whisper.SampleRate

// SampleBits is the number of bytes per sample.
const SampleBits = whisper.SampleBits


================================================
FILE: bindings/go/pkg/whisper/context.go
================================================
package whisper

import (
	"fmt"
	"io"
	"runtime"
	"strings"
	"time"

	// Bindings
	whisper "github.com/ggerganov/whisper.cpp/bindings/go"
)

///////////////////////////////////////////////////////////////////////////////
// TYPES

type context struct {
	n      int
	model  *model
	params whisper.Params
}

// Make sure context adheres to the interface
var _ Context = (*context)(nil)

///////////////////////////////////////////////////////////////////////////////
// LIFECYCLE

func newContext(model *model, params whisper.Params) (Context, error) {
	context := new(context)
	context.model = model
	context.params = params

	// Return success
	return context, nil
}

///////////////////////////////////////////////////////////////////////////////
// PUBLIC METHODS

// Set the language to use for speech recognition.
func (context *context) SetLanguage(lang string) error {
	if context.model.ctx == nil {
		return ErrInternalAppError
	}
	if !context.model.IsMultilingual() {
		return ErrModelNotMultilingual
	}

	if lang == "auto" {
		context.params.SetLanguage(-1)
	} else if id := context.model.ctx.Whisper_lang_id(lang); id < 0 {
		return ErrUnsupportedLanguage
	} else if err := context.params.SetLanguage(id); err != nil {
		return err
	}
	// Return success
	return nil
}

func (context *context) IsMultilingual() bool {
	return context.model.IsMultilingual()
}

// Get language
func (context *context) Language() string {
	id := context.params.Language()
	if id == -1 {
		return "auto"
	}
	return whisper.Whisper_lang_str(context.params.Language())
}

func (context *context) DetectedLanguage() string {
	return whisper.Whisper_lang_str(context.model.ctx.Whisper_full_lang_id())
}

// Set translate flag
func (context *context) SetTranslate(v bool) {
	context.params.SetTranslate(v)
}

// Voice Activity Detection (VAD)
func (context *context) SetVAD(v bool) {
	context.params.SetVAD(v)
}

func (context *context) SetVADModelPath(path string) {
	context.params.SetVADModelPath(path)
}

func (context *context) SetVADThreshold(t float32) {
	context.params.SetVADThreshold(t)
}

func (context *context) SetVADMinSpeechMs(ms int) {
	context.params.SetVADMinSpeechMs(ms)
}

func (context *context) SetVADMinSilenceMs(ms int) {
	context.params.SetVADMinSilenceMs(ms)
}

func (context *context) SetVADMaxSpeechSec(s float32) {
	context.params.SetVADMaxSpeechSec(s)
}

func (context *context) SetVADSpeechPadMs(ms int) {
	context.params.SetVADSpeechPadMs(ms)
}

func (context *context) SetVADSamplesOverlap(sec float32) {
	context.params.SetVADSamplesOverlap(sec)
}

func (context *context) SetSplitOnWord(v bool) {
	context.params.SetSplitOnWord(v)
}

// Set number of threads to use
func (context *context) SetThreads(v uint) {
	context.params.SetThreads(int(v))
}

// Set time offset
func (context *context) SetOffset(v time.Duration) {
	context.params.SetOffset(int(v.Milliseconds()))
}

// Set duration of audio to process
func (context *context) SetDuration(v time.Duration) {
	context.params.SetDuration(int(v.Milliseconds()))
}

// Set timestamp token probability threshold (~0.01)
func (context *context) SetTokenThreshold(t float32) {
	context.params.SetTokenThreshold(t)
}

// Set timestamp token sum probability threshold (~0.01)
func (context *context) SetTokenSumThreshold(t float32) {
	context.params.SetTokenSumThreshold(t)
}

// Set max segment length in characters
func (context *context) SetMaxSegmentLength(n uint) {
	context.params.SetMaxSegmentLength(int(n))
}

// Set token timestamps flag
func (context *context) SetTokenTimestamps(b bool) {
	context.params.SetTokenTimestamps(b)
}

// Set max tokens per segment (0 = no limit)
func (context *context) SetMaxTokensPerSegment(n uint) {
	context.params.SetMaxTokensPerSegment(int(n))
}

// Set audio encoder context
func (context *context) SetAudioCtx(n uint) {
	context.params.SetAudioCtx(int(n))
}

// Set maximum number of text context tokens to store
func (context *context) SetMaxContext(n int) {
	context.params.SetMaxContext(n)
}

// Set Beam Size
func (context *context) SetBeamSize(n int) {
	context.params.SetBeamSize(n)
}

// Set Entropy threshold
func (context *context) SetEntropyThold(t float32) {
	context.params.SetEntropyThold(t)
}

// Set Temperature
func (context *context) SetTemperature(t float32) {
	context.params.SetTemperature(t)
}

// Set the fallback temperature incrementation
// Pass -1.0 to disable this feature
func (context *context) SetTemperatureFallback(t float32) {
	context.params.SetTemperatureFallback(t)
}

// Set initial prompt
func (context *context) SetInitialPrompt(prompt string) {
	context.params.SetInitialPrompt(prompt)
}

// ResetTimings resets the mode timings. Should be called before processing
func (context *context) ResetTimings() {
	context.model.ctx.Whisper_reset_timings()
}

// PrintTimings prints the model timings to stdout.
func (context *context) PrintTimings() {
	context.model.ctx.Whisper_print_timings()
}

// SystemInfo returns the system information
func (context *context) SystemInfo() string {
	return fmt.Sprintf("system_info: n_threads = %d / %d | %s\n",
		context.params.Threads(),
		runtime.NumCPU(),
		whisper.Whisper_print_system_info(),
	)
}

// Use mel data at offset_ms to try and auto-detect the spoken language
// Make sure to call whisper_pcm_to_mel() or whisper_set_mel() first.
// Returns the probabilities of all languages.
func (context *context) WhisperLangAutoDetect(offset_ms int, n_threads int) ([]float32, error) {
	langProbs, err := context.model.ctx.Whisper_lang_auto_detect(offset_ms, n_threads)
	if err != nil {
		return nil, err
	}
	return langProbs, nil
}

// Process new sample data and return any errors
func (context *context) Process(
	data []float32,
	callEncoderBegin EncoderBeginCallback,
	callNewSegment SegmentCallback,
	callProgress ProgressCallback,
) error {
	if context.model.ctx == nil {
		return ErrInternalAppError
	}
	// If the callback is defined then we force on single_segment mode
	if callNewSegment != nil {
		context.params.SetSingleSegment(true)
	}

	// We don't do parallel processing at the moment
	processors := 0
	if processors > 1 {
		if err := context.model.ctx.Whisper_full_parallel(context.params, data, processors, callEncoderBegin,
			func(new int) {
				if callNewSegment != nil {
					num_segments := context.model.ctx.Whisper_full_n_segments()
					s0 := num_segments - new
					for i := s0; i < num_segments; i++ {
						callNewSegment(toSegment(context.model.ctx, i))
					}
				}
			}); err != nil {
			return err
		}
	} else if err := context.model.ctx.Whisper_full(context.params, data, callEncoderBegin,
		func(new int) {
			if callNewSegment != nil {
				num_segments := context.model.ctx.Whisper_full_n_segments()
				s0 := num_segments - new
				for i := s0; i < num_segments; i++ {
					callNewSegment(toSegment(context.model.ctx, i))
				}
			}
		}, func(progress int) {
			if callProgress != nil {
				callProgress(progress)
			}
		}); err != nil {
		return err
	}

	// Reset n so that more Segments can be available within NextSegment call
	context.n = 0

	// Return success
	return nil
}

// Return the next segment of tokens
func (context *context) NextSegment() (Segment, error) {
	if context.model.ctx == nil {
		return Segment{}, ErrInternalAppError
	}
	if context.n >= context.model.ctx.Whisper_full_n_segments() {
		return Segment{}, io.EOF
	}

	// Populate result
	result := toSegment(context.model.ctx, context.n)

	// Increment the cursor
	context.n++

	// Return success
	return result, nil
}

// Test for text tokens
func (context *context) IsText(t Token) bool {
	switch {
	case context.IsBEG(t):
		return false
	case context.IsSOT(t):
		return false
	case whisper.Token(t.Id) >= context.model.ctx.Whisper_token_eot():
		return false
	case context.IsPREV(t):
		return false
	case context.IsSOLM(t):
		return false
	case context.IsNOT(t):
		return false
	default:
		return true
	}
}

// Test for "begin" token
func (context *context) IsBEG(t Token) bool {
	return whisper.Token(t.Id) == context.model.ctx.Whisper_token_beg()
}

// Test for "start of transcription" token
func (context *context) IsSOT(t Token) bool {
	return whisper.Token(t.Id) == context.model.ctx.Whisper_token_sot()
}

// Test for "end of transcription" token
func (context *context) IsEOT(t Token) bool {
	return whisper.Token(t.Id) == context.model.ctx.Whisper_token_eot()
}

// Test for "start of prev" token
func (context *context) IsPREV(t Token) bool {
	return whisper.Token(t.Id) == context.model.ctx.Whisper_token_prev()
}

// Test for "start of lm" token
func (context *context) IsSOLM(t Token) bool {
	return whisper.Token(t.Id) == context.model.ctx.Whisper_token_solm()
}

// Test for "No timestamps" token
func (context *context) IsNOT(t Token) bool {
	return whisper.Token(t.Id) == context.model.ctx.Whisper_token_not()
}

// Test for token associated with a specific language
func (context *context) IsLANG(t Token, lang string) bool {
	if id := context.model.ctx.Whisper_lang_id(lang); id >= 0 {
		return whisper.Token(t.Id) == context.model.ctx.Whisper_token_lang(id)
	} else {
		return false
	}
}

///////////////////////////////////////////////////////////////////////////////
// PRIVATE METHODS

func toSegment(ctx *whisper.Context, n int) Segment {
	return Segment{
		Num:    n,
		Text:   strings.TrimSpace(ctx.Whisper_full_get_segment_text(n)),
		Start:  time.Duration(ctx.Whisper_full_get_segment_t0(n)) * time.Millisecond * 10,
		End:    time.Duration(ctx.Whisper_full_get_segment_t1(n)) * time.Millisecond * 10,
		Tokens: toTokens(ctx, n),
	}
}

func toTokens(ctx *whisper.Context, n int) []Token {
	result := make([]Token, ctx.Whisper_full_n_tokens(n))
	for i := 0; i < len(result); i++ {
		data := ctx.Whisper_full_get_token_data(n, i)

		result[i] = Token{
			Id:    int(ctx.Whisper_full_get_token_id(n, i)),
			Text:  ctx.Whisper_full_get_token_text(n, i),
			P:     ctx.Whisper_full_get_token_p(n, i),
			Start: time.Duration(data.T0()) * time.Millisecond * 10,
			End:   time.Duration(data.T1()) * time.Millisecond * 10,
		}
	}
	return result
}


================================================
FILE: bindings/go/pkg/whisper/context_test.go
================================================
package whisper_test

import (
	"os"
	"testing"

	"github.com/ggerganov/whisper.cpp/bindings/go/pkg/whisper"
	"github.com/go-audio/wav"
	assert "github.com/stretchr/testify/assert"
)

func TestSetLanguage(t *testing.T) {
	assert := assert.New(t)

	model, err := whisper.New(ModelPath)
	assert.NoError(err)
	assert.NotNil(model)
	defer model.Close()

	context, err := model.NewContext()
	assert.NoError(err)

	// This returns an error since
	// the model 'models/ggml-small.en.bin'
	// that is loaded is not multilingual
	err = context.SetLanguage("en")
	assert.Error(err)
}

func TestContextModelIsMultilingual(t *testing.T) {
	assert := assert.New(t)

	model, err := whisper.New(ModelPath)
	assert.NoError(err)
	assert.NotNil(model)
	defer model.Close()

	context, err := model.NewContext()
	assert.NoError(err)

	isMultilingual := context.IsMultilingual()

	// This returns false since
	// the model 'models/ggml-small.en.bin'
	// that is loaded is not multilingual
	assert.False(isMultilingual)
}

func TestLanguage(t *testing.T) {
	assert := assert.New(t)

	model, err := whisper.New(ModelPath)
	assert.NoError(err)
	assert.NotNil(model)
	defer model.Close()

	context, err := model.NewContext()
	assert.NoError(err)

	// This always returns en since
	// the model 'models/ggml-small.en.bin'
	// that is loaded is not multilingual
	expectedLanguage := "en"
	actualLanguage := context.Language()
	assert.Equal(expectedLanguage, actualLanguage)
}

func TestProcess(t *testing.T) {
	assert := assert.New(t)

	fh, err := os.Open(SamplePath)
	assert.NoError(err)
	defer fh.Close()

	// Decode the WAV file - load the full buffer
	dec := wav.NewDecoder(fh)
	buf, err := dec.FullPCMBuffer()
	assert.NoError(err)
	assert.Equal(uint16(1), dec.NumChans)

	data := buf.AsFloat32Buffer().Data

	model, err := whisper.New(ModelPath)
	assert.NoError(err)
	assert.NotNil(model)
	defer model.Close()

	context, err := model.NewContext()
	assert.NoError(err)

	err = context.Process(data, nil, nil, nil)
	assert.NoError(err)
}

func TestDetectedLanguage(t *testing.T) {
	assert := assert.New(t)

	fh, err := os.Open(SamplePath)
	assert.NoError(err)
	defer fh.Close()

	// Decode the WAV file - load the full buffer
	dec := wav.NewDecoder(fh)
	buf, err := dec.FullPCMBuffer()
	assert.NoError(err)
	assert.Equal(uint16(1), dec.NumChans)

	data := buf.AsFloat32Buffer().Data

	model, err := whisper.New(ModelPath)
	assert.NoError(err)
	assert.NotNil(model)
	defer model.Close()

	context, err := model.NewContext()
	assert.NoError(err)

	err = context.Process(data, nil, nil, nil)
	assert.NoError(err)

	expectedLanguage := "en"
	actualLanguage := context.DetectedLanguage()
	assert.Equal(expectedLanguage, actualLanguage)
}


================================================
FILE: bindings/go/pkg/whisper/doc.go
================================================
/*
This is the higher-level speech-to-text whisper.cpp API for go
*/
package whisper


================================================
FILE: bindings/go/pkg/whisper/interface.go
================================================
package whisper

import (
	"io"
	"time"
)

///////////////////////////////////////////////////////////////////////////////
// TYPES

// SegmentCallback is the callback function for processing segments in real
// time. It is called during the Process function
type SegmentCallback func(Segment)

// ProgressCallback is the callback function for reporting progress during
// processing. It is called during the Process function
type ProgressCallback func(int)

// EncoderBeginCallback is the callback function for checking if we want to
// continue processing. It is called during the Process function
type EncoderBeginCallback func() bool

// Model is the interface to a whisper model. Create a new model with the
// function whisper.New(string)
type Model interface {
	io.Closer

	// Return a new speech-to-text context.
	NewContext() (Context, error)

	// Return true if the model is multilingual.
	IsMultilingual() bool

	// Return all languages supported.
	Languages() []string
}

// Context is the speech recognition context.
type Context interface {
	SetLanguage(string) error // Set the language to use for speech recognition, use "auto" for auto detect language.
	SetTranslate(bool)        // Set translate flag
	IsMultilingual() bool     // Return true if the model is multilingual.
	Language() string         // Get language
	DetectedLanguage() string // Get detected language

	SetOffset(time.Duration)          // Set offset
	SetDuration(time.Duration)        // Set duration
	SetThreads(uint)                  // Set number of threads to use
	SetSplitOnWord(bool)              // Set split on word flag
	SetTokenThreshold(float32)        // Set timestamp token probability threshold
	SetTokenSumThreshold(float32)     // Set timestamp token sum probability threshold
	SetMaxSegmentLength(uint)         // Set max segment length in characters
	SetTokenTimestamps(bool)          // Set token timestamps flag
	SetMaxTokensPerSegment(uint)      // Set max tokens per segment (0 = no limit)
	SetAudioCtx(uint)                 // Set audio encoder context
	SetMaxContext(n int)              // Set maximum number of text context tokens to store
	SetBeamSize(n int)                // Set Beam Size
	SetEntropyThold(t float32)        // Set Entropy threshold
	SetInitialPrompt(prompt string)   // Set initial prompt
	SetTemperature(t float32)         // Set temperature
	SetTemperatureFallback(t float32) // Set temperature incrementation

	SetVAD(v bool)
	SetVADModelPath(path string)
	SetVADThreshold(t float32)
	SetVADMinSpeechMs(ms int)
	SetVADMinSilenceMs(ms int)
	SetVADMaxSpeechSec(s float32)
	SetVADSpeechPadMs(ms int)
	SetVADSamplesOverlap(sec float32)

	// Process mono audio data and return any errors.
	// If defined, newly generated segments are passed to the
	// callback function during processing.
	Process([]float32, EncoderBeginCallback, SegmentCallback, ProgressCallback) error

	// After process is called, return segments until the end of the stream
	// is reached, when io.EOF is returned.
	NextSegment() (Segment, error)

	IsBEG(Token) bool          // Test for "begin" token
	IsSOT(Token) bool          // Test for "start of transcription" token
	IsEOT(Token) bool          // Test for "end of transcription" token
	IsPREV(Token) bool         // Test for "start of prev" token
	IsSOLM(Token) bool         // Test for "start of lm" token
	IsNOT(Token) bool          // Test for "No timestamps" token
	IsLANG(Token, string) bool // Test for token associated with a specific language
	IsText(Token) bool         // Test for text token

	// Timings
	PrintTimings()
	ResetTimings()

	SystemInfo() string
}

// Segment is the text result of a speech recognition.
type Segment struct {
	// Segment Number
	Num int

	// Time beginning and end timestamps for the segment.
	Start, End time.Duration

	// The text of the segment.
	Text string

	// The tokens of the segment.
	Tokens []Token
}

// Token is a text or special token
type Token struct {
	Id         int
	Text       string
	P          float32
	Start, End time.Duration
}


================================================
FILE: bindings/go/pkg/whisper/model.go
================================================
package whisper

import (
	"fmt"
	"os"
	"runtime"

	// Bindings
	whisper "github.com/ggerganov/whisper.cpp/bindings/go"
)

///////////////////////////////////////////////////////////////////////////////
// TYPES

type model struct {
	path string
	ctx  *whisper.Context
}

// Make sure model adheres to the interface
var _ Model = (*model)(nil)

/////////////////////////////////////////////////////////////////////////////
Download .txt
gitextract_2_of6s_n/

├── .devops/
│   ├── cublas.Dockerfile
│   ├── main-cuda.Dockerfile
│   ├── main-intel.Dockerfile
│   ├── main-musa.Dockerfile
│   ├── main-vulkan.Dockerfile
│   └── main.Dockerfile
├── .dockerignore
├── .github/
│   └── workflows/
│       ├── bindings-go.yml
│       ├── bindings-ruby.yml
│       ├── build.yml
│       ├── docker.yml
│       ├── examples-wasm.yml
│       └── examples.yml
├── .gitignore
├── AUTHORS
├── CMakeLists.txt
├── LICENSE
├── Makefile
├── README.md
├── README_sycl.md
├── bindings/
│   ├── CMakeLists.txt
│   ├── go/
│   │   ├── .gitignore
│   │   ├── LICENSE
│   │   ├── Makefile
│   │   ├── README.md
│   │   ├── doc.go
│   │   ├── examples/
│   │   │   ├── go-model-download/
│   │   │   │   ├── context.go
│   │   │   │   └── main.go
│   │   │   └── go-whisper/
│   │   │       ├── color.go
│   │   │       ├── flags.go
│   │   │       ├── main.go
│   │   │       └── process.go
│   │   ├── go.mod
│   │   ├── go.sum
│   │   ├── params.go
│   │   ├── pkg/
│   │   │   └── whisper/
│   │   │       ├── consts.go
│   │   │       ├── context.go
│   │   │       ├── context_test.go
│   │   │       ├── doc.go
│   │   │       ├── interface.go
│   │   │       ├── model.go
│   │   │       ├── model_test.go
│   │   │       └── util_test.go
│   │   ├── whisper.go
│   │   └── whisper_test.go
│   ├── java/
│   │   ├── README.md
│   │   ├── build.gradle
│   │   ├── gradle/
│   │   │   └── wrapper/
│   │   │       ├── gradle-wrapper.jar
│   │   │       └── gradle-wrapper.properties
│   │   ├── gradle.properties
│   │   ├── gradlew
│   │   ├── gradlew.bat
│   │   ├── settings.gradle
│   │   └── src/
│   │       ├── main/
│   │       │   └── java/
│   │       │       └── io/
│   │       │           └── github/
│   │       │               └── ggerganov/
│   │       │                   └── whispercpp/
│   │       │                       ├── WhisperConstants.java
│   │       │                       ├── WhisperContext.java
│   │       │                       ├── WhisperCpp.java
│   │       │                       ├── WhisperCppJnaLibrary.java
│   │       │                       ├── bean/
│   │       │                       │   └── WhisperSegment.java
│   │       │                       ├── callbacks/
│   │       │                       │   ├── GgmlAbortCallback.java
│   │       │                       │   ├── WhisperEncoderBeginCallback.java
│   │       │                       │   ├── WhisperLogitsFilterCallback.java
│   │       │                       │   ├── WhisperNewSegmentCallback.java
│   │       │                       │   └── WhisperProgressCallback.java
│   │       │                       ├── ggml/
│   │       │                       │   ├── GgmlTensor.java
│   │       │                       │   └── GgmlType.java
│   │       │                       ├── model/
│   │       │                       │   ├── EModel.java
│   │       │                       │   ├── WhisperModel.java
│   │       │                       │   ├── WhisperModelLoader.java
│   │       │                       │   ├── WhisperState.java
│   │       │                       │   └── WhisperTokenData.java
│   │       │                       └── params/
│   │       │                           ├── BeamSearchParams.java
│   │       │                           ├── CBool.java
│   │       │                           ├── GreedyParams.java
│   │       │                           ├── WhisperAhead.java
│   │       │                           ├── WhisperAheads.java
│   │       │                           ├── WhisperContextParams.java
│   │       │                           ├── WhisperFilters.java
│   │       │                           ├── WhisperFullParams.java
│   │       │                           ├── WhisperHParams.java
│   │       │                           └── WhisperSamplingStrategy.java
│   │       └── test/
│   │           └── java/
│   │               └── io/
│   │                   └── github/
│   │                       └── ggerganov/
│   │                           └── whispercpp/
│   │                               ├── WhisperCppTest.java
│   │                               └── WhisperJnaLibraryTest.java
│   ├── javascript/
│   │   ├── .gitignore
│   │   ├── CMakeLists.txt
│   │   ├── README.md
│   │   ├── emscripten.cpp
│   │   ├── libwhisper.worker.js
│   │   ├── package-tmpl.json
│   │   ├── package.json
│   │   └── whisper.js
│   └── ruby/
│       ├── .gitignore
│       ├── README.md
│       ├── Rakefile
│       ├── ext/
│       │   ├── .gitignore
│       │   ├── dependencies.rb
│       │   ├── extconf.rb
│       │   ├── options.rb
│       │   ├── ruby_whisper.c
│       │   ├── ruby_whisper.h
│       │   ├── ruby_whisper_context.c
│       │   ├── ruby_whisper_context_params.c
│       │   ├── ruby_whisper_error.c
│       │   ├── ruby_whisper_model.c
│       │   ├── ruby_whisper_params.c
│       │   ├── ruby_whisper_segment.c
│       │   ├── ruby_whisper_token.c
│       │   ├── ruby_whisper_transcribe.cpp
│       │   ├── ruby_whisper_vad_context.c
│       │   ├── ruby_whisper_vad_context_detect.cpp
│       │   ├── ruby_whisper_vad_params.c
│       │   ├── ruby_whisper_vad_segment.c
│       │   ├── ruby_whisper_vad_segments.c
│       │   └── sources/
│       │       └── CMakeGraphVizOptions.cmake
│       ├── extsources.rb
│       ├── lib/
│       │   └── whisper/
│       │       ├── context.rb
│       │       ├── model/
│       │       │   └── uri.rb
│       │       └── segment.rb
│       ├── sig/
│       │   └── whisper.rbs
│       ├── test/
│       │   ├── helper.rb
│       │   ├── jfk_reader/
│       │   │   ├── .gitignore
│       │   │   ├── extconf.rb
│       │   │   └── jfk_reader.c
│       │   ├── test_callback.rb
│       │   ├── test_context_params.rb
│       │   ├── test_error.rb
│       │   ├── test_model.rb
│       │   ├── test_package.rb
│       │   ├── test_params.rb
│       │   ├── test_segment.rb
│       │   ├── test_token.rb
│       │   ├── test_vad.rb
│       │   ├── test_vad_context.rb
│       │   ├── test_vad_params.rb
│       │   ├── test_vad_segment.rb
│       │   ├── test_vad_segments.rb
│       │   └── test_whisper.rb
│       └── whispercpp.gemspec
├── build-xcframework.sh
├── ci/
│   ├── README.md
│   └── run.sh
├── close-issue.yml
├── cmake/
│   ├── DefaultTargetOptions.cmake
│   ├── FindFFmpeg.cmake
│   ├── arm64-apple-clang.cmake
│   ├── arm64-windows-llvm.cmake
│   ├── build-info.cmake
│   ├── git-vars.cmake
│   ├── riscv64-spacemit-linux-gnu-gcc.cmake
│   ├── whisper-config.cmake.in
│   ├── whisper.pc.in
│   └── x64-windows-llvm.cmake
├── examples/
│   ├── CMakeLists.txt
│   ├── addon.node/
│   │   ├── .gitignore
│   │   ├── CMakeLists.txt
│   │   ├── README.md
│   │   ├── __test__/
│   │   │   └── whisper.spec.js
│   │   ├── addon.cpp
│   │   ├── index.js
│   │   ├── package.json
│   │   └── vad-example.js
│   ├── bench/
│   │   ├── CMakeLists.txt
│   │   ├── README.md
│   │   └── bench.cpp
│   ├── bench.wasm/
│   │   ├── CMakeLists.txt
│   │   ├── README.md
│   │   ├── emscripten.cpp
│   │   └── index-tmpl.html
│   ├── cli/
│   │   ├── CMakeLists.txt
│   │   ├── README.md
│   │   └── cli.cpp
│   ├── coi-serviceworker.js
│   ├── command/
│   │   ├── CMakeLists.txt
│   │   ├── README.md
│   │   ├── command.cpp
│   │   └── commands.txt
│   ├── command.wasm/
│   │   ├── CMakeLists.txt
│   │   ├── README.md
│   │   ├── emscripten.cpp
│   │   └── index-tmpl.html
│   ├── common-ggml.cpp
│   ├── common-ggml.h
│   ├── common-sdl.cpp
│   ├── common-sdl.h
│   ├── common-whisper.cpp
│   ├── common-whisper.h
│   ├── common.cpp
│   ├── common.h
│   ├── deprecation-warning/
│   │   ├── CMakeLists.txt
│   │   ├── README.md
│   │   └── deprecation-warning.cpp
│   ├── ffmpeg-transcode.cpp
│   ├── generate-karaoke.sh
│   ├── grammar-parser.cpp
│   ├── grammar-parser.h
│   ├── helpers.js
│   ├── json.hpp
│   ├── livestream.sh
│   ├── lsp/
│   │   ├── CMakeLists.txt
│   │   ├── README.md
│   │   ├── lsp.cpp
│   │   └── whisper.vim
│   ├── miniaudio.h
│   ├── python/
│   │   ├── test_whisper_processor.py
│   │   └── whisper_processor.py
│   ├── quantize/
│   │   ├── CMakeLists.txt
│   │   ├── README.md
│   │   └── quantize.cpp
│   ├── server/
│   │   ├── CMakeLists.txt
│   │   ├── README.md
│   │   ├── bench.js
│   │   ├── httplib.h
│   │   └── server.cpp
│   ├── server.py
│   ├── stb_vorbis.c
│   ├── stream/
│   │   ├── CMakeLists.txt
│   │   ├── README.md
│   │   └── stream.cpp
│   ├── stream.wasm/
│   │   ├── CMakeLists.txt
│   │   ├── README.md
│   │   ├── emscripten.cpp
│   │   └── index-tmpl.html
│   ├── sycl/
│   │   ├── CMakeLists.txt
│   │   ├── README.md
│   │   ├── build.sh
│   │   ├── ls-sycl-device.cpp
│   │   └── run-whisper.sh
│   ├── talk-llama/
│   │   ├── .gitignore
│   │   ├── CMakeLists.txt
│   │   ├── README.md
│   │   ├── eleven-labs.py
│   │   ├── llama-adapter.cpp
│   │   ├── llama-adapter.h
│   │   ├── llama-arch.cpp
│   │   ├── llama-arch.h
│   │   ├── llama-batch.cpp
│   │   ├── llama-batch.h
│   │   ├── llama-chat.cpp
│   │   ├── llama-chat.h
│   │   ├── llama-context.cpp
│   │   ├── llama-context.h
│   │   ├── llama-cparams.cpp
│   │   ├── llama-cparams.h
│   │   ├── llama-ext.h
│   │   ├── llama-grammar.cpp
│   │   ├── llama-grammar.h
│   │   ├── llama-graph.cpp
│   │   ├── llama-graph.h
│   │   ├── llama-hparams.cpp
│   │   ├── llama-hparams.h
│   │   ├── llama-impl.cpp
│   │   ├── llama-impl.h
│   │   ├── llama-io.cpp
│   │   ├── llama-io.h
│   │   ├── llama-kv-cache-iswa.cpp
│   │   ├── llama-kv-cache-iswa.h
│   │   ├── llama-kv-cache.cpp
│   │   ├── llama-kv-cache.h
│   │   ├── llama-kv-cells.h
│   │   ├── llama-memory-hybrid-iswa.cpp
│   │   ├── llama-memory-hybrid-iswa.h
│   │   ├── llama-memory-hybrid.cpp
│   │   ├── llama-memory-hybrid.h
│   │   ├── llama-memory-recurrent.cpp
│   │   ├── llama-memory-recurrent.h
│   │   ├── llama-memory.cpp
│   │   ├── llama-memory.h
│   │   ├── llama-mmap.cpp
│   │   ├── llama-mmap.h
│   │   ├── llama-model-loader.cpp
│   │   ├── llama-model-loader.h
│   │   ├── llama-model-saver.cpp
│   │   ├── llama-model-saver.h
│   │   ├── llama-model.cpp
│   │   ├── llama-model.h
│   │   ├── llama-quant.cpp
│   │   ├── llama-quant.h
│   │   ├── llama-sampler.cpp
│   │   ├── llama-sampler.h
│   │   ├── llama-vocab.cpp
│   │   ├── llama-vocab.h
│   │   ├── llama.cpp
│   │   ├── llama.h
│   │   ├── models/
│   │   │   ├── afmoe.cpp
│   │   │   ├── apertus.cpp
│   │   │   ├── arcee.cpp
│   │   │   ├── arctic.cpp
│   │   │   ├── arwkv7.cpp
│   │   │   ├── baichuan.cpp
│   │   │   ├── bailingmoe.cpp
│   │   │   ├── bailingmoe2.cpp
│   │   │   ├── bert.cpp
│   │   │   ├── bitnet.cpp
│   │   │   ├── bloom.cpp
│   │   │   ├── chameleon.cpp
│   │   │   ├── chatglm.cpp
│   │   │   ├── codeshell.cpp
│   │   │   ├── cogvlm.cpp
│   │   │   ├── cohere2-iswa.cpp
│   │   │   ├── command-r.cpp
│   │   │   ├── dbrx.cpp
│   │   │   ├── deci.cpp
│   │   │   ├── deepseek.cpp
│   │   │   ├── deepseek2.cpp
│   │   │   ├── delta-net-base.cpp
│   │   │   ├── dots1.cpp
│   │   │   ├── dream.cpp
│   │   │   ├── ernie4-5-moe.cpp
│   │   │   ├── ernie4-5.cpp
│   │   │   ├── eurobert.cpp
│   │   │   ├── exaone-moe.cpp
│   │   │   ├── exaone.cpp
│   │   │   ├── exaone4.cpp
│   │   │   ├── falcon-h1.cpp
│   │   │   ├── falcon.cpp
│   │   │   ├── gemma-embedding.cpp
│   │   │   ├── gemma.cpp
│   │   │   ├── gemma2-iswa.cpp
│   │   │   ├── gemma3.cpp
│   │   │   ├── gemma3n-iswa.cpp
│   │   │   ├── glm4-moe.cpp
│   │   │   ├── glm4.cpp
│   │   │   ├── gpt2.cpp
│   │   │   ├── gptneox.cpp
│   │   │   ├── granite-hybrid.cpp
│   │   │   ├── granite.cpp
│   │   │   ├── grok.cpp
│   │   │   ├── grovemoe.cpp
│   │   │   ├── hunyuan-dense.cpp
│   │   │   ├── hunyuan-moe.cpp
│   │   │   ├── internlm2.cpp
│   │   │   ├── jais.cpp
│   │   │   ├── jais2.cpp
│   │   │   ├── jamba.cpp
│   │   │   ├── kimi-linear.cpp
│   │   │   ├── lfm2.cpp
│   │   │   ├── llada-moe.cpp
│   │   │   ├── llada.cpp
│   │   │   ├── llama-iswa.cpp
│   │   │   ├── llama.cpp
│   │   │   ├── maincoder.cpp
│   │   │   ├── mamba-base.cpp
│   │   │   ├── mamba.cpp
│   │   │   ├── mimo2-iswa.cpp
│   │   │   ├── minicpm3.cpp
│   │   │   ├── minimax-m2.cpp
│   │   │   ├── mistral3.cpp
│   │   │   ├── models.h
│   │   │   ├── modern-bert.cpp
│   │   │   ├── mpt.cpp
│   │   │   ├── nemotron-h.cpp
│   │   │   ├── nemotron.cpp
│   │   │   ├── neo-bert.cpp
│   │   │   ├── olmo.cpp
│   │   │   ├── olmo2.cpp
│   │   │   ├── olmoe.cpp
│   │   │   ├── openai-moe-iswa.cpp
│   │   │   ├── openelm.cpp
│   │   │   ├── orion.cpp
│   │   │   ├── paddleocr.cpp
│   │   │   ├── pangu-embedded.cpp
│   │   │   ├── phi2.cpp
│   │   │   ├── phi3.cpp
│   │   │   ├── plamo.cpp
│   │   │   ├── plamo2.cpp
│   │   │   ├── plamo3.cpp
│   │   │   ├── plm.cpp
│   │   │   ├── qwen.cpp
│   │   │   ├── qwen2.cpp
│   │   │   ├── qwen2moe.cpp
│   │   │   ├── qwen2vl.cpp
│   │   │   ├── qwen3.cpp
│   │   │   ├── qwen35.cpp
│   │   │   ├── qwen35moe.cpp
│   │   │   ├── qwen3moe.cpp
│   │   │   ├── qwen3next.cpp
│   │   │   ├── qwen3vl-moe.cpp
│   │   │   ├── qwen3vl.cpp
│   │   │   ├── refact.cpp
│   │   │   ├── rnd1.cpp
│   │   │   ├── rwkv6-base.cpp
│   │   │   ├── rwkv6.cpp
│   │   │   ├── rwkv6qwen2.cpp
│   │   │   ├── rwkv7-base.cpp
│   │   │   ├── rwkv7.cpp
│   │   │   ├── seed-oss.cpp
│   │   │   ├── smallthinker.cpp
│   │   │   ├── smollm3.cpp
│   │   │   ├── stablelm.cpp
│   │   │   ├── starcoder.cpp
│   │   │   ├── starcoder2.cpp
│   │   │   ├── step35-iswa.cpp
│   │   │   ├── t5-dec.cpp
│   │   │   ├── t5-enc.cpp
│   │   │   ├── wavtokenizer-dec.cpp
│   │   │   └── xverse.cpp
│   │   ├── prompts/
│   │   │   └── talk-alpaca.txt
│   │   ├── speak
│   │   ├── speak.bat
│   │   ├── speak.ps1
│   │   ├── talk-llama.cpp
│   │   ├── unicode-data.cpp
│   │   ├── unicode-data.h
│   │   ├── unicode.cpp
│   │   └── unicode.h
│   ├── twitch.sh
│   ├── vad-speech-segments/
│   │   ├── CMakeLists.txt
│   │   ├── README.md
│   │   └── speech.cpp
│   ├── wchess/
│   │   ├── CMakeLists.txt
│   │   ├── README.md
│   │   ├── libwchess/
│   │   │   ├── CMakeLists.txt
│   │   │   ├── Chessboard.cpp
│   │   │   ├── Chessboard.h
│   │   │   ├── WChess.cpp
│   │   │   ├── WChess.h
│   │   │   └── test-chessboard.cpp
│   │   ├── wchess.cmd/
│   │   │   ├── CMakeLists.txt
│   │   │   └── wchess.cmd.cpp
│   │   └── wchess.wasm/
│   │       ├── CMakeLists.txt
│   │       ├── chessboardjs-1.0.0/
│   │       │   ├── css/
│   │       │   │   └── chessboard-1.0.0.css
│   │       │   └── js/
│   │       │       ├── chessboard-1.0.0/
│   │       │       │   ├── CHANGELOG.md
│   │       │       │   ├── LICENSE.md
│   │       │       │   ├── README.md
│   │       │       │   └── package.json
│   │       │       └── chessboard-1.0.0.js
│   │       ├── index-tmpl.html
│   │       └── wchess.wasm.cpp
│   ├── whisper.android/
│   │   ├── .gitignore
│   │   ├── README.md
│   │   ├── app/
│   │   │   ├── .gitignore
│   │   │   ├── build.gradle
│   │   │   ├── proguard-rules.pro
│   │   │   └── src/
│   │   │       ├── androidTest/
│   │   │       │   └── java/
│   │   │       │       └── com/
│   │   │       │           └── whispercppdemo/
│   │   │       │               └── ExampleInstrumentedTest.kt
│   │   │       ├── main/
│   │   │       │   ├── AndroidManifest.xml
│   │   │       │   ├── java/
│   │   │       │   │   └── com/
│   │   │       │   │       └── whispercppdemo/
│   │   │       │   │           ├── MainActivity.kt
│   │   │       │   │           ├── media/
│   │   │       │   │           │   └── RiffWaveHelper.kt
│   │   │       │   │           ├── recorder/
│   │   │       │   │           │   └── Recorder.kt
│   │   │       │   │           └── ui/
│   │   │       │   │               ├── main/
│   │   │       │   │               │   ├── MainScreen.kt
│   │   │       │   │               │   └── MainScreenViewModel.kt
│   │   │       │   │               └── theme/
│   │   │       │   │                   ├── Color.kt
│   │   │       │   │                   ├── Theme.kt
│   │   │       │   │                   └── Type.kt
│   │   │       │   └── res/
│   │   │       │       ├── drawable/
│   │   │       │       │   ├── ic_launcher_background.xml
│   │   │       │       │   └── ic_launcher_foreground.xml
│   │   │       │       ├── mipmap-anydpi/
│   │   │       │       │   └── ic_launcher.xml
│   │   │       │       ├── values/
│   │   │       │       │   ├── strings.xml
│   │   │       │       │   └── themes.xml
│   │   │       │       └── xml/
│   │   │       │           ├── backup_rules.xml
│   │   │       │           └── data_extraction_rules.xml
│   │   │       └── test/
│   │   │           └── java/
│   │   │               └── com/
│   │   │                   └── whispercppdemo/
│   │   │                       └── ExampleUnitTest.kt
│   │   ├── build.gradle
│   │   ├── gradle/
│   │   │   └── wrapper/
│   │   │       ├── gradle-wrapper.jar
│   │   │       └── gradle-wrapper.properties
│   │   ├── gradle.properties
│   │   ├── gradlew
│   │   ├── gradlew.bat
│   │   ├── lib/
│   │   │   ├── .gitignore
│   │   │   ├── build.gradle
│   │   │   └── src/
│   │   │       └── main/
│   │   │           ├── AndroidManifest.xml
│   │   │           ├── java/
│   │   │           │   └── com/
│   │   │           │       └── whispercpp/
│   │   │           │           └── whisper/
│   │   │           │               ├── LibWhisper.kt
│   │   │           │               └── WhisperCpuConfig.kt
│   │   │           └── jni/
│   │   │               └── whisper/
│   │   │                   ├── CMakeLists.txt
│   │   │                   └── jni.c
│   │   └── settings.gradle
│   ├── whisper.android.java/
│   │   ├── .gitignore
│   │   ├── README.md
│   │   ├── app/
│   │   │   ├── .gitignore
│   │   │   ├── build.gradle
│   │   │   ├── proguard-rules.pro
│   │   │   └── src/
│   │   │       ├── androidTest/
│   │   │       │   └── java/
│   │   │       │       └── com/
│   │   │       │           └── litongjava/
│   │   │       │               └── whisper/
│   │   │       │                   └── android/
│   │   │       │                       └── java/
│   │   │       │                           └── ExampleInstrumentedTest.java
│   │   │       ├── main/
│   │   │       │   ├── AndroidManifest.xml
│   │   │       │   ├── assets/
│   │   │       │   │   └── logback.xml
│   │   │       │   ├── java/
│   │   │       │   │   └── com/
│   │   │       │   │       ├── litongjava/
│   │   │       │   │       │   └── whisper/
│   │   │       │   │       │       └── android/
│   │   │       │   │       │           └── java/
│   │   │       │   │       │               ├── MainActivity.java
│   │   │       │   │       │               ├── app/
│   │   │       │   │       │               │   └── App.java
│   │   │       │   │       │               ├── bean/
│   │   │       │   │       │               │   └── WhisperSegment.java
│   │   │       │   │       │               ├── services/
│   │   │       │   │       │               │   └── WhisperService.java
│   │   │       │   │       │               ├── single/
│   │   │       │   │       │               │   └── LocalWhisper.java
│   │   │       │   │       │               ├── task/
│   │   │       │   │       │               │   ├── LoadModelTask.java
│   │   │       │   │       │               │   └── TranscriptionTask.java
│   │   │       │   │       │               └── utils/
│   │   │       │   │       │                   ├── AssetUtils.java
│   │   │       │   │       │                   └── WaveEncoder.java
│   │   │       │   │       └── whispercpp/
│   │   │       │   │           └── java/
│   │   │       │   │               └── whisper/
│   │   │       │   │                   ├── CpuInfo.java
│   │   │       │   │                   ├── WhisperContext.java
│   │   │       │   │                   ├── WhisperCpuConfig.java
│   │   │       │   │                   ├── WhisperLib.java
│   │   │       │   │                   └── WhisperUtils.java
│   │   │       │   ├── jni/
│   │   │       │   │   └── whisper/
│   │   │       │   │       ├── CMakeLists.txt
│   │   │       │   │       └── jni.c
│   │   │       │   └── res/
│   │   │       │       ├── drawable/
│   │   │       │       │   └── ic_launcher_background.xml
│   │   │       │       ├── drawable-v24/
│   │   │       │       │   └── ic_launcher_foreground.xml
│   │   │       │       ├── layout/
│   │   │       │       │   └── activity_main.xml
│   │   │       │       ├── mipmap-anydpi-v26/
│   │   │       │       │   ├── ic_launcher.xml
│   │   │       │       │   └── ic_launcher_round.xml
│   │   │       │       ├── values/
│   │   │       │       │   ├── colors.xml
│   │   │       │       │   ├── strings.xml
│   │   │       │       │   └── themes.xml
│   │   │       │       └── values-night/
│   │   │       │           └── themes.xml
│   │   │       └── test/
│   │   │           └── java/
│   │   │               └── com/
│   │   │                   └── litongjava/
│   │   │                       └── whisper/
│   │   │                           └── android/
│   │   │                               └── java/
│   │   │                                   └── ExampleUnitTest.java
│   │   ├── build.gradle
│   │   ├── gradle/
│   │   │   └── wrapper/
│   │   │       ├── gradle-wrapper.jar
│   │   │       └── gradle-wrapper.properties
│   │   ├── gradle.properties
│   │   ├── gradlew
│   │   ├── gradlew.bat
│   │   └── settings.gradle
│   ├── whisper.nvim/
│   │   ├── README.md
│   │   └── whisper.nvim
│   ├── whisper.objc/
│   │   ├── README.md
│   │   ├── whisper.objc/
│   │   │   ├── AppDelegate.h
│   │   │   ├── AppDelegate.m
│   │   │   ├── Assets.xcassets/
│   │   │   │   ├── AccentColor.colorset/
│   │   │   │   │   └── Contents.json
│   │   │   │   ├── AppIcon.appiconset/
│   │   │   │   │   └── Contents.json
│   │   │   │   └── Contents.json
│   │   │   ├── Base.lproj/
│   │   │   │   ├── LaunchScreen.storyboard
│   │   │   │   └── Main.storyboard
│   │   │   ├── Info.plist
│   │   │   ├── SceneDelegate.h
│   │   │   ├── SceneDelegate.m
│   │   │   ├── ViewController.h
│   │   │   ├── ViewController.m
│   │   │   └── main.m
│   │   └── whisper.objc.xcodeproj/
│   │       ├── project.pbxproj
│   │       └── project.xcworkspace/
│   │           ├── contents.xcworkspacedata
│   │           └── xcshareddata/
│   │               └── IDEWorkspaceChecks.plist
│   ├── whisper.swiftui/
│   │   ├── .gitignore
│   │   ├── README.md
│   │   ├── whisper.cpp.swift/
│   │   │   └── LibWhisper.swift
│   │   ├── whisper.swiftui.demo/
│   │   │   ├── Models/
│   │   │   │   ├── Model.swift
│   │   │   │   └── WhisperState.swift
│   │   │   ├── Resources/
│   │   │   │   ├── models/
│   │   │   │   │   └── .gitignore
│   │   │   │   └── samples/
│   │   │   │       └── .gitignore
│   │   │   ├── Supporting files/
│   │   │   │   ├── Assets.xcassets/
│   │   │   │   │   ├── AccentColor.colorset/
│   │   │   │   │   │   └── Contents.json
│   │   │   │   │   ├── AppIcon.appiconset/
│   │   │   │   │   │   └── Contents.json
│   │   │   │   │   └── Contents.json
│   │   │   │   ├── Preview Content/
│   │   │   │   │   └── Preview Assets.xcassets/
│   │   │   │   │       └── Contents.json
│   │   │   │   └── WhisperCppDemo.entitlements
│   │   │   ├── UI/
│   │   │   │   ├── ContentView.swift
│   │   │   │   └── DownloadButton.swift
│   │   │   ├── Utils/
│   │   │   │   ├── Recorder.swift
│   │   │   │   └── RiffWaveUtils.swift
│   │   │   └── WhisperCppDemoApp.swift
│   │   └── whisper.swiftui.xcodeproj/
│   │       ├── .gitignore
│   │       ├── project.pbxproj
│   │       └── project.xcworkspace/
│   │           └── .gitignore
│   ├── whisper.wasm/
│   │   ├── CMakeLists.txt
│   │   ├── README.md
│   │   ├── emscripten.cpp
│   │   └── index-tmpl.html
│   └── yt-wsp.sh
├── ggml/
│   ├── .gitignore
│   ├── CMakeLists.txt
│   ├── cmake/
│   │   ├── GitVars.cmake
│   │   ├── common.cmake
│   │   └── ggml-config.cmake.in
│   ├── include/
│   │   ├── ggml-alloc.h
│   │   ├── ggml-backend.h
│   │   ├── ggml-blas.h
│   │   ├── ggml-cann.h
│   │   ├── ggml-cpp.h
│   │   ├── ggml-cpu.h
│   │   ├── ggml-cuda.h
│   │   ├── ggml-hexagon.h
│   │   ├── ggml-metal.h
│   │   ├── ggml-opencl.h
│   │   ├── ggml-openvino.h
│   │   ├── ggml-opt.h
│   │   ├── ggml-rpc.h
│   │   ├── ggml-sycl.h
│   │   ├── ggml-virtgpu.h
│   │   ├── ggml-vulkan.h
│   │   ├── ggml-webgpu.h
│   │   ├── ggml-zdnn.h
│   │   ├── ggml-zendnn.h
│   │   ├── ggml.h
│   │   └── gguf.h
│   └── src/
│       ├── CMakeLists.txt
│       ├── ggml-alloc.c
│       ├── ggml-backend-dl.cpp
│       ├── ggml-backend-dl.h
│       ├── ggml-backend-impl.h
│       ├── ggml-backend-reg.cpp
│       ├── ggml-backend.cpp
│       ├── ggml-blas/
│       │   ├── CMakeLists.txt
│       │   └── ggml-blas.cpp
│       ├── ggml-cann/
│       │   ├── CMakeLists.txt
│       │   ├── acl_tensor.cpp
│       │   ├── acl_tensor.h
│       │   ├── aclnn_ops.cpp
│       │   ├── aclnn_ops.h
│       │   ├── common.h
│       │   └── ggml-cann.cpp
│       ├── ggml-common.h
│       ├── ggml-cpu/
│       │   ├── CMakeLists.txt
│       │   ├── amx/
│       │   │   ├── amx.cpp
│       │   │   ├── amx.h
│       │   │   ├── common.h
│       │   │   ├── mmq.cpp
│       │   │   └── mmq.h
│       │   ├── arch/
│       │   │   ├── arm/
│       │   │   │   ├── cpu-feats.cpp
│       │   │   │   ├── quants.c
│       │   │   │   └── repack.cpp
│       │   │   ├── loongarch/
│       │   │   │   └── quants.c
│       │   │   ├── powerpc/
│       │   │   │   ├── cpu-feats.cpp
│       │   │   │   └── quants.c
│       │   │   ├── riscv/
│       │   │   │   ├── cpu-feats.cpp
│       │   │   │   ├── quants.c
│       │   │   │   └── repack.cpp
│       │   │   ├── s390/
│       │   │   │   ├── cpu-feats.cpp
│       │   │   │   └── quants.c
│       │   │   ├── wasm/
│       │   │   │   └── quants.c
│       │   │   └── x86/
│       │   │       ├── cpu-feats.cpp
│       │   │       ├── quants.c
│       │   │       └── repack.cpp
│       │   ├── arch-fallback.h
│       │   ├── binary-ops.cpp
│       │   ├── binary-ops.h
│       │   ├── cmake/
│       │   │   └── FindSIMD.cmake
│       │   ├── common.h
│       │   ├── ggml-cpu-impl.h
│       │   ├── ggml-cpu.c
│       │   ├── ggml-cpu.cpp
│       │   ├── hbm.cpp
│       │   ├── hbm.h
│       │   ├── kleidiai/
│       │   │   ├── kernels.cpp
│       │   │   ├── kernels.h
│       │   │   ├── kleidiai.cpp
│       │   │   └── kleidiai.h
│       │   ├── llamafile/
│       │   │   ├── sgemm.cpp
│       │   │   └── sgemm.h
│       │   ├── ops.cpp
│       │   ├── ops.h
│       │   ├── quants.c
│       │   ├── quants.h
│       │   ├── repack.cpp
│       │   ├── repack.h
│       │   ├── simd-gemm.h
│       │   ├── simd-mappings.h
│       │   ├── spacemit/
│       │   │   ├── ime.cpp
│       │   │   ├── ime.h
│       │   │   ├── ime1_kernels.cpp
│       │   │   └── ime_kernels.h
│       │   ├── traits.cpp
│       │   ├── traits.h
│       │   ├── unary-ops.cpp
│       │   ├── unary-ops.h
│       │   ├── vec.cpp
│       │   └── vec.h
│       ├── ggml-cuda/
│       │   ├── CMakeLists.txt
│       │   ├── acc.cu
│       │   ├── acc.cuh
│       │   ├── add-id.cu
│       │   ├── add-id.cuh
│       │   ├── arange.cu
│       │   ├── arange.cuh
│       │   ├── argmax.cu
│       │   ├── argmax.cuh
│       │   ├── argsort.cu
│       │   ├── argsort.cuh
│       │   ├── binbcast.cu
│       │   ├── binbcast.cuh
│       │   ├── clamp.cu
│       │   ├── clamp.cuh
│       │   ├── common.cuh
│       │   ├── concat.cu
│       │   ├── concat.cuh
│       │   ├── conv-transpose-1d.cu
│       │   ├── conv-transpose-1d.cuh
│       │   ├── conv2d-dw.cu
│       │   ├── conv2d-dw.cuh
│       │   ├── conv2d-transpose.cu
│       │   ├── conv2d-transpose.cuh
│       │   ├── conv2d.cu
│       │   ├── conv2d.cuh
│       │   ├── convert.cu
│       │   ├── convert.cuh
│       │   ├── count-equal.cu
│       │   ├── count-equal.cuh
│       │   ├── cp-async.cuh
│       │   ├── cpy-utils.cuh
│       │   ├── cpy.cu
│       │   ├── cpy.cuh
│       │   ├── cross-entropy-loss.cu
│       │   ├── cross-entropy-loss.cuh
│       │   ├── cumsum.cu
│       │   ├── cumsum.cuh
│       │   ├── dequantize.cuh
│       │   ├── diag.cu
│       │   ├── diag.cuh
│       │   ├── diagmask.cu
│       │   ├── diagmask.cuh
│       │   ├── fattn-common.cuh
│       │   ├── fattn-mma-f16.cuh
│       │   ├── fattn-tile.cu
│       │   ├── fattn-tile.cuh
│       │   ├── fattn-vec.cuh
│       │   ├── fattn-wmma-f16.cu
│       │   ├── fattn-wmma-f16.cuh
│       │   ├── fattn.cu
│       │   ├── fattn.cuh
│       │   ├── fill.cu
│       │   ├── fill.cuh
│       │   ├── gated_delta_net.cu
│       │   ├── gated_delta_net.cuh
│       │   ├── getrows.cu
│       │   ├── getrows.cuh
│       │   ├── ggml-cuda.cu
│       │   ├── gla.cu
│       │   ├── gla.cuh
│       │   ├── im2col.cu
│       │   ├── im2col.cuh
│       │   ├── mean.cu
│       │   ├── mean.cuh
│       │   ├── mma.cuh
│       │   ├── mmf.cu
│       │   ├── mmf.cuh
│       │   ├── mmid.cu
│       │   ├── mmid.cuh
│       │   ├── mmq.cu
│       │   ├── mmq.cuh
│       │   ├── mmvf.cu
│       │   ├── mmvf.cuh
│       │   ├── mmvq.cu
│       │   ├── mmvq.cuh
│       │   ├── norm.cu
│       │   ├── norm.cuh
│       │   ├── opt-step-adamw.cu
│       │   ├── opt-step-adamw.cuh
│       │   ├── opt-step-sgd.cu
│       │   ├── opt-step-sgd.cuh
│       │   ├── out-prod.cu
│       │   ├── out-prod.cuh
│       │   ├── pad.cu
│       │   ├── pad.cuh
│       │   ├── pad_reflect_1d.cu
│       │   ├── pad_reflect_1d.cuh
│       │   ├── pool2d.cu
│       │   ├── pool2d.cuh
│       │   ├── quantize.cu
│       │   ├── quantize.cuh
│       │   ├── reduce_rows.cuh
│       │   ├── roll.cu
│       │   ├── roll.cuh
│       │   ├── rope.cu
│       │   ├── rope.cuh
│       │   ├── scale.cu
│       │   ├── scale.cuh
│       │   ├── set-rows.cu
│       │   ├── set-rows.cuh
│       │   ├── set.cu
│       │   ├── set.cuh
│       │   ├── softcap.cu
│       │   ├── softcap.cuh
│       │   ├── softmax.cu
│       │   ├── softmax.cuh
│       │   ├── solve_tri.cu
│       │   ├── solve_tri.cuh
│       │   ├── ssm-conv.cu
│       │   ├── ssm-conv.cuh
│       │   ├── ssm-scan.cu
│       │   ├── ssm-scan.cuh
│       │   ├── sum.cu
│       │   ├── sum.cuh
│       │   ├── sumrows.cu
│       │   ├── sumrows.cuh
│       │   ├── template-instances/
│       │   │   ├── fattn-mma-f16-instance-ncols1_1-ncols2_16.cu
│       │   │   ├── fattn-mma-f16-instance-ncols1_1-ncols2_32.cu
│       │   │   ├── fattn-mma-f16-instance-ncols1_1-ncols2_8.cu
│       │   │   ├── fattn-mma-f16-instance-ncols1_16-ncols2_1.cu
│       │   │   ├── fattn-mma-f16-instance-ncols1_16-ncols2_2.cu
│       │   │   ├── fattn-mma-f16-instance-ncols1_16-ncols2_4.cu
│       │   │   ├── fattn-mma-f16-instance-ncols1_2-ncols2_16.cu
│       │   │   ├── fattn-mma-f16-instance-ncols1_2-ncols2_32.cu
│       │   │   ├── fattn-mma-f16-instance-ncols1_2-ncols2_4.cu
│       │   │   ├── fattn-mma-f16-instance-ncols1_2-ncols2_8.cu
│       │   │   ├── fattn-mma-f16-instance-ncols1_32-ncols2_1.cu
│       │   │   ├── fattn-mma-f16-instance-ncols1_32-ncols2_2.cu
│       │   │   ├── fattn-mma-f16-instance-ncols1_4-ncols2_16.cu
│       │   │   ├── fattn-mma-f16-instance-ncols1_4-ncols2_2.cu
│       │   │   ├── fattn-mma-f16-instance-ncols1_4-ncols2_4.cu
│       │   │   ├── fattn-mma-f16-instance-ncols1_4-ncols2_8.cu
│       │   │   ├── fattn-mma-f16-instance-ncols1_64-ncols2_1.cu
│       │   │   ├── fattn-mma-f16-instance-ncols1_8-ncols2_1.cu
│       │   │   ├── fattn-mma-f16-instance-ncols1_8-ncols2_2.cu
│       │   │   ├── fattn-mma-f16-instance-ncols1_8-ncols2_4.cu
│       │   │   ├── fattn-mma-f16-instance-ncols1_8-ncols2_8.cu
│       │   │   ├── fattn-tile-instance-dkq112-dv112.cu
│       │   │   ├── fattn-tile-instance-dkq128-dv128.cu
│       │   │   ├── fattn-tile-instance-dkq256-dv256.cu
│       │   │   ├── fattn-tile-instance-dkq40-dv40.cu
│       │   │   ├── fattn-tile-instance-dkq576-dv512.cu
│       │   │   ├── fattn-tile-instance-dkq64-dv64.cu
│       │   │   ├── fattn-tile-instance-dkq72-dv72.cu
│       │   │   ├── fattn-tile-instance-dkq80-dv80.cu
│       │   │   ├── fattn-tile-instance-dkq96-dv96.cu
│       │   │   ├── fattn-vec-instance-f16-f16.cu
│       │   │   ├── fattn-vec-instance-f16-q4_0.cu
│       │   │   ├── fattn-vec-instance-f16-q4_1.cu
│       │   │   ├── fattn-vec-instance-f16-q5_0.cu
│       │   │   ├── fattn-vec-instance-f16-q5_1.cu
│       │   │   ├── fattn-vec-instance-f16-q8_0.cu
│       │   │   ├── fattn-vec-instance-q4_0-f16.cu
│       │   │   ├── fattn-vec-instance-q4_0-q4_0.cu
│       │   │   ├── fattn-vec-instance-q4_0-q4_1.cu
│       │   │   ├── fattn-vec-instance-q4_0-q5_0.cu
│       │   │   ├── fattn-vec-instance-q4_0-q5_1.cu
│       │   │   ├── fattn-vec-instance-q4_0-q8_0.cu
│       │   │   ├── fattn-vec-instance-q4_1-f16.cu
│       │   │   ├── fattn-vec-instance-q4_1-q4_0.cu
│       │   │   ├── fattn-vec-instance-q4_1-q4_1.cu
│       │   │   ├── fattn-vec-instance-q4_1-q5_0.cu
│       │   │   ├── fattn-vec-instance-q4_1-q5_1.cu
│       │   │   ├── fattn-vec-instance-q4_1-q8_0.cu
│       │   │   ├── fattn-vec-instance-q5_0-f16.cu
│       │   │   ├── fattn-vec-instance-q5_0-q4_0.cu
│       │   │   ├── fattn-vec-instance-q5_0-q4_1.cu
│       │   │   ├── fattn-vec-instance-q5_0-q5_0.cu
│       │   │   ├── fattn-vec-instance-q5_0-q5_1.cu
│       │   │   ├── fattn-vec-instance-q5_0-q8_0.cu
│       │   │   ├── fattn-vec-instance-q5_1-f16.cu
│       │   │   ├── fattn-vec-instance-q5_1-q4_0.cu
│       │   │   ├── fattn-vec-instance-q5_1-q4_1.cu
│       │   │   ├── fattn-vec-instance-q5_1-q5_0.cu
│       │   │   ├── fattn-vec-instance-q5_1-q5_1.cu
│       │   │   ├── fattn-vec-instance-q5_1-q8_0.cu
│       │   │   ├── fattn-vec-instance-q8_0-f16.cu
│       │   │   ├── fattn-vec-instance-q8_0-q4_0.cu
│       │   │   ├── fattn-vec-instance-q8_0-q4_1.cu
│       │   │   ├── fattn-vec-instance-q8_0-q5_0.cu
│       │   │   ├── fattn-vec-instance-q8_0-q5_1.cu
│       │   │   ├── fattn-vec-instance-q8_0-q8_0.cu
│       │   │   ├── generate_cu_files.py
│       │   │   ├── mmf-instance-ncols_1.cu
│       │   │   ├── mmf-instance-ncols_10.cu
│       │   │   ├── mmf-instance-ncols_11.cu
│       │   │   ├── mmf-instance-ncols_12.cu
│       │   │   ├── mmf-instance-ncols_13.cu
│       │   │   ├── mmf-instance-ncols_14.cu
│       │   │   ├── mmf-instance-ncols_15.cu
│       │   │   ├── mmf-instance-ncols_16.cu
│       │   │   ├── mmf-instance-ncols_2.cu
│       │   │   ├── mmf-instance-ncols_3.cu
│       │   │   ├── mmf-instance-ncols_4.cu
│       │   │   ├── mmf-instance-ncols_5.cu
│       │   │   ├── mmf-instance-ncols_6.cu
│       │   │   ├── mmf-instance-ncols_7.cu
│       │   │   ├── mmf-instance-ncols_8.cu
│       │   │   ├── mmf-instance-ncols_9.cu
│       │   │   ├── mmq-instance-iq1_s.cu
│       │   │   ├── mmq-instance-iq2_s.cu
│       │   │   ├── mmq-instance-iq2_xs.cu
│       │   │   ├── mmq-instance-iq2_xxs.cu
│       │   │   ├── mmq-instance-iq3_s.cu
│       │   │   ├── mmq-instance-iq3_xxs.cu
│       │   │   ├── mmq-instance-iq4_nl.cu
│       │   │   ├── mmq-instance-iq4_xs.cu
│       │   │   ├── mmq-instance-mxfp4.cu
│       │   │   ├── mmq-instance-q2_k.cu
│       │   │   ├── mmq-instance-q3_k.cu
│       │   │   ├── mmq-instance-q4_0.cu
│       │   │   ├── mmq-instance-q4_1.cu
│       │   │   ├── mmq-instance-q4_k.cu
│       │   │   ├── mmq-instance-q5_0.cu
│       │   │   ├── mmq-instance-q5_1.cu
│       │   │   ├── mmq-instance-q5_k.cu
│       │   │   ├── mmq-instance-q6_k.cu
│       │   │   └── mmq-instance-q8_0.cu
│       │   ├── top-k.cu
│       │   ├── top-k.cuh
│       │   ├── topk-moe.cu
│       │   ├── topk-moe.cuh
│       │   ├── tri.cu
│       │   ├── tri.cuh
│       │   ├── tsembd.cu
│       │   ├── tsembd.cuh
│       │   ├── unary.cu
│       │   ├── unary.cuh
│       │   ├── upscale.cu
│       │   ├── upscale.cuh
│       │   ├── vecdotq.cuh
│       │   ├── vendors/
│       │   │   ├── cuda.h
│       │   │   ├── hip.h
│       │   │   └── musa.h
│       │   ├── wkv.cu
│       │   └── wkv.cuh
│       ├── ggml-hexagon/
│       │   ├── CMakeLists.txt
│       │   ├── ggml-hexagon.cpp
│       │   ├── htp/
│       │   │   ├── CMakeLists.txt
│       │   │   ├── act-ops.c
│       │   │   ├── argsort-ops.c
│       │   │   ├── binary-ops.c
│       │   │   ├── cmake-toolchain.cmake
│       │   │   ├── cpy-ops.c
│       │   │   ├── flash-attn-ops.c
│       │   │   ├── get-rows-ops.c
│       │   │   ├── hex-dma.c
│       │   │   ├── hex-dma.h
│       │   │   ├── hex-dump.h
│       │   │   ├── hex-fastdiv.h
│       │   │   ├── hex-utils.h
│       │   │   ├── htp-ctx.h
│       │   │   ├── htp-msg.h
│       │   │   ├── htp-ops.h
│       │   │   ├── htp_iface.idl
│       │   │   ├── hvx-arith.h
│       │   │   ├── hvx-base.h
│       │   │   ├── hvx-copy.h
│       │   │   ├── hvx-div.h
│       │   │   ├── hvx-dump.h
│       │   │   ├── hvx-exp.h
│       │   │   ├── hvx-floor.h
│       │   │   ├── hvx-inverse.h
│       │   │   ├── hvx-reduce.h
│       │   │   ├── hvx-scale.h
│       │   │   ├── hvx-sigmoid.h
│       │   │   ├── hvx-sqrt.h
│       │   │   ├── hvx-types.h
│       │   │   ├── hvx-utils.h
│       │   │   ├── main.c
│       │   │   ├── matmul-ops.c
│       │   │   ├── rope-ops.c
│       │   │   ├── set-rows-ops.c
│       │   │   ├── softmax-ops.c
│       │   │   ├── ssm-conv.c
│       │   │   ├── sum-rows-ops.c
│       │   │   ├── unary-ops.c
│       │   │   ├── worker-pool.c
│       │   │   └── worker-pool.h
│       │   ├── htp-drv.cpp
│       │   ├── htp-drv.h
│       │   ├── libdl.h
│       │   ├── libggml-htp.inf
│       │   └── op-desc.h
│       ├── ggml-hip/
│       │   └── CMakeLists.txt
│       ├── ggml-impl.h
│       ├── ggml-metal/
│       │   ├── CMakeLists.txt
│       │   ├── ggml-metal-common.cpp
│       │   ├── ggml-metal-common.h
│       │   ├── ggml-metal-context.h
│       │   ├── ggml-metal-context.m
│       │   ├── ggml-metal-device.cpp
│       │   ├── ggml-metal-device.h
│       │   ├── ggml-metal-device.m
│       │   ├── ggml-metal-impl.h
│       │   ├── ggml-metal-ops.cpp
│       │   ├── ggml-metal-ops.h
│       │   ├── ggml-metal.cpp
│       │   └── ggml-metal.metal
│       ├── ggml-musa/
│       │   ├── CMakeLists.txt
│       │   ├── mudnn.cu
│       │   └── mudnn.cuh
│       ├── ggml-opencl/
│       │   ├── CMakeLists.txt
│       │   ├── ggml-opencl.cpp
│       │   └── kernels/
│       │       ├── add.cl
│       │       ├── add_id.cl
│       │       ├── argsort.cl
│       │       ├── clamp.cl
│       │       ├── concat.cl
│       │       ├── conv2d.cl
│       │       ├── conv2d_f16_f32.cl
│       │       ├── cpy.cl
│       │       ├── cumsum.cl
│       │       ├── cvt.cl
│       │       ├── diag.cl
│       │       ├── diag_mask_inf.cl
│       │       ├── div.cl
│       │       ├── embed_kernel.py
│       │       ├── exp.cl
│       │       ├── expm1.cl
│       │       ├── fill.cl
│       │       ├── flash_attn_f16.cl
│       │       ├── flash_attn_f32.cl
│       │       ├── flash_attn_f32_f16.cl
│       │       ├── gelu.cl
│       │       ├── gemm_moe_mxfp4_f32.cl
│       │       ├── gemm_noshuffle_q4_1_f32.cl
│       │       ├── gemv_moe_mxfp4_f32.cl
│       │       ├── gemv_noshuffle.cl
│       │       ├── gemv_noshuffle_general.cl
│       │       ├── gemv_noshuffle_general_q8_0_f32.cl
│       │       ├── gemv_noshuffle_q4_1_f32.cl
│       │       ├── get_rows.cl
│       │       ├── glu.cl
│       │       ├── group_norm.cl
│       │       ├── im2col_f16.cl
│       │       ├── im2col_f32.cl
│       │       ├── l2_norm.cl
│       │       ├── mean.cl
│       │       ├── mul.cl
│       │       ├── mul_mat_Ab_Bi_8x4.cl
│       │       ├── mul_mat_f16_f32.cl
│       │       ├── mul_mm_f16_f32_kq_kqv.cl
│       │       ├── mul_mm_f16_f32_l4_lm.cl
│       │       ├── mul_mm_f32_f32_l4_lm.cl
│       │       ├── mul_mm_q4_0_f32_l4_lm.cl
│       │       ├── mul_mm_q4_1_f32_l4_lm.cl
│       │       ├── mul_mm_q6_k_f32_l4_lm.cl
│       │       ├── mul_mm_q8_0_f32_8x4.cl
│       │       ├── mul_mm_q8_0_f32_l4_lm.cl
│       │       ├── mul_mv_f16_f16.cl
│       │       ├── mul_mv_f16_f32.cl
│       │       ├── mul_mv_f16_f32_1row.cl
│       │       ├── mul_mv_f16_f32_l4.cl
│       │       ├── mul_mv_f32_f32.cl
│       │       ├── mul_mv_id_mxfp4_f32.cl
│       │       ├── mul_mv_id_mxfp4_f32_flat.cl
│       │       ├── mul_mv_id_q4_0_f32_8x_flat.cl
│       │       ├── mul_mv_id_q8_0_f32.cl
│       │       ├── mul_mv_id_q8_0_f32_flat.cl
│       │       ├── mul_mv_mxfp4_f32.cl
│       │       ├── mul_mv_mxfp4_f32_flat.cl
│       │       ├── mul_mv_q4_0_f32.cl
│       │       ├── mul_mv_q4_0_f32_1d_16x_flat.cl
│       │       ├── mul_mv_q4_0_f32_1d_8x_flat.cl
│       │       ├── mul_mv_q4_0_f32_8x_flat.cl
│       │       ├── mul_mv_q4_0_f32_v.cl
│       │       ├── mul_mv_q4_1_f32.cl
│       │       ├── mul_mv_q4_1_f32_flat.cl
│       │       ├── mul_mv_q4_k_f32.cl
│       │       ├── mul_mv_q6_k_f32.cl
│       │       ├── mul_mv_q6_k_f32_flat.cl
│       │       ├── mul_mv_q8_0_f32.cl
│       │       ├── mul_mv_q8_0_f32_flat.cl
│       │       ├── neg.cl
│       │       ├── norm.cl
│       │       ├── pad.cl
│       │       ├── relu.cl
│       │       ├── repeat.cl
│       │       ├── rms_norm.cl
│       │       ├── rope.cl
│       │       ├── scale.cl
│       │       ├── set_rows.cl
│       │       ├── sigmoid.cl
│       │       ├── silu.cl
│       │       ├── softmax_4_f16.cl
│       │       ├── softmax_4_f32.cl
│       │       ├── softmax_f16.cl
│       │       ├── softmax_f32.cl
│       │       ├── softplus.cl
│       │       ├── solve_tri.cl
│       │       ├── sqr.cl
│       │       ├── sqrt.cl
│       │       ├── ssm_conv.cl
│       │       ├── sub.cl
│       │       ├── sum_rows.cl
│       │       ├── tanh.cl
│       │       ├── transpose.cl
│       │       ├── tri.cl
│       │       ├── tsembd.cl
│       │       └── upscale.cl
│       ├── ggml-openvino/
│       │   ├── .clang-format
│       │   ├── CMakeLists.txt
│       │   ├── ggml-decoder.cpp
│       │   ├── ggml-decoder.h
│       │   ├── ggml-openvino-extra.cpp
│       │   ├── ggml-openvino-extra.h
│       │   ├── ggml-openvino.cpp
│       │   ├── ggml-quants.cpp
│       │   ├── ggml-quants.h
│       │   ├── openvino/
│       │   │   ├── decoder.h
│       │   │   ├── frontend.cpp
│       │   │   ├── frontend.h
│       │   │   ├── input_model.cpp
│       │   │   ├── input_model.h
│       │   │   ├── node_context.h
│       │   │   ├── op/
│       │   │   │   ├── cont.cpp
│       │   │   │   ├── cpy.cpp
│       │   │   │   ├── flash_attn_ext.cpp
│       │   │   │   ├── get_rows.cpp
│       │   │   │   ├── glu_geglu.cpp
│       │   │   │   ├── glu_swiglu.cpp
│       │   │   │   ├── mulmat.cpp
│       │   │   │   ├── permute.cpp
│       │   │   │   ├── reshape.cpp
│       │   │   │   ├── rms_norm.cpp
│       │   │   │   ├── rope.cpp
│       │   │   │   ├── scale.cpp
│       │   │   │   ├── set_rows.cpp
│       │   │   │   ├── softmax.cpp
│       │   │   │   ├── transpose.cpp
│       │   │   │   ├── unary_silu.cpp
│       │   │   │   └── view.cpp
│       │   │   ├── op_table.cpp
│       │   │   ├── op_table.h
│       │   │   ├── pass/
│       │   │   │   ├── eliminate_zp.cpp
│       │   │   │   ├── eliminate_zp.h
│       │   │   │   ├── fuse_to_sdpa.cpp
│       │   │   │   ├── fuse_to_sdpa.h
│       │   │   │   ├── mark_decompression_convert_constant_folding.h
│       │   │   │   ├── squeeze_matmul.cpp
│       │   │   │   └── squeeze_matmul.h
│       │   │   ├── translate_session.cpp
│       │   │   ├── translate_session.h
│       │   │   ├── utils.cpp
│       │   │   └── utils.h
│       │   ├── utils.cpp
│       │   └── utils.h
│       ├── ggml-opt.cpp
│       ├── ggml-quants.c
│       ├── ggml-quants.h
│       ├── ggml-rpc/
│       │   ├── CMakeLists.txt
│       │   └── ggml-rpc.cpp
│       ├── ggml-sycl/
│       │   ├── CMakeLists.txt
│       │   ├── add-id.cpp
│       │   ├── add-id.hpp
│       │   ├── backend.hpp
│       │   ├── binbcast.cpp
│       │   ├── binbcast.hpp
│       │   ├── common.cpp
│       │   ├── common.hpp
│       │   ├── concat.cpp
│       │   ├── concat.hpp
│       │   ├── conv.cpp
│       │   ├── conv.hpp
│       │   ├── convert.cpp
│       │   ├── convert.hpp
│       │   ├── count-equal.cpp
│       │   ├── count-equal.hpp
│       │   ├── cpy.cpp
│       │   ├── cpy.hpp
│       │   ├── dequantize.hpp
│       │   ├── dmmv.cpp
│       │   ├── dmmv.hpp
│       │   ├── dpct/
│       │   │   └── helper.hpp
│       │   ├── element_wise.cpp
│       │   ├── element_wise.hpp
│       │   ├── fattn-common.hpp
│       │   ├── fattn-tile.cpp
│       │   ├── fattn-tile.hpp
│       │   ├── fattn-vec.hpp
│       │   ├── fattn.cpp
│       │   ├── fattn.hpp
│       │   ├── gated_delta_net.cpp
│       │   ├── gated_delta_net.hpp
│       │   ├── gemm.hpp
│       │   ├── getrows.cpp
│       │   ├── getrows.hpp
│       │   ├── ggml-sycl.cpp
│       │   ├── gla.cpp
│       │   ├── gla.hpp
│       │   ├── im2col.cpp
│       │   ├── im2col.hpp
│       │   ├── mmq.cpp
│       │   ├── mmq.hpp
│       │   ├── mmvq.cpp
│       │   ├── mmvq.hpp
│       │   ├── norm.cpp
│       │   ├── norm.hpp
│       │   ├── outprod.cpp
│       │   ├── outprod.hpp
│       │   ├── pad.cpp
│       │   ├── pad.hpp
│       │   ├── pad_reflect_1d.cpp
│       │   ├── pad_reflect_1d.hpp
│       │   ├── presets.hpp
│       │   ├── quantize.hpp
│       │   ├── quants.hpp
│       │   ├── repeat_back.cpp
│       │   ├── repeat_back.hpp
│       │   ├── roll.cpp
│       │   ├── roll.hpp
│       │   ├── rope.cpp
│       │   ├── rope.hpp
│       │   ├── set.cpp
│       │   ├── set.hpp
│       │   ├── set_rows.cpp
│       │   ├── set_rows.hpp
│       │   ├── softmax.cpp
│       │   ├── softmax.hpp
│       │   ├── ssm_conv.cpp
│       │   ├── ssm_conv.hpp
│       │   ├── sycl_hw.cpp
│       │   ├── sycl_hw.hpp
│       │   ├── template-instances/
│       │   │   ├── fattn-tile-instance-dkq112-dv112.cpp
│       │   │   ├── fattn-tile-instance-dkq128-dv128.cpp
│       │   │   ├── fattn-tile-instance-dkq256-dv256.cpp
│       │   │   ├── fattn-tile-instance-dkq40-dv40.cpp
│       │   │   ├── fattn-tile-instance-dkq576-dv512.cpp
│       │   │   ├── fattn-tile-instance-dkq64-dv64.cpp
│       │   │   ├── fattn-tile-instance-dkq72-dv72.cpp
│       │   │   ├── fattn-tile-instance-dkq80-dv80.cpp
│       │   │   ├── fattn-tile-instance-dkq96-dv96.cpp
│       │   │   ├── fattn-vec-instance-f16-f16.cpp
│       │   │   ├── fattn-vec-instance-f16-q4_0.cpp
│       │   │   ├── fattn-vec-instance-f16-q4_1.cpp
│       │   │   ├── fattn-vec-instance-f16-q5_0.cpp
│       │   │   ├── fattn-vec-instance-f16-q5_1.cpp
│       │   │   ├── fattn-vec-instance-f16-q8_0.cpp
│       │   │   ├── fattn-vec-instance-q4_0-f16.cpp
│       │   │   ├── fattn-vec-instance-q4_0-q4_0.cpp
│       │   │   ├── fattn-vec-instance-q4_0-q4_1.cpp
│       │   │   ├── fattn-vec-instance-q4_0-q5_0.cpp
│       │   │   ├── fattn-vec-instance-q4_0-q5_1.cpp
│       │   │   ├── fattn-vec-instance-q4_0-q8_0.cpp
│       │   │   ├── fattn-vec-instance-q4_1-f16.cpp
│       │   │   ├── fattn-vec-instance-q4_1-q4_0.cpp
│       │   │   ├── fattn-vec-instance-q4_1-q4_1.cpp
│       │   │   ├── fattn-vec-instance-q4_1-q5_0.cpp
│       │   │   ├── fattn-vec-instance-q4_1-q5_1.cpp
│       │   │   ├── fattn-vec-instance-q4_1-q8_0.cpp
│       │   │   ├── fattn-vec-instance-q5_0-f16.cpp
│       │   │   ├── fattn-vec-instance-q5_0-q4_0.cpp
│       │   │   ├── fattn-vec-instance-q5_0-q4_1.cpp
│       │   │   ├── fattn-vec-instance-q5_0-q5_0.cpp
│       │   │   ├── fattn-vec-instance-q5_0-q5_1.cpp
│       │   │   ├── fattn-vec-instance-q5_0-q8_0.cpp
│       │   │   ├── fattn-vec-instance-q5_1-f16.cpp
│       │   │   ├── fattn-vec-instance-q5_1-q4_0.cpp
│       │   │   ├── fattn-vec-instance-q5_1-q4_1.cpp
│       │   │   ├── fattn-vec-instance-q5_1-q5_0.cpp
│       │   │   ├── fattn-vec-instance-q5_1-q5_1.cpp
│       │   │   ├── fattn-vec-instance-q5_1-q8_0.cpp
│       │   │   ├── fattn-vec-instance-q8_0-f16.cpp
│       │   │   ├── fattn-vec-instance-q8_0-q4_0.cpp
│       │   │   ├── fattn-vec-instance-q8_0-q4_1.cpp
│       │   │   ├── fattn-vec-instance-q8_0-q5_0.cpp
│       │   │   ├── fattn-vec-instance-q8_0-q5_1.cpp
│       │   │   └── fattn-vec-instance-q8_0-q8_0.cpp
│       │   ├── tsembd.cpp
│       │   ├── tsembd.hpp
│       │   ├── vecdotq.hpp
│       │   ├── wkv.cpp
│       │   └── wkv.hpp
│       ├── ggml-threading.cpp
│       ├── ggml-threading.h
│       ├── ggml-virtgpu/
│       │   ├── CMakeLists.txt
│       │   ├── apir_cs_ggml-rpc-front.cpp
│       │   ├── backend/
│       │   │   ├── CMakeLists.txt
│       │   │   ├── apir_cs_ggml-rpc-back.cpp
│       │   │   ├── backend-convert.h
│       │   │   ├── backend-dispatched-backend.cpp
│       │   │   ├── backend-dispatched-buffer-type.cpp
│       │   │   ├── backend-dispatched-buffer.cpp
│       │   │   ├── backend-dispatched-device.cpp
│       │   │   ├── backend-dispatched.cpp
│       │   │   ├── backend-dispatched.gen.h
│       │   │   ├── backend-dispatched.h
│       │   │   ├── backend-virgl-apir.h
│       │   │   ├── backend.cpp
│       │   │   └── shared/
│       │   │       ├── api_remoting.h
│       │   │       ├── apir_backend.gen.h
│       │   │       ├── apir_backend.h
│       │   │       ├── apir_cs.h
│       │   │       ├── apir_cs_ggml.h
│       │   │       └── apir_cs_rpc.h
│       │   ├── ggml-backend-buffer-type.cpp
│       │   ├── ggml-backend-buffer.cpp
│       │   ├── ggml-backend-device.cpp
│       │   ├── ggml-backend-reg.cpp
│       │   ├── ggml-backend.cpp
│       │   ├── ggml-remoting.h
│       │   ├── ggmlremoting_functions.yaml
│       │   ├── include/
│       │   │   └── apir_hw.h
│       │   ├── regenerate_remoting.py
│       │   ├── virtgpu-apir.h
│       │   ├── virtgpu-forward-backend.cpp
│       │   ├── virtgpu-forward-buffer-type.cpp
│       │   ├── virtgpu-forward-buffer.cpp
│       │   ├── virtgpu-forward-device.cpp
│       │   ├── virtgpu-forward-impl.h
│       │   ├── virtgpu-forward.gen.h
│       │   ├── virtgpu-shm.cpp
│       │   ├── virtgpu-shm.h
│       │   ├── virtgpu-utils.cpp
│       │   ├── virtgpu-utils.h
│       │   ├── virtgpu.cpp
│       │   └── virtgpu.h
│       ├── ggml-vulkan/
│       │   ├── CMakeLists.txt
│       │   ├── cmake/
│       │   │   └── host-toolchain.cmake.in
│       │   ├── ggml-vulkan.cpp
│       │   └── vulkan-shaders/
│       │       ├── CMakeLists.txt
│       │       ├── abs.comp
│       │       ├── acc.comp
│       │       ├── add.comp
│       │       ├── add1.comp
│       │       ├── add_id.comp
│       │       ├── arange.comp
│       │       ├── argmax.comp
│       │       ├── argsort.comp
│       │       ├── argsort_large.comp
│       │       ├── ceil.comp
│       │       ├── clamp.comp
│       │       ├── concat.comp
│       │       ├── contig_copy.comp
│       │       ├── conv2d_dw.comp
│       │       ├── conv2d_mm.comp
│       │       ├── conv_transpose_1d.comp
│       │       ├── copy.comp
│       │       ├── copy_from_quant.comp
│       │       ├── copy_to_quant.comp
│       │       ├── copy_transpose.comp
│       │       ├── cos.comp
│       │       ├── count_equal.comp
│       │       ├── count_experts.comp
│       │       ├── cumsum.comp
│       │       ├── cumsum_multipass1.comp
│       │       ├── cumsum_multipass2.comp
│       │       ├── dequant_f32.comp
│       │       ├── dequant_funcs.glsl
│       │       ├── dequant_funcs_cm2.glsl
│       │       ├── dequant_head.glsl
│       │       ├── dequant_iq1_m.comp
│       │       ├── dequant_iq1_s.comp
│       │       ├── dequant_iq2_s.comp
│       │       ├── dequant_iq2_xs.comp
│       │       ├── dequant_iq2_xxs.comp
│       │       ├── dequant_iq3_s.comp
│       │       ├── dequant_iq3_xxs.comp
│       │       ├── dequant_iq4_nl.comp
│       │       ├── dequant_iq4_xs.comp
│       │       ├── dequant_mxfp4.comp
│       │       ├── dequant_q2_k.comp
│       │       ├── dequant_q3_k.comp
│       │       ├── dequant_q4_0.comp
│       │       ├── dequant_q4_1.comp
│       │       ├── dequant_q4_k.comp
│       │       ├── dequant_q5_0.comp
│       │       ├── dequant_q5_1.comp
│       │       ├── dequant_q5_k.comp
│       │       ├── dequant_q6_k.comp
│       │       ├── dequant_q8_0.comp
│       │       ├── diag.comp
│       │       ├── diag_mask_inf.comp
│       │       ├── div.comp
│       │       ├── elu.comp
│       │       ├── exp.comp
│       │       ├── feature-tests/
│       │       │   ├── bfloat16.comp
│       │       │   ├── coopmat.comp
│       │       │   ├── coopmat2.comp
│       │       │   └── integer_dot.comp
│       │       ├── fill.comp
│       │       ├── flash_attn.comp
│       │       ├── flash_attn_base.glsl
│       │       ├── flash_attn_cm1.comp
│       │       ├── flash_attn_cm2.comp
│       │       ├── flash_attn_mask_opt.comp
│       │       ├── flash_attn_split_k_reduce.comp
│       │       ├── floor.comp
│       │       ├── gated_delta_net.comp
│       │       ├── geglu.comp
│       │       ├── geglu_erf.comp
│       │       ├── geglu_quick.comp
│       │       ├── gelu.comp
│       │       ├── gelu_erf.comp
│       │       ├── gelu_quick.comp
│       │       ├── generic_binary_head.glsl
│       │       ├── generic_head.glsl
│       │       ├── generic_unary_head.glsl
│       │       ├── get_rows.comp
│       │       ├── get_rows_quant.comp
│       │       ├── glu_head.glsl
│       │       ├── glu_main.glsl
│       │       ├── group_norm.comp
│       │       ├── hardsigmoid.comp
│       │       ├── hardswish.comp
│       │       ├── im2col.comp
│       │       ├── im2col_3d.comp
│       │       ├── l2_norm.comp
│       │       ├── leaky_relu.comp
│       │       ├── log.comp
│       │       ├── mul.comp
│       │       ├── mul_mat_split_k_reduce.comp
│       │       ├── mul_mat_vec.comp
│       │       ├── mul_mat_vec_base.glsl
│       │       ├── mul_mat_vec_iface.glsl
│       │       ├── mul_mat_vec_iq1_m.comp
│       │       ├── mul_mat_vec_iq1_s.comp
│       │       ├── mul_mat_vec_iq2_s.comp
│       │       ├── mul_mat_vec_iq2_xs.comp
│       │       ├── mul_mat_vec_iq2_xxs.comp
│       │       ├── mul_mat_vec_iq3_s.comp
│       │       ├── mul_mat_vec_iq3_xxs.comp
│       │       ├── mul_mat_vec_nc.comp
│       │       ├── mul_mat_vec_p021.comp
│       │       ├── mul_mat_vec_q2_k.comp
│       │       ├── mul_mat_vec_q3_k.comp
│       │       ├── mul_mat_vec_q4_k.comp
│       │       ├── mul_mat_vec_q5_k.comp
│       │       ├── mul_mat_vec_q6_k.comp
│       │       ├── mul_mat_vecq.comp
│       │       ├── mul_mat_vecq_funcs.glsl
│       │       ├── mul_mm.comp
│       │       ├── mul_mm_cm2.comp
│       │       ├── mul_mm_funcs.glsl
│       │       ├── mul_mm_id_funcs.glsl
│       │       ├── mul_mmq.comp
│       │       ├── mul_mmq_funcs.glsl
│       │       ├── mul_mmq_shmem_types.glsl
│       │       ├── multi_add.comp
│       │       ├── neg.comp
│       │       ├── norm.comp
│       │       ├── opt_step_adamw.comp
│       │       ├── opt_step_sgd.comp
│       │       ├── pad.comp
│       │       ├── pool2d.comp
│       │       ├── quantize_q8_1.comp
│       │       ├── reglu.comp
│       │       ├── relu.comp
│       │       ├── repeat.comp
│       │       ├── repeat_back.comp
│       │       ├── rms_norm.comp
│       │       ├── rms_norm_back.comp
│       │       ├── rms_norm_partials.comp
│       │       ├── roll.comp
│       │       ├── rope_funcs.glsl
│       │       ├── rope_head.glsl
│       │       ├── rope_multi.comp
│       │       ├── rope_neox.comp
│       │       ├── rope_norm.comp
│       │       ├── rope_params.glsl
│       │       ├── rope_vision.comp
│       │       ├── round.comp
│       │       ├── rte.glsl
│       │       ├── scale.comp
│       │       ├── sgn.comp
│       │       ├── sigmoid.comp
│       │       ├── silu.comp
│       │       ├── silu_back.comp
│       │       ├── sin.comp
│       │       ├── soft_max.comp
│       │       ├── soft_max_back.comp
│       │       ├── soft_max_large1.comp
│       │       ├── soft_max_large2.comp
│       │       ├── soft_max_large3.comp
│       │       ├── soft_max_large_common.glsl
│       │       ├── softplus.comp
│       │       ├── solve_tri.comp
│       │       ├── sqrt.comp
│       │       ├── square.comp
│       │       ├── ssm_conv.comp
│       │       ├── ssm_scan.comp
│       │       ├── step.comp
│       │       ├── sub.comp
│       │       ├── sum_rows.comp
│       │       ├── sum_rows.glsl
│       │       ├── swiglu.comp
│       │       ├── swiglu_oai.comp
│       │       ├── tanh.comp
│       │       ├── timestep_embedding.comp
│       │       ├── topk_argsort.comp
│       │       ├── topk_moe.comp
│       │       ├── topk_nary_search.comp
│       │       ├── tri.comp
│       │       ├── trunc.comp
│       │       ├── types.glsl
│       │       ├── upscale.comp
│       │       ├── utils.glsl
│       │       ├── vulkan-shaders-gen.cpp
│       │       ├── wkv6.comp
│       │       ├── wkv7.comp
│       │       └── xielu.comp
│       ├── ggml-webgpu/
│       │   ├── CMakeLists.txt
│       │   ├── ggml-webgpu-shader-lib.hpp
│       │   ├── ggml-webgpu.cpp
│       │   ├── pre_wgsl.hpp
│       │   └── wgsl-shaders/
│       │       ├── argmax.wgsl
│       │       ├── argsort.wgsl
│       │       ├── argsort_merge.wgsl
│       │       ├── binary.wgsl
│       │       ├── common_decls.tmpl
│       │       ├── concat.wgsl
│       │       ├── cpy.tmpl.wgsl
│       │       ├── cumsum.wgsl
│       │       ├── embed_wgsl.py
│       │       ├── flash_attn.wgsl
│       │       ├── get_rows.wgsl
│       │       ├── glu.tmpl.wgsl
│       │       ├── memset.wgsl
│       │       ├── mul_mat.wgsl
│       │       ├── mul_mat_decls.tmpl
│       │       ├── mul_mat_reg_tile.wgsl
│       │       ├── mul_mat_subgroup_matrix.wgsl
│       │       ├── mul_mat_vec.wgsl
│       │       ├── pad.wgsl
│       │       ├── repeat.wgsl
│       │       ├── rms_norm.wgsl
│       │       ├── rope.tmpl.wgsl
│       │       ├── scale.wgsl
│       │       ├── set_rows.wgsl
│       │       ├── soft_max.tmpl.wgsl
│       │       ├── sum_rows.wgsl
│       │       └── unary.wgsl
│       ├── ggml-zdnn/
│       │   ├── .gitignore
│       │   ├── CMakeLists.txt
│       │   ├── common.hpp
│       │   ├── ggml-zdnn.cpp
│       │   ├── mmf.cpp
│       │   ├── mmf.hpp
│       │   ├── utils.cpp
│       │   └── utils.hpp
│       ├── ggml-zendnn/
│       │   ├── CMakeLists.txt
│       │   └── ggml-zendnn.cpp
│       ├── ggml.c
│       ├── ggml.cpp
│       └── gguf.cpp
├── grammars/
│   ├── assistant.gbnf
│   ├── chess.gbnf
│   └── colors.gbnf
├── include/
│   └── whisper.h
├── models/
│   ├── .gitignore
│   ├── README.md
│   ├── convert-h5-to-coreml.py
│   ├── convert-h5-to-ggml.py
│   ├── convert-pt-to-ggml.py
│   ├── convert-silero-vad-to-ggml.py
│   ├── convert-whisper-to-coreml.py
│   ├── convert-whisper-to-openvino.py
│   ├── download-coreml-model.sh
│   ├── download-ggml-model.cmd
│   ├── download-ggml-model.sh
│   ├── download-vad-model.cmd
│   ├── download-vad-model.sh
│   ├── generate-coreml-interface.sh
│   ├── generate-coreml-model.sh
│   ├── ggml_to_pt.py
│   ├── requirements-coreml.txt
│   └── requirements-openvino.txt
├── scripts/
│   ├── apple/
│   │   ├── validate-apps.sh
│   │   ├── validate-ios.sh
│   │   ├── validate-macos.sh
│   │   ├── validate-tvos.sh
│   │   └── validate-visionos.sh
│   ├── bench-all-gg.txt
│   ├── bench-all.sh
│   ├── bench-wts.sh
│   ├── bench.py
│   ├── build-info.sh
│   ├── convert-all.sh
│   ├── deploy-wasm.sh
│   ├── gen-authors.sh
│   ├── get-flags.mk
│   ├── quantize-all.sh
│   ├── sha-all.sh
│   ├── sync-ggml-am.sh
│   ├── sync-ggml.last
│   ├── sync-ggml.sh
│   └── sync-llama.sh
├── src/
│   ├── CMakeLists.txt
│   ├── coreml/
│   │   ├── whisper-compat.h
│   │   ├── whisper-compat.m
│   │   ├── whisper-decoder-impl.h
│   │   ├── whisper-decoder-impl.m
│   │   ├── whisper-encoder-impl.h
│   │   ├── whisper-encoder-impl.m
│   │   ├── whisper-encoder.h
│   │   └── whisper-encoder.mm
│   ├── openvino/
│   │   ├── whisper-openvino-encoder.cpp
│   │   └── whisper-openvino-encoder.h
│   ├── whisper-arch.h
│   └── whisper.cpp
└── tests/
    ├── .gitignore
    ├── CMakeLists.txt
    ├── earnings21/
    │   ├── .gitignore
    │   ├── Makefile
    │   ├── README.md
    │   ├── eval.mk
    │   ├── eval.py
    │   └── normalizers/
    │       ├── LICENSE
    │       ├── __init__.py
    │       ├── basic.py
    │       ├── english.json
    │       └── english.py
    ├── en-0-ref.txt
    ├── en-1-ref.txt
    ├── en-2-ref.txt
    ├── es-0-ref.txt
    ├── librispeech/
    │   ├── .gitignore
    │   ├── Makefile
    │   ├── README.md
    │   ├── eval.mk
    │   ├── eval.py
    │   └── normalizers/
    │       ├── LICENSE
    │       ├── __init__.py
    │       ├── basic.py
    │       ├── english.json
    │       └── english.py
    ├── run-tests.sh
    ├── test-c.c
    ├── test-vad-full.cpp
    ├── test-vad.cpp
    └── test-whisper.js
Copy disabled (too large) Download .json
Condensed preview — 1580 files, each showing path, character count, and a content snippet. Download the .json file for the full structured content (16,230K chars).
[
  {
    "path": ".devops/cublas.Dockerfile",
    "chars": 613,
    "preview": "ARG UBUNTU_VERSION=22.04\n\n# This needs to generally match the container host's environment.\nARG CUDA_VERSION=11.7.1\n\n# T"
  },
  {
    "path": ".devops/main-cuda.Dockerfile",
    "chars": 1653,
    "preview": "ARG UBUNTU_VERSION=22.04\n# This needs to generally match the container host's environment.\nARG CUDA_VERSION=13.0.0\n# Tar"
  },
  {
    "path": ".devops/main-intel.Dockerfile",
    "chars": 873,
    "preview": "ARG ONEAPI_VERSION=2025.1.1-0-devel-ubuntu24.04\n\nFROM intel/oneapi-basekit:$ONEAPI_VERSION AS build\nWORKDIR /app\n\nRUN ap"
  },
  {
    "path": ".devops/main-musa.Dockerfile",
    "chars": 1323,
    "preview": "ARG UBUNTU_VERSION=22.04\n# This needs to generally match the container host's environment.\nARG MUSA_VERSION=rc4.2.0\n# Ta"
  },
  {
    "path": ".devops/main-vulkan.Dockerfile",
    "chars": 562,
    "preview": "FROM ubuntu:24.04 AS build\nWORKDIR /app\n\nRUN apt-get update && \\\n  apt-get install -y build-essential wget cmake git lib"
  },
  {
    "path": ".devops/main.Dockerfile",
    "chars": 482,
    "preview": "FROM ubuntu:22.04 AS build\nWORKDIR /app\n\nRUN apt-get update && \\\n  apt-get install -y build-essential wget cmake git \\\n "
  },
  {
    "path": ".dockerignore",
    "chars": 25,
    "preview": "build*/\n.github/\n.devops/"
  },
  {
    "path": ".github/workflows/bindings-go.yml",
    "chars": 387,
    "preview": "name: Bindings Tests (Go)\non:\n  push:\n    paths:\n      - bindings/go/**\n      - whisper.h\n  pull_request:\n    paths:\n   "
  },
  {
    "path": ".github/workflows/bindings-ruby.yml",
    "chars": 386,
    "preview": "name: Bindings Tests (Ruby)\n\non:\n  push:\n    branches:\n      - master\n  pull_request:\n    types: [opened, synchronize, r"
  },
  {
    "path": ".github/workflows/build.yml",
    "chars": 53132,
    "preview": "name: CI\n\non:\n  push:\n    branches:\n      - master\n    tags:\n      - 'v*'\n    paths: ['.github/workflows/build.yml',\n   "
  },
  {
    "path": ".github/workflows/docker.yml",
    "chars": 2464,
    "preview": "name: Publish Docker image\n\non:\n  pull_request:\n  push:\n    branches:\n      - master\n\njobs:\n  push_to_registry:\n    name"
  },
  {
    "path": ".github/workflows/examples-wasm.yml",
    "chars": 2756,
    "preview": "name: Examples WASM\non:\n  push:\n    branches: [\"master\"]\n\n  workflow_dispatch:\n\npermissions:\n  contents: read\n  pages: w"
  },
  {
    "path": ".github/workflows/examples.yml",
    "chars": 1149,
    "preview": "name: Examples Tests\non:\n  push:\n    paths:\n      - examples/addon.node/**\n      - whisper.h\n  pull_request:\n    paths:\n"
  },
  {
    "path": ".gitignore",
    "chars": 865,
    "preview": "*.o\n*.a\n*.d\n.cache/\n.coreml/\n.test/\n.venv/\n.vs/\n.vscode/\n.DS_Store\n.vimspector.json\n/CMakeSettings.json\n/talk-llama.dSYM"
  },
  {
    "path": "AUTHORS",
    "chars": 21681,
    "preview": "# date: Tue Feb  4 13:03:35 EET 2025\n# this file is auto-generated by scripts/gen-authors.sh\n\n0/0 <zero@imaskeleton.me>\n"
  },
  {
    "path": "CMakeLists.txt",
    "chars": 10024,
    "preview": "cmake_minimum_required(VERSION 3.5) # for add_link_options and implicit target directories.\nproject(\"whisper.cpp\" C CXX)"
  },
  {
    "path": "LICENSE",
    "chars": 1078,
    "preview": "MIT License\n\nCopyright (c) 2023-2026 The ggml authors\n\nPermission is hereby granted, free of charge, to any person obtai"
  },
  {
    "path": "Makefile",
    "chars": 2170,
    "preview": "#\n# Audio samples\n#\n\n.PHONY: build\nbuild:\n\tcmake -B build $(CMAKE_ARGS)\n\tcmake --build build --config Release\n\n# downloa"
  },
  {
    "path": "README.md",
    "chars": 36005,
    "preview": "# whisper.cpp\n\n![whisper.cpp](https://user-images.githubusercontent.com/1991296/235238348-05d0f6a4-da44-4900-a1de-d0707e"
  },
  {
    "path": "README_sycl.md",
    "chars": 6588,
    "preview": "# whisper.cpp for SYCL\n\n[Background](#background)\n\n[OS](#os)\n\n[Intel GPU](#intel-gpu)\n\n[Linux](#linux)\n\n[Environment Var"
  },
  {
    "path": "bindings/CMakeLists.txt",
    "chars": 656,
    "preview": "if (EMSCRIPTEN)\n    add_subdirectory(javascript)\n\n    add_custom_command(\n        OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/jav"
  },
  {
    "path": "bindings/go/.gitignore",
    "chars": 13,
    "preview": "build\nmodels\n"
  },
  {
    "path": "bindings/go/LICENSE",
    "chars": 1069,
    "preview": "MIT License\n\nCopyright (c) 2022 David Thorpe\n\nPermission is hereby granted, free of charge, to any person obtaining a co"
  },
  {
    "path": "bindings/go/Makefile",
    "chars": 2436,
    "preview": "ifndef UNAME_S\nUNAME_S := $(shell uname -s)\nendif\n\nifndef UNAME_P\nUNAME_P := $(shell uname -p)\nendif\n\nifndef UNAME_M\nUNA"
  },
  {
    "path": "bindings/go/README.md",
    "chars": 2915,
    "preview": "# Go bindings for Whisper\n\nThis package provides Go bindings for whisper.cpp. They have been tested on:\n\n  * Darwin (OS "
  },
  {
    "path": "bindings/go/doc.go",
    "chars": 142,
    "preview": "/*\ngithub.com/ggml-org/whisper.cpp/bindings/go\nprovides a speech-to-text service bindings for the Go programming languag"
  },
  {
    "path": "bindings/go/examples/go-model-download/context.go",
    "chars": 684,
    "preview": "package main\n\nimport (\n\t\"context\"\n\t\"os\"\n\t\"os/signal\"\n)\n\n// ContextForSignal returns a context object which is cancelled "
  },
  {
    "path": "bindings/go/examples/go-model-download/main.go",
    "chars": 8028,
    "preview": "package main\n\nimport (\n\t\"context\"\n\t\"flag\"\n\t\"fmt\"\n\t\"io\"\n\t\"net/http\"\n\t\"net/url\"\n\t\"os\"\n\t\"path/filepath\"\n\t\"strings\"\n\t\"syscal"
  },
  {
    "path": "bindings/go/examples/go-whisper/color.go",
    "chars": 625,
    "preview": "package main\n\nimport \"fmt\"\n\n///////////////////////////////////////////////////////////////////////////////\n// CONSTANTS"
  },
  {
    "path": "bindings/go/examples/go-whisper/flags.go",
    "chars": 4355,
    "preview": "package main\n\nimport (\n\t\"flag\"\n\t\"fmt\"\n\t\"strings\"\n\t\"time\"\n\n\t// Packages\n\twhisper \"github.com/ggerganov/whisper.cpp/bindin"
  },
  {
    "path": "bindings/go/examples/go-whisper/main.go",
    "chars": 878,
    "preview": "package main\n\nimport (\n\t\"flag\"\n\t\"fmt\"\n\t\"os\"\n\t\"path/filepath\"\n\n\t// Packages\n\twhisper \"github.com/ggerganov/whisper.cpp/bi"
  },
  {
    "path": "bindings/go/examples/go-whisper/process.go",
    "chars": 3300,
    "preview": "package main\n\nimport (\n\t\"fmt\"\n\t\"io\"\n\t\"os\"\n\t\"time\"\n\n\t// Package imports\n\twhisper \"github.com/ggerganov/whisper.cpp/bindin"
  },
  {
    "path": "bindings/go/go.mod",
    "chars": 380,
    "preview": "module github.com/ggerganov/whisper.cpp/bindings/go\n\ngo 1.23\n\nrequire (\n\tgithub.com/go-audio/wav v1.1.0\n\tgithub.com/stre"
  },
  {
    "path": "bindings/go/go.sum",
    "chars": 1382,
    "preview": "github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=\ngithub.com/davecgh/go-spew v1.1.1/go.m"
  },
  {
    "path": "bindings/go/params.go",
    "chars": 5321,
    "preview": "package whisper\n\nimport (\n\t\"fmt\"\n)\n\n///////////////////////////////////////////////////////////////////////////////\n// C"
  },
  {
    "path": "bindings/go/pkg/whisper/consts.go",
    "chars": 799,
    "preview": "package whisper\n\nimport (\n\t\"errors\"\n\n\t// Bindings\n\twhisper \"github.com/ggerganov/whisper.cpp/bindings/go\"\n)\n\n///////////"
  },
  {
    "path": "bindings/go/pkg/whisper/context.go",
    "chars": 10077,
    "preview": "package whisper\n\nimport (\n\t\"fmt\"\n\t\"io\"\n\t\"runtime\"\n\t\"strings\"\n\t\"time\"\n\n\t// Bindings\n\twhisper \"github.com/ggerganov/whispe"
  },
  {
    "path": "bindings/go/pkg/whisper/context_test.go",
    "chars": 2709,
    "preview": "package whisper_test\n\nimport (\n\t\"os\"\n\t\"testing\"\n\n\t\"github.com/ggerganov/whisper.cpp/bindings/go/pkg/whisper\"\n\t\"github.co"
  },
  {
    "path": "bindings/go/pkg/whisper/doc.go",
    "chars": 85,
    "preview": "/*\nThis is the higher-level speech-to-text whisper.cpp API for go\n*/\npackage whisper\n"
  },
  {
    "path": "bindings/go/pkg/whisper/interface.go",
    "chars": 4050,
    "preview": "package whisper\n\nimport (\n\t\"io\"\n\t\"time\"\n)\n\n/////////////////////////////////////////////////////////////////////////////"
  },
  {
    "path": "bindings/go/pkg/whisper/model.go",
    "chars": 2300,
    "preview": "package whisper\n\nimport (\n\t\"fmt\"\n\t\"os\"\n\t\"runtime\"\n\n\t// Bindings\n\twhisper \"github.com/ggerganov/whisper.cpp/bindings/go\"\n"
  },
  {
    "path": "bindings/go/pkg/whisper/model_test.go",
    "chars": 2246,
    "preview": "package whisper_test\n\nimport (\n\t\"testing\"\n\n\t\"github.com/ggerganov/whisper.cpp/bindings/go/pkg/whisper\"\n\tassert \"github.c"
  },
  {
    "path": "bindings/go/pkg/whisper/util_test.go",
    "chars": 117,
    "preview": "package whisper_test\n\nconst (\n\tModelPath  = \"../../models/ggml-small.en.bin\"\n\tSamplePath = \"../../samples/jfk.wav\"\n)\n"
  },
  {
    "path": "bindings/go/whisper.go",
    "chars": 16252,
    "preview": "package whisper\n\nimport (\n\t\"errors\"\n\t\"unsafe\"\n)\n\n///////////////////////////////////////////////////////////////////////"
  },
  {
    "path": "bindings/go/whisper_test.go",
    "chars": 2815,
    "preview": "package whisper_test\n\nimport (\n\t\"os\"\n\t\"runtime\"\n\t\"testing\"\n\t\"time\"\n\n\t// Packages\n\twhisper \"github.com/ggerganov/whisper."
  },
  {
    "path": "bindings/java/README.md",
    "chars": 2883,
    "preview": "# Java JNI bindings for Whisper\n\nThis package provides Java JNI bindings for whisper.cpp. They have been tested on:\n\n  *"
  },
  {
    "path": "bindings/java/build.gradle",
    "chars": 4319,
    "preview": "plugins {\r\n    id 'java'\r\n    id 'java-library'\r\n    id 'maven-publish'\r\n    id 'signing'\r\n}\r\n\r\narchivesBaseName = 'whis"
  },
  {
    "path": "bindings/java/gradle/wrapper/gradle-wrapper.properties",
    "chars": 221,
    "preview": "distributionBase=GRADLE_USER_HOME\ndistributionPath=wrapper/dists\ndistributionUrl=https\\://services.gradle.org/distributi"
  },
  {
    "path": "bindings/java/gradle.properties",
    "chars": 295,
    "preview": "org.gradle.jvmargs=-Xms256m -Xmx1024m\r\nsystem.include.dir=/usr/include\r\n#system.local.include.dir=../../include\r\nsystem."
  },
  {
    "path": "bindings/java/gradlew",
    "chars": 8472,
    "preview": "#!/bin/sh\n\n#\n# Copyright © 2015-2021 the original authors.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lice"
  },
  {
    "path": "bindings/java/gradlew.bat",
    "chars": 2868,
    "preview": "@rem\r\n@rem Copyright 2015 the original author or authors.\r\n@rem\r\n@rem Licensed under the Apache License, Version 2.0 (th"
  },
  {
    "path": "bindings/java/settings.gradle",
    "chars": 33,
    "preview": "rootProject.name = \"whispercpp\"\r\n"
  },
  {
    "path": "bindings/java/src/main/java/io/github/ggerganov/whispercpp/WhisperConstants.java",
    "chars": 1072,
    "preview": "package io.github.ggerganov.whispercpp;\n\n/**\n * Presets for alignment heads in DTW token timestamps\n */\npublic class Whi"
  },
  {
    "path": "bindings/java/src/main/java/io/github/ggerganov/whispercpp/WhisperContext.java",
    "chars": 1137,
    "preview": "package io.github.ggerganov.whispercpp;\r\n\r\nimport com.sun.jna.NativeLong;\r\nimport com.sun.jna.Structure;\r\nimport com.sun"
  },
  {
    "path": "bindings/java/src/main/java/io/github/ggerganov/whispercpp/WhisperCpp.java",
    "chars": 7918,
    "preview": "package io.github.ggerganov.whispercpp;\r\n\r\nimport com.sun.jna.Native;\r\nimport com.sun.jna.Pointer;\r\nimport io.github.gge"
  },
  {
    "path": "bindings/java/src/main/java/io/github/ggerganov/whispercpp/WhisperCppJnaLibrary.java",
    "chars": 15941,
    "preview": "package io.github.ggerganov.whispercpp;\r\n\r\nimport com.sun.jna.Library;\r\nimport com.sun.jna.Native;\r\nimport com.sun.jna.P"
  },
  {
    "path": "bindings/java/src/main/java/io/github/ggerganov/whispercpp/bean/WhisperSegment.java",
    "chars": 834,
    "preview": "package io.github.ggerganov.whispercpp.bean;\n\n/**\n * Created by litonglinux@qq.com on 10/21/2023_7:48 AM\n */\npublic clas"
  },
  {
    "path": "bindings/java/src/main/java/io/github/ggerganov/whispercpp/callbacks/GgmlAbortCallback.java",
    "chars": 486,
    "preview": "package io.github.ggerganov.whispercpp.callbacks;\n\nimport com.sun.jna.Callback;\n\n/**\n * Callback for aborting GGML compu"
  },
  {
    "path": "bindings/java/src/main/java/io/github/ggerganov/whispercpp/callbacks/WhisperEncoderBeginCallback.java",
    "chars": 801,
    "preview": "package io.github.ggerganov.whispercpp.callbacks;\r\n\r\nimport com.sun.jna.Callback;\r\nimport com.sun.jna.Pointer;\r\nimport i"
  },
  {
    "path": "bindings/java/src/main/java/io/github/ggerganov/whispercpp/callbacks/WhisperLogitsFilterCallback.java",
    "chars": 879,
    "preview": "package io.github.ggerganov.whispercpp.callbacks;\r\n\r\nimport com.sun.jna.Callback;\r\nimport com.sun.jna.Pointer;\r\nimport i"
  },
  {
    "path": "bindings/java/src/main/java/io/github/ggerganov/whispercpp/callbacks/WhisperNewSegmentCallback.java",
    "chars": 811,
    "preview": "package io.github.ggerganov.whispercpp.callbacks;\r\n\r\nimport com.sun.jna.Callback;\r\nimport com.sun.jna.Pointer;\r\nimport i"
  },
  {
    "path": "bindings/java/src/main/java/io/github/ggerganov/whispercpp/callbacks/WhisperProgressCallback.java",
    "chars": 667,
    "preview": "package io.github.ggerganov.whispercpp.callbacks;\r\n\r\nimport com.sun.jna.Callback;\r\nimport com.sun.jna.Pointer;\r\nimport i"
  },
  {
    "path": "bindings/java/src/main/java/io/github/ggerganov/whispercpp/ggml/GgmlTensor.java",
    "chars": 78,
    "preview": "package io.github.ggerganov.whispercpp.ggml;\r\n\r\npublic class GgmlTensor {\r\n}\r\n"
  },
  {
    "path": "bindings/java/src/main/java/io/github/ggerganov/whispercpp/ggml/GgmlType.java",
    "chars": 437,
    "preview": "package io.github.ggerganov.whispercpp.ggml;\r\n\r\npublic enum GgmlType {\r\n    GGML_TYPE_F32,\r\n    GGML_TYPE_F16,\r\n    GGML"
  },
  {
    "path": "bindings/java/src/main/java/io/github/ggerganov/whispercpp/model/EModel.java",
    "chars": 183,
    "preview": "package io.github.ggerganov.whispercpp.model;\r\n\r\npublic enum EModel {\r\n    MODEL_UNKNOWN,\r\n    MODEL_TINY,\r\n    MODEL_BA"
  },
  {
    "path": "bindings/java/src/main/java/io/github/ggerganov/whispercpp/model/WhisperModel.java",
    "chars": 1208,
    "preview": "package io.github.ggerganov.whispercpp;\r\n\r\nimport io.github.ggerganov.whispercpp.ggml.GgmlTensor;\r\nimport io.github.gger"
  },
  {
    "path": "bindings/java/src/main/java/io/github/ggerganov/whispercpp/model/WhisperModelLoader.java",
    "chars": 1605,
    "preview": "package io.github.ggerganov.whispercpp.model;\r\n\r\nimport com.sun.jna.Callback;\r\nimport com.sun.jna.Pointer;\r\nimport com.s"
  },
  {
    "path": "bindings/java/src/main/java/io/github/ggerganov/whispercpp/model/WhisperState.java",
    "chars": 81,
    "preview": "package io.github.ggerganov.whispercpp.model;\r\n\r\npublic class WhisperState {\r\n}\r\n"
  },
  {
    "path": "bindings/java/src/main/java/io/github/ggerganov/whispercpp/model/WhisperTokenData.java",
    "chars": 1194,
    "preview": "package io.github.ggerganov.whispercpp.model;\r\n\r\nimport com.sun.jna.Structure;\r\n\r\nimport java.util.Arrays;\r\nimport java."
  },
  {
    "path": "bindings/java/src/main/java/io/github/ggerganov/whispercpp/params/BeamSearchParams.java",
    "chars": 586,
    "preview": "package io.github.ggerganov.whispercpp.params;\r\n\r\nimport com.sun.jna.Structure;\r\n\r\nimport java.util.Arrays;\r\nimport java"
  },
  {
    "path": "bindings/java/src/main/java/io/github/ggerganov/whispercpp/params/CBool.java",
    "chars": 676,
    "preview": "package io.github.ggerganov.whispercpp.params;\r\n\r\nimport com.sun.jna.IntegerType;\r\n\r\nimport java.util.function.BooleanSu"
  },
  {
    "path": "bindings/java/src/main/java/io/github/ggerganov/whispercpp/params/GreedyParams.java",
    "chars": 476,
    "preview": "package io.github.ggerganov.whispercpp.params;\r\n\r\nimport com.sun.jna.Structure;\r\n\r\nimport java.util.Collections;\r\nimport"
  },
  {
    "path": "bindings/java/src/main/java/io/github/ggerganov/whispercpp/params/WhisperAhead.java",
    "chars": 716,
    "preview": "package io.github.ggerganov.whispercpp.params;\nimport com.sun.jna.*;\nimport java.util.Arrays;\nimport java.util.List;\n\npu"
  },
  {
    "path": "bindings/java/src/main/java/io/github/ggerganov/whispercpp/params/WhisperAheads.java",
    "chars": 1175,
    "preview": "package io.github.ggerganov.whispercpp.params;\nimport com.sun.jna.*;\nimport java.util.Arrays;\nimport java.util.List;\n\npu"
  },
  {
    "path": "bindings/java/src/main/java/io/github/ggerganov/whispercpp/params/WhisperContextParams.java",
    "chars": 2306,
    "preview": "package io.github.ggerganov.whispercpp.params;\nimport com.sun.jna.*;\nimport java.util.Arrays;\nimport java.util.List;\n\n/*"
  },
  {
    "path": "bindings/java/src/main/java/io/github/ggerganov/whispercpp/params/WhisperFilters.java",
    "chars": 167,
    "preview": "package io.github.ggerganov.whispercpp.params;\r\n\r\nimport java.util.List;\r\n\r\npublic class WhisperFilters {\r\n    int n_mel"
  },
  {
    "path": "bindings/java/src/main/java/io/github/ggerganov/whispercpp/params/WhisperFullParams.java",
    "chars": 12427,
    "preview": "package io.github.ggerganov.whispercpp.params;\r\n\r\nimport com.sun.jna.*;\r\nimport io.github.ggerganov.whispercpp.callbacks"
  },
  {
    "path": "bindings/java/src/main/java/io/github/ggerganov/whispercpp/params/WhisperHParams.java",
    "chars": 406,
    "preview": "package io.github.ggerganov.whispercpp.params;\r\n\r\npublic class WhisperHParams {\r\n    int n_vocab       = 51864;\r\n    int"
  },
  {
    "path": "bindings/java/src/main/java/io/github/ggerganov/whispercpp/params/WhisperSamplingStrategy.java",
    "chars": 292,
    "preview": "package io.github.ggerganov.whispercpp.params;\r\n\r\n/** Available sampling strategies */\r\npublic enum WhisperSamplingStrat"
  },
  {
    "path": "bindings/java/src/test/java/io/github/ggerganov/whispercpp/WhisperCppTest.java",
    "chars": 6236,
    "preview": "package io.github.ggerganov.whispercpp;\r\n\r\nimport static org.junit.jupiter.api.Assertions.*;\r\n\r\nimport io.github.ggergan"
  },
  {
    "path": "bindings/java/src/test/java/io/github/ggerganov/whispercpp/WhisperJnaLibraryTest.java",
    "chars": 614,
    "preview": "package io.github.ggerganov.whispercpp;\r\n\r\nimport static org.junit.jupiter.api.Assertions.*;\r\n\r\nimport org.junit.jupiter"
  },
  {
    "path": "bindings/javascript/.gitignore",
    "chars": 12,
    "preview": "publish.log\n"
  },
  {
    "path": "bindings/javascript/CMakeLists.txt",
    "chars": 991,
    "preview": "set(TARGET libwhisper)\n\nadd_executable(${TARGET}\n    emscripten.cpp\n    )\n\ntarget_link_libraries(${TARGET} PRIVATE\n    w"
  },
  {
    "path": "bindings/javascript/README.md",
    "chars": 2660,
    "preview": "# whisper.cpp\n\nNode.js package for Whisper speech recognition\n\nPackage: https://www.npmjs.com/package/whisper.cpp\n\n## De"
  },
  {
    "path": "bindings/javascript/emscripten.cpp",
    "chars": 3048,
    "preview": "//\n// This is the Javascript API of whisper.cpp\n//\n// Very crude at the moment.\n// Feel free to contribute and make this"
  },
  {
    "path": "bindings/javascript/libwhisper.worker.js",
    "chars": 2907,
    "preview": "\"use strict\";var Module={};var ENVIRONMENT_IS_NODE=typeof process==\"object\"&&typeof process.versions==\"object\"&&typeof p"
  },
  {
    "path": "bindings/javascript/package-tmpl.json",
    "chars": 612,
    "preview": "{\n  \"name\": \"whisper.cpp\",\n  \"version\": \"@PROJECT_VERSION@\",\n  \"description\": \"Whisper speech recognition\",\n  \"main\": \"w"
  },
  {
    "path": "bindings/javascript/package.json",
    "chars": 600,
    "preview": "{\n  \"name\": \"whisper.cpp\",\n  \"version\": \"1.8.4\",\n  \"description\": \"Whisper speech recognition\",\n  \"main\": \"whisper.js\",\n"
  },
  {
    "path": "bindings/javascript/whisper.js",
    "chars": 960825,
    "preview": "\nvar whisper_factory = (() => {\n  var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document."
  },
  {
    "path": "bindings/ruby/.gitignore",
    "chars": 101,
    "preview": "LICENSE\npkg/\nlib/whisper.*\next/examples/\next/ggml/\next/include/\next/scripts/\next/src/\ntest/fixtures/\n"
  },
  {
    "path": "bindings/ruby/README.md",
    "chars": 12376,
    "preview": "whispercpp\n==========\n\n![whisper.cpp](https://user-images.githubusercontent.com/1991296/235238348-05d0f6a4-da44-4900-a1d"
  },
  {
    "path": "bindings/ruby/Rakefile",
    "chars": 2336,
    "preview": "require 'rake/clean'\nrequire \"bundler/gem_tasks\"\nrequire \"rake/testtask\"\nrequire_relative \"extsources\"\n\nSOURCES_DIR = \"e"
  },
  {
    "path": "bindings/ruby/ext/.gitignore",
    "chars": 110,
    "preview": "Makefile\nwhisper.so\nwhisper.bundle\nwhisper.dll\n*.o\n*.a\nsources/*\n!sources/CMakeGraphVizOptions.cmake\nmkmf.log\n"
  },
  {
    "path": "bindings/ruby/ext/dependencies.rb",
    "chars": 1630,
    "preview": "require \"tsort\"\n\nclass Dependencies\n  include TSort\n\n  def initialize(cmake, options)\n    @cmake = cmake\n    @options = "
  },
  {
    "path": "bindings/ruby/ext/extconf.rb",
    "chars": 765,
    "preview": "require \"mkmf\"\nrequire_relative \"options\"\nrequire_relative \"dependencies\"\n\ncmake = find_executable(\"cmake\") || abort\nopt"
  },
  {
    "path": "bindings/ruby/ext/options.rb",
    "chars": 2268,
    "preview": "class Options\n  def initialize(cmake=\"cmake\")\n    @cmake = cmake\n    @options = {}\n\n    configure\n  end\n\n  def to_s\n    "
  },
  {
    "path": "bindings/ruby/ext/ruby_whisper.c",
    "chars": 7242,
    "preview": "#include \"ruby_whisper.h\"\n\nVALUE mWhisper;\nVALUE mVAD;\nVALUE cContext;\nVALUE cParams;\nVALUE cVADContext;\nVALUE cVADParam"
  },
  {
    "path": "bindings/ruby/ext/ruby_whisper.h",
    "chars": 2762,
    "preview": "#ifndef RUBY_WHISPER_H\n#define RUBY_WHISPER_H\n\n#include <ruby.h>\n#include <ruby/memory_view.h>\n#include \"whisper.h\"\n\ntyp"
  },
  {
    "path": "bindings/ruby/ext/ruby_whisper_context.c",
    "chars": 21651,
    "preview": "#include \"ruby_whisper.h\"\n\nextern ID id_to_s;\nextern ID id___method__;\nextern ID id_to_enum;\nextern ID id_length;\nextern"
  },
  {
    "path": "bindings/ruby/ext/ruby_whisper_context_params.c",
    "chars": 4487,
    "preview": "#include \"ruby_whisper.h\"\n\n#define NUM_PARAMS 6\n\n#define DEF_BOOLEAN_ATTR_METHOD(name) \\\nstatic VALUE \\\nruby_whisper_con"
  },
  {
    "path": "bindings/ruby/ext/ruby_whisper_error.c",
    "chars": 1220,
    "preview": "#include <ruby.h>\n\nextern VALUE eError;\n\nVALUE ruby_whisper_error_initialize(VALUE self, VALUE code)\n{\n  const int c_cod"
  },
  {
    "path": "bindings/ruby/ext/ruby_whisper_model.c",
    "chars": 6003,
    "preview": "#include \"ruby_whisper.h\"\n\nextern const rb_data_type_t ruby_whisper_type;\n\nextern VALUE cModel;\n\nstatic void rb_whisper_"
  },
  {
    "path": "bindings/ruby/ext/ruby_whisper_params.c",
    "chars": 37471,
    "preview": "#include \"ruby_whisper.h\"\n\n#define BOOL_PARAMS_SETTER(self, prop, value) \\\n  ruby_whisper_params *rwp; \\\n  TypedData_Get"
  },
  {
    "path": "bindings/ruby/ext/ruby_whisper_segment.c",
    "chars": 8017,
    "preview": "#include \"ruby_whisper.h\"\n\n#define N_KEY_NAMES 6\n\nextern ID id___method__;\nextern ID id_to_enum;\nstatic VALUE sym_start_"
  },
  {
    "path": "bindings/ruby/ext/ruby_whisper_token.c",
    "chars": 8658,
    "preview": "#include \"ruby_whisper.h\"\n\n#define N_KEY_NAMES 11\n\nextern VALUE cToken;\nextern const rb_data_type_t ruby_whisper_type;\n\n"
  },
  {
    "path": "bindings/ruby/ext/ruby_whisper_transcribe.cpp",
    "chars": 2863,
    "preview": "#include \"ruby_whisper.h\"\n#include \"common-whisper.h\"\n#include <string>\n#include <vector>\n\n#ifdef __cplusplus\nextern \"C\""
  },
  {
    "path": "bindings/ruby/ext/ruby_whisper_vad_context.c",
    "chars": 3608,
    "preview": "#include \"ruby_whisper.h\"\n\nextern ID id_to_s;\n\nextern VALUE cVADContext;\n\nextern const rb_data_type_t ruby_whisper_vad_p"
  },
  {
    "path": "bindings/ruby/ext/ruby_whisper_vad_context_detect.cpp",
    "chars": 1448,
    "preview": "#include \"ruby_whisper.h\"\n#include \"common-whisper.h\"\n#include <string>\n#include <vector>\n\n#ifdef __cplusplus\nextern \"C\""
  },
  {
    "path": "bindings/ruby/ext/ruby_whisper_vad_params.c",
    "chars": 7923,
    "preview": "#include \"ruby_whisper.h\"\n\n#define DEFINE_PARAM(param_name, nth) \\\n  id_ ## param_name = rb_intern(#param_name); \\\n  par"
  },
  {
    "path": "bindings/ruby/ext/ruby_whisper_vad_segment.c",
    "chars": 3868,
    "preview": "#include \"ruby_whisper.h\"\n\n#define N_KEY_NAMES 2\n\nextern VALUE cVADSegment;\n\nextern const rb_data_type_t ruby_whisper_va"
  },
  {
    "path": "bindings/ruby/ext/ruby_whisper_vad_segments.c",
    "chars": 2646,
    "preview": "#include \"ruby_whisper.h\"\n\nextern ID id___method__;\nextern ID id_to_enum;\n\nextern VALUE cVADSegments;\n\nextern VALUE rb_w"
  },
  {
    "path": "bindings/ruby/ext/sources/CMakeGraphVizOptions.cmake",
    "chars": 266,
    "preview": "set(GRAPHVIZ_EXECUTABLES FALSE)\nset(GRAPHVIZ_STATIC_LIBS TRUE)\nset(GRAPHVIZ_SHARED_LIBS FALSE)\nset(GRAPHVIZ_MODULE_LIBS "
  },
  {
    "path": "bindings/ruby/extsources.rb",
    "chars": 860,
    "preview": "require \"pathname\"\n\nroot = Pathname(\"..\")/\"..\"\nignored_dirs = %w[\n  .devops\n  .github\n  ci\n  examples/wchess/wchess.wasm"
  },
  {
    "path": "bindings/ruby/lib/whisper/context.rb",
    "chars": 368,
    "preview": "module Whisper\n  class Context\n    def to_srt\n      each_segment.with_index.reduce(\"\") {|srt, (segment, index)|\n        "
  },
  {
    "path": "bindings/ruby/lib/whisper/model/uri.rb",
    "chars": 6146,
    "preview": "require \"uri\"\nrequire \"net/http\"\nrequire \"time\"\nrequire \"pathname\"\nrequire \"io/console/size\"\n\nmodule Whisper\n  class Mod"
  },
  {
    "path": "bindings/ruby/lib/whisper/segment.rb",
    "chars": 1118,
    "preview": "module Whisper\n  class Segment\n    SRT_ESCAPES = {\n      \"&\" => \"&amp;\",\n      \"<\" => \"&lt;\",\n      \">\" => \"&gt;\",\n    }"
  },
  {
    "path": "bindings/ruby/sig/whisper.rbs",
    "chars": 20528,
    "preview": "module Whisper\n  interface _Samples\n    def length: () -> Integer\n    def each: { (Float) -> void } -> void\n  end\n\n  typ"
  },
  {
    "path": "bindings/ruby/test/helper.rb",
    "chars": 484,
    "preview": "require \"test/unit\"\nrequire \"whisper\"\nrequire_relative \"jfk_reader/jfk_reader\"\n\nclass TestBase < Test::Unit::TestCase\n  "
  },
  {
    "path": "bindings/ruby/test/jfk_reader/.gitignore",
    "chars": 69,
    "preview": "Makefile\njfk_reader.o\njfk_reader.so\njfk_reader.bundle\njfk_reader.dll\n"
  },
  {
    "path": "bindings/ruby/test/jfk_reader/extconf.rb",
    "chars": 46,
    "preview": "require \"mkmf\"\n\ncreate_makefile(\"jfk_reader\")\n"
  },
  {
    "path": "bindings/ruby/test/jfk_reader/jfk_reader.c",
    "chars": 1728,
    "preview": "#include <ruby.h>\n#include <ruby/memory_view.h>\n#include <ruby/encoding.h>\n\nstatic VALUE\njfk_reader_initialize(VALUE sel"
  },
  {
    "path": "bindings/ruby/test/test_callback.rb",
    "chars": 5433,
    "preview": "require_relative \"helper\"\n\nclass TestCallback < TestBase\n  def setup\n    GC.start\n    @params = Whisper::Params.new\n    "
  },
  {
    "path": "bindings/ruby/test/test_context_params.rb",
    "chars": 2174,
    "preview": "require_relative \"helper\"\n\nclass TestContextParams < TestBase\n  PARAM_NAMES = [\n    :use_gpu,\n    :flash_attn,\n    :gpu_"
  },
  {
    "path": "bindings/ruby/test/test_error.rb",
    "chars": 451,
    "preview": "require_relative \"helper\"\n\nclass TestError < TestBase\n  def test_error\n    error = Whisper::Error.new(-2)\n    assert_equ"
  },
  {
    "path": "bindings/ruby/test/test_model.rb",
    "chars": 3670,
    "preview": "require_relative \"helper\"\nrequire \"pathname\"\n\nclass TestModel < TestBase\n  def test_model\n    whisper = Whisper::Context"
  },
  {
    "path": "bindings/ruby/test/test_package.rb",
    "chars": 1929,
    "preview": "require_relative \"helper\"\nrequire 'tempfile'\nrequire 'tmpdir'\nrequire 'shellwords'\n\nclass TestPackage < TestBase\n  def t"
  },
  {
    "path": "bindings/ruby/test/test_params.rb",
    "chars": 8139,
    "preview": "require_relative \"helper\"\n\nclass TestParams < TestBase\n  PARAM_NAMES = [\n    :language,\n    :translate,\n    :no_context,"
  },
  {
    "path": "bindings/ruby/test/test_segment.rb",
    "chars": 4242,
    "preview": "require_relative \"helper\"\n\nclass TestSegment < TestBase\n  def test_iteration\n    whisper.each_segment do |segment|\n     "
  },
  {
    "path": "bindings/ruby/test/test_token.rb",
    "chars": 2372,
    "preview": "require_relative \"helper\"\n\nclass TestToken < TestBase\n  def setup\n    @segment = whisper.each_segment.first\n    @token ="
  },
  {
    "path": "bindings/ruby/test/test_vad.rb",
    "chars": 486,
    "preview": "require_relative \"helper\"\n\nclass TestVAD < TestBase\n  def setup\n    @whisper = Whisper::Context.new(\"base.en\")\n    vad_p"
  },
  {
    "path": "bindings/ruby/test/test_vad_context.rb",
    "chars": 2771,
    "preview": "require_relative \"helper\"\n\nclass TestVADContext < TestBase\n  def test_initialize\n    context = Whisper::VAD::Context.new"
  },
  {
    "path": "bindings/ruby/test/test_vad_params.rb",
    "chars": 2572,
    "preview": "require_relative \"helper\"\n\nclass TestVADParams < TestBase\n  PARAM_NAMES = [\n    :threshold,\n    :min_speech_duration_ms,"
  },
  {
    "path": "bindings/ruby/test/test_vad_segment.rb",
    "chars": 309,
    "preview": "require_relative \"helper\"\n\nclass TestVADSegment < TestBase\n  def test_initialize\n    segment = Whisper::VAD::Segment.new"
  },
  {
    "path": "bindings/ruby/test/test_vad_segments.rb",
    "chars": 257,
    "preview": "require_relative \"helper\"\n\nclass TestVADSegments < TestBase\n  def test_initialize\n    segments = Whisper::VAD::Segments."
  },
  {
    "path": "bindings/ruby/test/test_whisper.rb",
    "chars": 9943,
    "preview": "require_relative \"helper\"\nrequire \"stringio\"\nrequire \"etc\"\nrequire \"pathname\"\n\n# Exists to detect memory-related bug\nWhi"
  },
  {
    "path": "bindings/ruby/whispercpp.gemspec",
    "chars": 1162,
    "preview": "require_relative \"extsources\"\n\nGem::Specification.new do |s|\n  s.name    = \"whispercpp\"\n  s.authors = [\"Georgi Gerganov\""
  },
  {
    "path": "build-xcframework.sh",
    "chars": 23200,
    "preview": "#!/bin/bash\n#\n# Options\nIOS_MIN_OS_VERSION=16.4\nMACOS_MIN_OS_VERSION=13.3\nVISIONOS_MIN_OS_VERSION=1.0\nTVOS_MIN_OS_VERSIO"
  },
  {
    "path": "ci/README.md",
    "chars": 1770,
    "preview": "# CI\n\nIn addition to [Github Actions](https://github.com/ggerganov/whisper.cpp/actions) `whisper.cpp` uses a custom CI f"
  },
  {
    "path": "ci/run.sh",
    "chars": 10945,
    "preview": "#!/bin/bash\n#\n# sample usage:\n#\n# mkdir tmp\n#\n# # CPU-only build\n# bash ./ci/run.sh ./tmp/results ./tmp/mnt\n#\n# # with C"
  },
  {
    "path": "close-issue.yml",
    "chars": 939,
    "preview": "name: Close inactive issues\non:\n  schedule:\n    - cron: \"42 0 * * *\"\n\n# Fine-grant permission\n# https://docs.github.com/"
  },
  {
    "path": "cmake/DefaultTargetOptions.cmake",
    "chars": 385,
    "preview": "# Set the default compile features and properties for a target.\n\nif (NOT TARGET)\n    message(FATAL_ERROR \"TARGET not set"
  },
  {
    "path": "cmake/FindFFmpeg.cmake",
    "chars": 6231,
    "preview": "# From\n# https://github.com/snikulov/cmake-modules/blob/master/FindFFmpeg.cmake\n#\n# vim: ts=2 sw=2\n# - Try to find the r"
  },
  {
    "path": "cmake/arm64-apple-clang.cmake",
    "chars": 555,
    "preview": "set( CMAKE_SYSTEM_NAME Darwin )\nset( CMAKE_SYSTEM_PROCESSOR arm64 )\n\nset( target arm64-apple-darwin-macho )\n\nset( CMAKE_"
  },
  {
    "path": "cmake/arm64-windows-llvm.cmake",
    "chars": 592,
    "preview": "set( CMAKE_SYSTEM_NAME Windows )\nset( CMAKE_SYSTEM_PROCESSOR arm64 )\n\nset( target arm64-pc-windows-msvc )\n\nset( CMAKE_C_"
  },
  {
    "path": "cmake/build-info.cmake",
    "chars": 1723,
    "preview": "set(BUILD_NUMBER 0)\nset(BUILD_COMMIT \"unknown\")\nset(BUILD_COMPILER \"unknown\")\nset(BUILD_TARGET \"unknown\")\n\n# Look for gi"
  },
  {
    "path": "cmake/git-vars.cmake",
    "chars": 717,
    "preview": "find_package(Git)\n\n# the commit's SHA1\nexecute_process(COMMAND\n    \"${GIT_EXECUTABLE}\" describe --match=NeVeRmAtCh --alw"
  },
  {
    "path": "cmake/riscv64-spacemit-linux-gnu-gcc.cmake",
    "chars": 1357,
    "preview": "set(CMAKE_SYSTEM_NAME Linux)\nset(CMAKE_SYSTEM_PROCESSOR riscv64)\nset(CMAKE_SYSTEM_VERSION 1)\n\nif (CMAKE_HOST_SYSTEM_PROC"
  },
  {
    "path": "cmake/whisper-config.cmake.in",
    "chars": 1020,
    "preview": "set(WHISPER_VERSION      @WHISPER_INSTALL_VERSION@)\nset(WHISPER_BUILD_COMMIT @WHISPER_BUILD_COMMIT@)\nset(WHISPER_BUILD_N"
  },
  {
    "path": "cmake/whisper.pc.in",
    "chars": 274,
    "preview": "prefix=@CMAKE_INSTALL_PREFIX@\nexec_prefix=${prefix}\nlibdir=${exec_prefix}/lib\nincludedir=${prefix}/include\n\nName: whispe"
  },
  {
    "path": "cmake/x64-windows-llvm.cmake",
    "chars": 139,
    "preview": "set( CMAKE_SYSTEM_NAME Windows )\nset( CMAKE_SYSTEM_PROCESSOR x86_64 )\n\nset( CMAKE_C_COMPILER    clang )\nset( CMAKE_CXX_C"
  },
  {
    "path": "examples/CMakeLists.txt",
    "chars": 3599,
    "preview": "# dependencies\n\nfind_package(Threads REQUIRED)\n\n# third-party\n\nif (WHISPER_SDL2)\n    # SDL2\n    find_package(SDL2 REQUIR"
  },
  {
    "path": "examples/addon.node/.gitignore",
    "chars": 25,
    "preview": ".idea\nnode_modules\nbuild\n"
  },
  {
    "path": "examples/addon.node/CMakeLists.txt",
    "chars": 1288,
    "preview": "set(TARGET addon.node)\n\n# Base settings\n#==================================================================\n# env var su"
  },
  {
    "path": "examples/addon.node/README.md",
    "chars": 3655,
    "preview": "# whisper.cpp Node.js addon\n\nThis is an addon demo that can **perform whisper model reasoning in `node` and `electron` e"
  },
  {
    "path": "examples/addon.node/__test__/whisper.spec.js",
    "chars": 4098,
    "preview": "const { join } = require('path');\nconst { whisper } = require('../../../build/Release/addon.node');\nconst { promisify } "
  },
  {
    "path": "examples/addon.node/addon.cpp",
    "chars": 21399,
    "preview": "#include \"napi.h\"\n#include \"common.h\"\n#include \"common-whisper.h\"\n\n#include \"whisper.h\"\n\n#include <string>\n#include <thr"
  },
  {
    "path": "examples/addon.node/index.js",
    "chars": 1525,
    "preview": "const path = require('path');\nconst os = require('os');\n\nconst isWindows = os.platform() === 'win32';\nconst buildPath = "
  },
  {
    "path": "examples/addon.node/package.json",
    "chars": 285,
    "preview": "{\n  \"name\": \"addon.node\",\n  \"version\": \"0.0.0\",\n  \"description\": \"\",\n  \"main\": \"index.js\",\n  \"author\": \"Qanhe Chen\",\n  \""
  },
  {
    "path": "examples/addon.node/vad-example.js",
    "chars": 4495,
    "preview": "const path = require(\"path\");\nconst { whisper } = require(path.join(\n  __dirname,\n  \"../../build/Release/addon.node\"\n));"
  },
  {
    "path": "examples/bench/CMakeLists.txt",
    "chars": 205,
    "preview": "set(TARGET whisper-bench)\nadd_executable(${TARGET} bench.cpp)\n\ninclude(DefaultTargetOptions)\n\ntarget_link_libraries(${TA"
  },
  {
    "path": "examples/bench/README.md",
    "chars": 1989,
    "preview": "# whisper.cpp/examples/bench\n\nA very basic tool for benchmarking the inference performance on your device. The tool simp"
  },
  {
    "path": "examples/bench/bench.cpp",
    "chars": 7161,
    "preview": "#include \"whisper.h\"\n\n#include <cstdio>\n#include <cstring>\n#include <string>\n#include <thread>\n\n// command-line paramete"
  },
  {
    "path": "examples/bench.wasm/CMakeLists.txt",
    "chars": 1171,
    "preview": "#\n# libbench\n#\n\nset(TARGET libbench)\n\nadd_executable(${TARGET}\n    emscripten.cpp\n    )\n\ninclude(DefaultTargetOptions)\n\n"
  },
  {
    "path": "examples/bench.wasm/README.md",
    "chars": 1572,
    "preview": "# bench.wasm\n\nBenchmark the performance of whisper.cpp in the browser using WebAssembly\n\nLink: https://ggml.ai/whisper.c"
  },
  {
    "path": "examples/bench.wasm/emscripten.cpp",
    "chars": 2713,
    "preview": "#include \"whisper.h\"\n\n#include <emscripten.h>\n#include <emscripten/bind.h>\n\n#include <cmath>\n#include <string>\n#include "
  },
  {
    "path": "examples/bench.wasm/index-tmpl.html",
    "chars": 12616,
    "preview": "<!doctype html>\n<html lang=\"en-us\">\n    <head>\n        <title>bench : Benchmark whisper.cpp performance in the browser</"
  },
  {
    "path": "examples/cli/CMakeLists.txt",
    "chars": 228,
    "preview": "set(TARGET whisper-cli)\nadd_executable(${TARGET} cli.cpp)\n\ninclude(DefaultTargetOptions)\n\ntarget_link_libraries(${TARGET"
  },
  {
    "path": "examples/cli/README.md",
    "chars": 4534,
    "preview": "# whisper.cpp/examples/cli\r\n\r\nThis is the main example demonstrating most of the functionality of the Whisper model.\r\nIt"
  },
  {
    "path": "examples/cli/cli.cpp",
    "chars": 62063,
    "preview": "#include \"common.h\"\n#include \"common-whisper.h\"\n\n#include \"whisper.h\"\n#include \"grammar-parser.h\"\n\n#include <cmath>\n#inc"
  },
  {
    "path": "examples/coi-serviceworker.js",
    "chars": 6028,
    "preview": "/*! coi-serviceworker v0.1.7 - Guido Zuidhof and contributors, licensed under MIT */\nlet coepCredentialless = false;\nif "
  },
  {
    "path": "examples/command/CMakeLists.txt",
    "chars": 274,
    "preview": "if (WHISPER_SDL2)\n    set(TARGET whisper-command)\n    add_executable(${TARGET} command.cpp)\n\n    include(DefaultTargetOp"
  },
  {
    "path": "examples/command/README.md",
    "chars": 1972,
    "preview": "# whisper.cpp/examples/command\r\n\r\nThis is a basic Voice Assistant example that accepts voice commands from the microphon"
  },
  {
    "path": "examples/command/command.cpp",
    "chars": 31495,
    "preview": "// Voice assistant example\n//\n// Speak short text commands to the microphone.\n// This program will detect your voice com"
  },
  {
    "path": "examples/command/commands.txt",
    "chars": 54,
    "preview": "enable\ndisable\ncat\ndog\napple\nred\nblue\ngreen\nlightblue\n"
  },
  {
    "path": "examples/command.wasm/CMakeLists.txt",
    "chars": 1191,
    "preview": "#\n# libcommand\n#\n\nset(TARGET libcommand)\n\nadd_executable(${TARGET}\n    emscripten.cpp\n    )\n\ninclude(DefaultTargetOption"
  },
  {
    "path": "examples/command.wasm/README.md",
    "chars": 1630,
    "preview": "# command.wasm\n\nThis is a basic Voice Assistant example that accepts voice commands from the microphone.\nIt runs in full"
  },
  {
    "path": "examples/command.wasm/emscripten.cpp",
    "chars": 10458,
    "preview": "#include \"ggml.h\"\n#include \"common.h\"\n#include \"whisper.h\"\n\n#include <emscripten.h>\n#include <emscripten/bind.h>\n\n#inclu"
  },
  {
    "path": "examples/command.wasm/index-tmpl.html",
    "chars": 16263,
    "preview": "<!doctype html>\n<html lang=\"en-us\">\n    <head>\n        <title>command : Voice assistant example using Whisper + WebAssem"
  },
  {
    "path": "examples/common-ggml.cpp",
    "chars": 8695,
    "preview": "#include \"common-ggml.h\"\n\n#include <regex>\n#include <map>\n\nstatic const std::map<std::string, enum ggml_ftype> GGML_FTYP"
  },
  {
    "path": "examples/common-ggml.h",
    "chars": 410,
    "preview": "#pragma once\n\n#include \"ggml.h\"\n\n#include <fstream>\n#include <vector>\n#include <string>\n\nenum ggml_ftype ggml_parse_ftyp"
  },
  {
    "path": "examples/common-sdl.cpp",
    "chars": 6560,
    "preview": "#include \"common-sdl.h\"\n\n#include <cstdio>\n\naudio_async::audio_async(int len_ms) {\n    m_len_ms = len_ms;\n\n    m_running"
  },
  {
    "path": "examples/common-sdl.h",
    "chars": 975,
    "preview": "#pragma once\n\n#include <SDL.h>\n#include <SDL_audio.h>\n\n#include <atomic>\n#include <cstdint>\n#include <vector>\n#include <"
  },
  {
    "path": "examples/common-whisper.cpp",
    "chars": 5195,
    "preview": "#define _USE_MATH_DEFINES // for M_PI\n\n#include \"common-whisper.h\"\n\n#include \"common.h\"\n\n#include \"whisper.h\"\n\n// third-"
  },
  {
    "path": "examples/common-whisper.h",
    "chars": 919,
    "preview": "#pragma once\n\n#include <string>\n#include <vector>\n#include <cstdint>\n\n// Read WAV audio file and store the PCM data into"
  },
  {
    "path": "examples/common.cpp",
    "chars": 23275,
    "preview": "#define _USE_MATH_DEFINES // for M_PI\n\n#include \"common.h\"\n\n#include <cmath>\n#include <codecvt>\n#include <cstring>\n#incl"
  },
  {
    "path": "examples/common.h",
    "chars": 9629,
    "preview": "// Various helper functions and utilities\n\n#pragma once\n\n#include <string>\n#include <map>\n#include <vector>\n#include <ra"
  },
  {
    "path": "examples/deprecation-warning/CMakeLists.txt",
    "chars": 228,
    "preview": "add_executable(main ./deprecation-warning.cpp)\nadd_executable(bench ./deprecation-warning.cpp)\nif (WHISPER_SDL2)\n    add"
  },
  {
    "path": "examples/deprecation-warning/README.md",
    "chars": 639,
    "preview": "# Migration notice for binary filenames\n\n> [!IMPORTANT]\n[2024 Dec 20] Binaries have been renamed w/ a `whisper-` prefix."
  },
  {
    "path": "examples/deprecation-warning/deprecation-warning.cpp",
    "chars": 1261,
    "preview": "// Warns users that this filename was deprecated, and provides a link for more information.\n\n#include <cstdio>\n#include "
  },
  {
    "path": "examples/ffmpeg-transcode.cpp",
    "chars": 9977,
    "preview": "/* SPDX-License-Identifier: GPL-2.0 */\n\n/*\n * transcode.c - convert audio file to WAVE\n *\n * Copyright (C) 2019\t\tAndrew "
  },
  {
    "path": "examples/generate-karaoke.sh",
    "chars": 1111,
    "preview": "#!/bin/bash\n\n# Simple tool to record audio from the microphone and generate a karaoke video\n# Usage:\n#\n#  cd whisper.cpp"
  },
  {
    "path": "examples/grammar-parser.cpp",
    "chars": 17785,
    "preview": "#include \"grammar-parser.h\"\n#include <cstdint>\n#include <cwchar>\n#include <string>\n#include <utility>\n#include <stdexcep"
  },
  {
    "path": "examples/grammar-parser.h",
    "chars": 895,
    "preview": "// Implements a parser for an extended Backus-Naur form (BNF), producing the\n// binary context-free grammar format speci"
  },
  {
    "path": "examples/helpers.js",
    "chars": 6521,
    "preview": "// Common Javascript functions used by the examples\n\nfunction convertTypedArray(src, type) {\n    var buffer = new ArrayB"
  },
  {
    "path": "examples/json.hpp",
    "chars": 907857,
    "preview": "//     __ _____ _____ _____\n//  __|  |   __|     |   | |  JSON for Modern C++\n// |  |  |__   |  |  | | | |  version 3.11"
  },
  {
    "path": "examples/livestream.sh",
    "chars": 3026,
    "preview": "#!/bin/bash\n#\n# Transcribe audio livestream by feeding ffmpeg output to whisper.cpp at regular intervals\n# Idea by @semi"
  },
  {
    "path": "examples/lsp/CMakeLists.txt",
    "chars": 287,
    "preview": "if (WHISPER_SDL2)\n    # stream\n    set(TARGET whisper-lsp)\n    add_executable(${TARGET} lsp.cpp)\n\n    include(DefaultTar"
  },
  {
    "path": "examples/lsp/README.md",
    "chars": 6120,
    "preview": "# Language Server\r\n\r\nThis example consists of a simple language server to expose both unguided\r\nand guided (command) tra"
  },
  {
    "path": "examples/lsp/lsp.cpp",
    "chars": 21194,
    "preview": "#include \"common.h\"\n#include \"common-sdl.h\"\n#include \"whisper.h\"\n#include \"json.hpp\"\n\n#include <cassert>\n#include <chron"
  },
  {
    "path": "examples/lsp/whisper.vim",
    "chars": 15906,
    "preview": "if !exists(\"g:whisper_dir\")\n    let g:whisper_dir = expand($WHISPER_CPP_HOME)\n    if g:whisper_dir == \"\"\n        echoerr"
  }
]

// ... and 1380 more files (download for full content)

About this extraction

This page contains the full source code of the ggml-org/whisper.cpp GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 1580 files (23.8 MB), approximately 4.0M tokens. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!