Skip to content

Commit 7459077

Browse files
committed
Merge remote-tracking branch 'ggerganov/master'
* ggerganov/master: (32 commits) whisper.objc : fix build and CI talk-llama : sync llama.cpp sync : ggml GGUF: C++ refactor, backend support, misc fixes (skip) (llama/11030) ggml : add opencl backend (skip) (llama/10693) cuda : CUDA Graph Compute Function Refactor (precursor for performance improvements) (llama/11042) ggml : do not define GGML_USE_CUDA when building with GGML_BACKEND_DL (llama/11211) Vulkan: Fix float16 use on devices without float16 support + fix subgroup_size_control validation error (llama/11161) llama: add support for QRWKV6 model architecture (llama/11001) SYCL: Refactor ggml_sycl_compute_forward (llama/11121) fix: add missing msg in static_assert (llama/11143) llamafile : ppc64le MMA INT8 implementation (llama/10912) Disable GL_KHR_cooperative_matrix Vulkan extension if not available. (llama/11117) fix: Vulkan shader gen binary path when Cross-compiling (llama/11096) GGUF: C++ refactor, backend support, misc fixes (llama/11030) ggml-backend : only offload from host buffers (fix) (llama/11124) ggml-backend : only offload from host buffers (llama/11120) rpc : code cleanup (llama/11107) SYCL: Use get_multi_ptr instead of deprecated get_pointer in wkv6 (llama/11087) CUDA: add BF16 support (llama/11093) ...
2 parents d47f1e2 + 7a423f1 commit 7459077

File tree

114 files changed

+35683
-22916
lines changed

Some content is hidden

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

114 files changed

+35683
-22916
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -677,8 +677,8 @@ jobs:
677677
run: |
678678
xcodebuild -scheme whisper-Package -destination 'generic/platform=iOS'
679679
680-
#- name: Build objc example
681-
# run: xcodebuild -project examples/whisper.objc/whisper.objc.xcodeproj -scheme whisper.objc -configuration ${{ matrix.build }} -sdk iphoneos build
680+
- name: Build objc example
681+
run: xcodebuild -project examples/whisper.objc/whisper.objc.xcodeproj -scheme whisper.objc -configuration ${{ matrix.build }} -sdk iphoneos CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO build
682682

683683
- name: Build swiftui example
684684
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' build

README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,38 @@ Run the inference examples as usual, for example:
360360
- If you have trouble with Ascend NPU device, please create a issue with **[CANN]** prefix/tag.
361361
- If you run successfully with your Ascend NPU device, please help update the table `Verified devices`.
362362

363+
## Docker
364+
365+
### Prerequisites
366+
367+
- Docker must be installed and running on your system.
368+
- Create a folder to store big models & intermediate files (ex. /whisper/models)
369+
370+
### Images
371+
372+
We have two Docker images available for this project:
373+
374+
1. `ghcr.io/ggerganov/whisper.cpp:main`: This image includes the main executable file as well as `curl` and `ffmpeg`. (platforms: `linux/amd64`, `linux/arm64`)
375+
2. `ghcr.io/ggerganov/whisper.cpp:main-cuda`: Same as `main` but compiled with CUDA support. (platforms: `linux/amd64`)
376+
377+
### Usage
378+
379+
```shell
380+
# download model and persist it in a local folder
381+
docker run -it --rm \
382+
-v path/to/models:/models \
383+
whisper.cpp:main "./models/download-ggml-model.sh base /models"
384+
# transcribe an audio file
385+
docker run -it --rm \
386+
-v path/to/models:/models \
387+
-v path/to/audios:/audios \
388+
whisper.cpp:main "./main -m /models/ggml-base.bin -f /audios/jfk.wav"
389+
# transcribe an audio file in samples folder
390+
docker run -it --rm \
391+
-v path/to/models:/models \
392+
whisper.cpp:main "./main -m /models/ggml-base.bin -f ./samples/jfk.wav"
393+
```
394+
363395
## Installing with Conan
364396

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

examples/server/server.cpp

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,24 @@ void check_ffmpeg_availibility() {
223223
}
224224
}
225225

226+
std::string generate_temp_filename(const std::string &prefix, const std::string &extension) {
227+
auto now = std::chrono::system_clock::now();
228+
auto now_time_t = std::chrono::system_clock::to_time_t(now);
229+
230+
static std::mt19937 rng{std::random_device{}()};
231+
std::uniform_int_distribution<long long> dist(0, 1e9);
232+
233+
std::stringstream ss;
234+
ss << prefix
235+
<< "-"
236+
<< std::put_time(std::localtime(&now_time_t), "%Y%m%d-%H%M%S")
237+
<< "-"
238+
<< dist(rng)
239+
<< extension;
240+
241+
return ss.str();
242+
}
243+
226244
bool convert_to_wav(const std::string & temp_filename, std::string & error_resp) {
227245
std::ostringstream cmd_stream;
228246
std::string converted_filename_temp = temp_filename + "_temp.wav";
@@ -692,9 +710,7 @@ int main(int argc, char ** argv) {
692710
if (sparams.ffmpeg_converter) {
693711
// if file is not wav, convert to wav
694712
// write to temporary file
695-
//const std::string temp_filename_base = std::tmpnam(nullptr);
696-
const std::string temp_filename_base = "whisper-server-tmp"; // TODO: this is a hack, remove when the mutext is removed
697-
const std::string temp_filename = temp_filename_base + ".wav";
713+
const std::string temp_filename = generate_temp_filename("whisper-server", ".wav");
698714
std::ofstream temp_file{temp_filename, std::ios::binary};
699715
temp_file << audio_file.content;
700716
temp_file.close();

examples/talk-llama/CMakeLists.txt

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,26 @@
11
if (WHISPER_SDL2)
2+
set(CMAKE_CXX_STANDARD 17)
3+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
4+
25
set(TARGET whisper-talk-llama)
36
add_executable(${TARGET} talk-llama.cpp
47
llama.cpp
5-
llama-vocab.cpp
8+
llama-adapter.cpp
9+
llama-arch.cpp
10+
llama-batch.cpp
11+
llama-chat.cpp
12+
llama-context.cpp
13+
llama-cparams.cpp
614
llama-grammar.cpp
15+
llama-hparams.cpp
16+
llama-impl.cpp
17+
llama-kv-cache.cpp
18+
llama-mmap.cpp
19+
llama-model-loader.cpp
20+
llama-model.cpp
21+
llama-quant.cpp
722
llama-sampling.cpp
23+
llama-vocab.cpp
824
unicode.cpp
925
unicode-data.cpp)
1026
target_include_directories(${TARGET} PRIVATE ${SDL2_INCLUDE_DIRS})

0 commit comments

Comments
 (0)