]> git.djapps.eu Git - pkg/ggml/sources/whisper.cpp/log
pkg/ggml/sources/whisper.cpp
21 months agoextra: Add benchmark script implemented in Python (#1298)
Neil Chudleigh [Mon, 25 Sep 2023 15:45:15 +0000 (08:45 -0700)]
extra: Add benchmark script implemented in Python (#1298)

* Create bench.py

* Various benchmark results

* Update benchmark script with hardware name, and file checks

* Remove old benchmark results

* Add git shorthash

* Round to 2 digits on calculated floats

* Fix the header reference when sorting results

* FIx order of models

* Parse file name

* Simplify filecheck

* Improve print run print statement

* Use simplified model name

* Update benchmark_results.csv

* Process single or lists of processors and threads

* Ignore benchmark results, dont check in

* Move bench.py to extra folder

* Readme section on how to use

* Move command to correct location

* Use separate list for models that exist

* Handle subprocess error in git short hash check

* Fix filtered models list initialization

21 months agoExamples: Add save audio to file option in stream.cpp (#1310)
litong [Fri, 22 Sep 2023 15:43:21 +0000 (05:43 -1000)]
Examples: Add save audio to file option in stream.cpp (#1310)

* save the recorded audio to a file

* Alignment -help

* Save the correct audio

* chage to a consistent coding style

* Correct typo

* Update examples/stream/stream.cpp

* Update examples/stream/stream.cpp

* Correct variable misuse

* Update examples/stream/stream.cpp

* Update examples/stream/stream.cpp

* Update examples/stream/stream.cpp

* Update examples/stream/stream.cpp

---------

Co-authored-by: bobqianic <redacted>
21 months agoreadme: Fix spelling error (#1290)
JJ [Thu, 21 Sep 2023 07:55:33 +0000 (00:55 -0700)]
readme: Fix spelling error (#1290)

Fixed branding error:  Javascript to JavaScript

21 months agoexamples: Update README.md of main.cpp (#1306)
Artyom Mezin [Mon, 18 Sep 2023 14:14:36 +0000 (17:14 +0300)]
examples: Update README.md of main.cpp (#1306)

21 months agobinding : fix ruby build by adding missing ggml-alloc (#1305)
Jhen-Jie Hong [Mon, 18 Sep 2023 13:15:45 +0000 (21:15 +0800)]
binding : fix ruby build by adding missing ggml-alloc (#1305)

21 months agobench: fix missing include <cstring> (#1303)
Evgeny Kuznetsov [Mon, 18 Sep 2023 07:51:10 +0000 (10:51 +0300)]
bench: fix missing include <cstring> (#1303)

21 months agowhisper : increase tokenizer buffer (close #1259)
Georgi Gerganov [Fri, 15 Sep 2023 18:11:43 +0000 (21:11 +0300)]
whisper : increase tokenizer buffer (close #1259)

21 months agotalk-llama : update to latest llama.cpp
Georgi Gerganov [Fri, 15 Sep 2023 17:06:31 +0000 (20:06 +0300)]
talk-llama : update to latest llama.cpp

21 months agosync : ggml (const correctness)
Georgi Gerganov [Fri, 15 Sep 2023 11:49:56 +0000 (14:49 +0300)]
sync : ggml (const correctness)

21 months agometal : restore matrix x vector f16_f32 kerenls for now
Georgi Gerganov [Fri, 15 Sep 2023 11:40:41 +0000 (14:40 +0300)]
metal : restore matrix x vector f16_f32 kerenls for now

21 months agometal : add F32 support + update bench output
Georgi Gerganov [Fri, 15 Sep 2023 10:56:08 +0000 (13:56 +0300)]
metal : add F32 support + update bench output

21 months agowhisper : Metal and ggml-alloc support (#1270)
Georgi Gerganov [Fri, 15 Sep 2023 09:18:18 +0000 (12:18 +0300)]
whisper : Metal and ggml-alloc support (#1270)

* metal : init

* whisper : factor out graph builds

* whisper : allocate encoder and decoder using ggml-alloc

* whisper : ggml-alloc is now supported

* whisper : CoreML support ggml-alloc

* build : fix ggml-alloc

* ios : update submodule

* extra : update sync-ggml.sh script to also sync ggml-alloc

* ci : see if this is causing the crash

* whisper : refactor ggml-alloc init

* whisper.android : try to fix build

* whisper : initial Metal version

* ci : try to debug vmem issue

* metal : decoder works on GPU!

* metal : add multi-decoder support

* ggml : fix ggml_nbytes (probably temp solution)

* metal : run "cross" step on the GPU

* whisper : remove ggml_repeat in the encoder

* whisper : offload the Encoder to Metal

* ggml : use simpler ggml_bytes() implementation

* ggml-alloc : try to make CI happy by reducing vram to 128GB

* whisper : add whisper_allocr to wrap ggml_allocr

* whisper : factor out alloc init in a function

* cmake : update to support Metal build

* whisper : add <functional> header

* objc : fix build (no Metal yet)

* ios : add Metal support

* swiftui : fix build

* metal : speed-up KQ multiplication

* metal : sync latest llama.cpp kernels

* readme : add Metal info

* ios : update submodule

* coreml : add code to toggle Core ML config (CPU, ANE, GPU)

* bench : fix timings by running a pre-heat

* bench : start benching the decoder

* whisper : add ggml_mul_mat_pad

* bench : fix uninitialized vars

* whisper : add comment for disabling mul-mat padding

* whisper : add description of ggml_mul_mat_pad

* whisper : clean-up ggml_mul_mat_pad

* metal : remove the "concurrent" flag

* bench : variable n_past

* ios : update SPM package

21 months agowhisper : fix bench regression + fix performance when using CPU BLAS (#1275)
Georgi Gerganov [Tue, 12 Sep 2023 10:54:04 +0000 (13:54 +0300)]
whisper : fix bench regression + fix performance when using CPU BLAS (#1275)

* whisper : fix bench regression

* ggml : use sched_yield when using BLAS + add comment

21 months agowhisper : faster beam_search sampling via reduced KV cache copies (#1243)
bobqianic [Sun, 10 Sep 2023 13:04:27 +0000 (21:04 +0800)]
whisper : faster beam_search sampling via reduced KV cache copies (#1243)

* Faster `beam_search` sampling

Refine the KV cache update logic for more intelligent and efficient updating.

* Faster `whisper_sample_token_topk`

* Update whisper.cpp

* Update whisper.cpp

* Update whisper.cpp

* Reduce `memory allocation`

* Add `pointer swapping`

* Fixed some bugs

* Update whisper.cpp

* Apply suggestions from code review

* Updated the logic for determining `two-copy`

* Updated the logic for determining `two-copy` v2

* whisper : add debug logs + coding style

---------

Co-authored-by: Georgi Gerganov <redacted>
21 months agojava : fixed signing of java artifact using gradle (#1267)
Nicholas Albion [Sat, 9 Sep 2023 15:55:51 +0000 (01:55 +1000)]
java : fixed signing of java artifact using gradle (#1267)

* --stacktrace signMavenJavaPublication

* added temporary step "Debug gradle signing"

* cd bindings/java

* use GPG_PRIVATE_KEY and GPG_PASSPHRASE

* use secrets.GPG_PRIVATE_KEY and GPG_PASSPHRASE

21 months agoci : try to fix gradle action (#1265)
Georgi Gerganov [Fri, 8 Sep 2023 17:50:15 +0000 (20:50 +0300)]
ci : try to fix gradle action (#1265)

21 months agogitignore : update
Georgi Gerganov [Fri, 8 Sep 2023 16:45:28 +0000 (19:45 +0300)]
gitignore : update

21 months agosync : ggml (HBM + Metal + style) (#1264)
Georgi Gerganov [Fri, 8 Sep 2023 14:58:31 +0000 (17:58 +0300)]
sync : ggml (HBM + Metal + style) (#1264)

21 months agoci : upgrade gradle to 2.4.2 (#1263)
Georgi Gerganov [Fri, 8 Sep 2023 14:58:14 +0000 (17:58 +0300)]
ci : upgrade gradle to 2.4.2 (#1263)

* ci : upgrade gradle to 2.4.2

* cmake : add comment (#1129)

21 months agosync : ggml (CUDA faster rope)
Georgi Gerganov [Fri, 8 Sep 2023 12:01:26 +0000 (15:01 +0300)]
sync : ggml (CUDA faster rope)

21 months agocmake : noramlize case (#1129)
Georgi Gerganov [Fri, 8 Sep 2023 11:50:03 +0000 (14:50 +0300)]
cmake : noramlize case (#1129)

21 months agobuild : do not use _GNU_SOURCE gratuitously (#1129)
Przemysław Pawełczyk [Thu, 7 Sep 2023 09:36:14 +0000 (11:36 +0200)]
build : do not use _GNU_SOURCE gratuitously (#1129)

* Do not use _GNU_SOURCE gratuitously.

What is needed to build whisper.cpp and examples is availability of
stuff defined in The Open Group Base Specifications Issue 6
(https://pubs.opengroup.org/onlinepubs/009695399/) known also as
Single Unix Specification v3 (SUSv3) or POSIX.1-2001 + XSI extensions,
plus some stuff from BSD that is not specified in POSIX.1.

Well, that was true until NUMA support was added recently in ggml,
so enable GNU libc extensions for Linux builds to cover that.

There is no need to penalize musl libc which simply follows standards.

Not having feature test macros in source code gives greater flexibility
to those wanting to reuse it in 3rd party app, as they can build it with
minimal FTM (_XOPEN_SOURCE=600) or other FTM depending on their needs.

It builds without issues in Alpine (musl libc), Ubuntu (glibc), MSYS2.

* examples : include SDL headers before other headers

Avoid macOS build error when _DARWIN_C_SOURCE is not defined, brought by
SDL2 relying on Darwin extension memset_pattern4/8/16 (from string.h).

* make : enable BSD extensions for DragonFlyBSD to expose RLIMIT_MEMLOCK

* make : use BSD-specific FTMs to enable alloca on BSDs

* make : fix OpenBSD build by exposing newer POSIX definitions

* cmake : follow recent FTM improvements from Makefile

21 months agoexamples : fix build + compile warnings (close #1256)
Georgi Gerganov [Thu, 7 Sep 2023 09:33:12 +0000 (12:33 +0300)]
examples : fix build + compile warnings (close #1256)

21 months agomodels : add quantum models to download-ggml-model.sh (#1235)
Neil Chudleigh [Thu, 7 Sep 2023 09:16:58 +0000 (05:16 -0400)]
models : add quantum models to download-ggml-model.sh (#1235)

* Add quantized models to download-ggml-model.sh

* Update names in download-ggml-model script to normalized

21 months agowhisper.android : bump gradle plugin and dependencies + a lint pass (#1255)
Digipom [Thu, 7 Sep 2023 09:15:59 +0000 (05:15 -0400)]
whisper.android : bump gradle plugin and dependencies + a lint pass (#1255)

21 months agosign jar for Maven Central repo
Nicholas Albion [Thu, 7 Sep 2023 01:45:01 +0000 (11:45 +1000)]
sign jar for Maven Central repo

21 months agowhisper.android : address ARM's big.LITTLE arch by checking cpu info (#1254)
Digipom [Wed, 6 Sep 2023 15:32:30 +0000 (11:32 -0400)]
whisper.android : address ARM's big.LITTLE arch by checking cpu info (#1254)

Addresses https://github.com/ggerganov/whisper.cpp/issues/1248

21 months agomake : fix detection of AVX2 on macOS (#1250)
Didzis Gosko [Wed, 6 Sep 2023 15:22:21 +0000 (18:22 +0300)]
make : fix detection of AVX2 on macOS (#1250)

21 months agoggml : posixify pagesize (#1251)
Przemysław Pawełczyk [Wed, 6 Sep 2023 15:19:36 +0000 (17:19 +0200)]
ggml : posixify pagesize (#1251)

* ggml : use sysconf(_SC_PAGESIZE) instead of getpagesize() derived from BSD

sed -i 's,getpagesize(),sysconf(_SC_PAGESIZE),g' ggml.c

* metal : use sysconf(_SC_PAGESIZE) instead of getpagesize() derived from BSD

sed -i 's,getpagesize(),sysconf(_SC_PAGESIZE),g' ggml-metal.m

21 months agoconfigured publishing.repositories
Nicholas Albion [Wed, 6 Sep 2023 03:13:36 +0000 (13:13 +1000)]
configured publishing.repositories

21 months agoggml : sync latest llama.cpp (view_src + alloc improvements) (#1247)
Georgi Gerganov [Tue, 5 Sep 2023 17:57:27 +0000 (20:57 +0300)]
ggml : sync latest llama.cpp (view_src + alloc improvements) (#1247)

* ggml : sync latest llama.cpp (view_src + alloc improvements)

* ggml : fix build

21 months agomake : improve cpuinfo handling on x86 hosts (#1238)
Przemysław Pawełczyk [Tue, 5 Sep 2023 11:58:47 +0000 (13:58 +0200)]
make : improve cpuinfo handling on x86 hosts (#1238)

* make : simplify and correct x86 ISA extensions detection on the host

It got broken in commit c5f9acf4b797 for Haiku and Mac OS (Intel),
which report CPU features in upper case.

Now we're finding the names in case-insensitive manner and as words.
SSE3 detection has been corrected for Linux, which uses PNI for that
(Prescott New Instructions).

* make : use dmesg.boot in FreeBSD/DragonFlyBSD to detect x86 ISA extensions on the host

* make : enable x86 ISA extensions on the host both in CFLAGS and CXXFLAGS

* make : correct AVX x86 ISA extension detection on macOS (Intel) host

It got broken in commit c5f9acf4b797.  macOS calls it AVX1.0.

21 months agoggml : sync (ggml-alloc, GPU, eps, etc.) (#1220)
Georgi Gerganov [Tue, 5 Sep 2023 10:54:40 +0000 (13:54 +0300)]
ggml : sync (ggml-alloc, GPU, eps, etc.) (#1220)

* ggml : sync (ggml-alloc, GPU, eps, etc.)

* ggml : fix build

* wasm : fix build

21 months agoreadme : update CMake build commands (#1231)
布客飞龙 [Tue, 5 Sep 2023 10:53:34 +0000 (18:53 +0800)]
readme : update CMake build commands (#1231)

* Update README.md

* Update README.md: `vcpkg install opencl clblast`

* readme : update build commands

---------

Co-authored-by: Georgi Gerganov <redacted>
22 months agoOSSRH_USERNAME -> JIRA_USER
Nicholas Albion [Thu, 31 Aug 2023 04:54:02 +0000 (14:54 +1000)]
OSSRH_USERNAME -> JIRA_USER

22 months agobuild-root-directory: bindings/java
Nicholas Albion [Thu, 31 Aug 2023 02:04:16 +0000 (12:04 +1000)]
build-root-directory: bindings/java

22 months agoci : enable java package publishing (#1228)
Georgi Gerganov [Wed, 30 Aug 2023 23:57:43 +0000 (02:57 +0300)]
ci : enable java package publishing (#1228)

22 months agoggml : fix compilation errors incurred by -Werror (#1227)
ChangSeok Oh [Wed, 30 Aug 2023 19:09:15 +0000 (12:09 -0700)]
ggml : fix compilation errors incurred by -Werror (#1227)

The -Werror warning option turns all warnings into errors. This PR makes
the compiler happy to build ggml.c and whisper.cpp with the stricter option.

22 months agowhisper.android : fix cmake multiple libraries build (#1224)
Jhen-Jie Hong [Wed, 30 Aug 2023 11:45:13 +0000 (19:45 +0800)]
whisper.android : fix cmake multiple libraries build (#1224)

* whisper.android : fix multiple libraries build

* fix flags for default target

22 months agocoreml : wrap inference call in @autoreleasepool to fix memory leak (#1218)
Dener Stassun [Tue, 29 Aug 2023 12:44:38 +0000 (09:44 -0300)]
coreml : wrap inference call in @autoreleasepool to fix memory leak (#1218)

22 months agomake : use cpuinfo in MSYS2 to enable x86 ISA extensions on the host (#1216)
Przemysław Pawełczyk [Mon, 28 Aug 2023 10:28:26 +0000 (12:28 +0200)]
make : use cpuinfo in MSYS2 to enable x86 ISA extensions on the host (#1216)

22 months agomake : add support for building on DragonFlyBSD/NetBSD/OpenBSD (#1212)
Przemysław Pawełczyk [Sun, 27 Aug 2023 18:38:46 +0000 (20:38 +0200)]
make : add support for building on DragonFlyBSD/NetBSD/OpenBSD (#1212)

22 months agoggml : fix compiling when SSE3 is available but not SSSE3 (#1210)
Przemysław Pawełczyk [Sun, 27 Aug 2023 18:37:31 +0000 (20:37 +0200)]
ggml : fix compiling when SSE3 is available but not SSSE3 (#1210)

It got broken in commit 3998465721858.

22 months agoggml : detect SSSE3 (#1211)
Przemysław Pawełczyk [Sun, 27 Aug 2023 18:36:41 +0000 (20:36 +0200)]
ggml : detect SSSE3 (#1211)

* ggml : add ggml_cpu_has_ssse3

* whisper : show SSSE3 in system info

* make : detect SSSE3 via cpuinfo

22 months agoexamples : vim plugin and LSP server (#1144)
AustinMroz [Sun, 27 Aug 2023 18:35:06 +0000 (13:35 -0500)]
examples : vim plugin and LSP server (#1144)

* Initial proof of concept Vim plugin

At present, this is likely only slightly better than feature parity with
the existing whisper.nvim

Known issues:
 Trailing whitespace
 Up to an existing length(5 seconds) of speech may be processed when
  listening is enabled
 CPU cycles are spent processing speech even when not listening.

Fixing these issues is likely dependent upon future efforts to create a
dedicated library instead of wrapping examples/stream

* Support $WHISPER_CPP_HOME environment variable

A minor misunderstanding of the whisper.nvim implementation resulted in
a plugin that was functional, but not a drop in replacement as it should
be now.

* Initial progress on LSP implementation

Libcall is nonviable because the library is immediately freed after a
call is made. Further investigation has shown Language Server Protocol as
a promising alternative that both simplifies the required logic on the
vimscript side and increases the ease with which plugins for other
editors could be made in the future. This is a very large undertaking
and my progress has slowed substantially.

Work is far from being in a usable state, but I wish to keep track of
major refactors for organizational purposes.

* Rewrite audio windowing of guided transcription

One of the defining goals of this venture is allowing consecutive
commands to be rattled off without the existing deadzones of the current
implementation.

* Add unguided_transcription. Cleanup.

The unguided transcription implantation heavily borrows from existing
example implementations and the guided_transcription logic.

A high level pass was done to check that method arguments are accurate
to what inputs are actually required.

A first attempt at cancellation support was added for record keeping,
but will be deleted in a future commit.

* Fix compilation.

Resolves a large number of compilation errors.
No testing has been done yet for execution errors.

Update Makefile and .gitignore

* Functional unguided_transcription

* Functional guided_transcription

Fix commandset_list being passed by value
Properly register the first token of a multitoken command

* Minor changes before time fix

I've apparently made an awfully major mistake in thinking that unix time
was in milliseconds and will be changing all timekeeping code to use
standardized methods.

In preparation for this is a number of minor bugfixes.
Output is manually flushed.
An echo method has been added.
registerCommandset now wraps the returned index

* Swap timekeeping to use std::chrono

* Add work in progress lsp backed whisper.vim plugin

Current progress blockers are
 Adding modality awareness to the command processing
  (specifically, motion prompting)
 Improving the VAD to be a little more responsive
  (testing start of activity)

* Reworked vim plugin command loop

* Fix change inside

Multiple bug fixes that, crucially, bring the plugin to the point where a
demonstration video is possible

Add better echo messaging so whisper_log isn't required
 Add loading complete message as indicator when listening has started
Insert/append are actually included in command sets
Some more heavy handed corrections to prevent a double exit when leaving
insert mode
As a somewhat hacky fix, the very first space is removed when inserting.
 This cleans up most use cases, but leaves me unsatisfied with the few
 cases it would be desired.

* Forcibly set commandset_index to 0 after subinsert

Also remove unnecessary ! to use builtin vim command

* Fix upper

A minor scope mistake was causing upper'd inputs to be eaten.
This was fixed and echoing was slightly improved for clarity.

* Fix formatting

Corrects indentation to 4 spaces as project standard
Slightly better error support for malformed json input

* Remove obsolete vim plugin

* Add json.hpp library

The same library that is used for the llama.cpp server

* Minor cleanups

add lsp to the make clean directive.
remove a redundant params definition.
reorder whisper.vim logging for subtranscriptions
Corrections to unlets (variables of argument scope appear immutable)

* Fix indentation. Fallback for subTranscription

Indentation has been changed to 4 spaces.

Unit testing has been set up, I'm opting not to include it in the
repository for now.
It however, has revealed a bug in the state logic where a
subtranscription can be initiated without having a saved command
When this occurs, append is added as a fallback

* Move audio polling logic to a subfunction

While work on the improved vad will continue, It's grown to be a little
out of scope. Instead, a future commit will perform multiple detection
passes at substretches of audio when a backlog of audio exists.

To facilitate this, and prevent code duplication, the vad code has been
moved into a subfunction shared by both the unguided and guided
transcription functions.

* Test for voice over subchunks if backlog > 1s

As the existing VAD implementation only checks for a falling edge at the
end of an audio chunk. It fails to detect voice in cases where the
recorded voice is only at the beginning of the audio.

To ameliorate this, when the timestamp would cause analysis of audio
over a second in length, it is split into 1 second length subchunks
which are individually tested.

Results are promising, but there seems to be a remaining bug with
unguided transcription likely related to saving context

* Limit the maximum length of audio input.

This existing VAD implementation only detects falling edges, which
means any gap in the users speaking is processed for transcription.
This simply establishes a constant maximum length depending on the type
of transcription. Uguided gets a generous 10 seconds and guided, 2.

While quick testing showed that commands are generally around a half a
second to a second, limiting commands to an even second resulted in
extreme degradation of quality. (Seemingly always the same output for a
given commandset)

* Unguided timestamp tracking, cleanup

Unguided transcriptions where not setup to allow for passing of
timestamp data forward, but have been corrected.

No_context is now always set to false. While conceptually desirable for
the quality of guided transcription, It was seemingly responsible for
prior command inputs ghosting in unguided transcription.

Save and Run are now tracked by command number instead of command text.
While command_text was provided for convenience, I wish to keep command
index authoritative. This gives greater consistency and potentially
allows for end users to rename or even translate the spoken versions of
these commands

* By default, maintain mode.

Previously, mode was reset to 0 unless otherwise set.
In addition to causing some edge cases, this was didn't mesh well with
the existing approach to visual mode.

With this change, initial tests indicate visual mode is functional.

* Add undo breaks before subtranscriptions

Subtranscriptions use undo as a hack to allow for partial responses to
be displayed. However, scripts don't cause an undo break mid execution
unless specifically instructed to. This meant that multiple
unguided transcriptions from a single session would cause a latter to
undo a former.

This is now fixed and undo should be reasonably usable as a command.

* Append instead of insert for new undo sequence

When entering and leavening insert mode with `i`, the cursor shifts one
column to the left. This is remedied by using append instead of insert
for setting these breaks in the undo sequence

`-` was also added to the pronunciation dictionary to be pronounced as
minus as it was causing a particularly high failure rate.

* Move undo sequence breaks to command execution

Previously, undo sequence breaks were triggered when there was a command
that caused a move to insert mode. This caused commands that changed
state (like delete or paste) to be bundled together with into the last
command that caused text to be entered.

* Fix repeat. Add space, carrot, dollar commands

 Repeat (.) wasn't being tracked properly just like undo and is being
 manually tracked now.

 While efforts have been made to properly handle spaces, it was
 particularly finicky to add a single space when one is needed. A
 special 'space' command has been added to insert a single space and move
 the cursor after it.

 Carrot and Dollar commands have been added for start of line and end of
 line respectively. These are both simple to implement, and just a
 matter of defining a pronunciation.

* Return error on duplicate in commandset

Not every command in the commandset tokenizes to a single token.
Because of this, it's possible for that two commands could resolve to
the same single token after subsequent tokens are discarded.

This commit adds a simple check for duplicates when a commandset is
registered and returns an error if so.

Additional code will be required later on the vim side to actually
process this error.

* Add support for user-defined commands

This adds a user definable dictionary from spoken keys to strings or
funcrefs. All keys are added to the commandlist and when spoken, trigger
the corresponding function.

Like "save" and "run", these user commands are only available when the
command buffer is empty.

* Add readme, update cmake

* Add area commandset. Refactor spoken_dict

Area commands (inside word, around sentence...) have been given a
commandset as considered earlier.

Verbose definitions for spoken_dict entries now use dicts instead of
lists. This shortens the definition for most keys that require it and
scales better with the addition of further commandsets

* Add mark, jump. Fix change under visual.

Mark (m) and jump (') have been added.

When a visual selection was executed upon a command that initiated a
subtranscription (change) the area of the visual selection is not
properly tracked which causes the attempt to stream in partial response
to fail. This is solved by disabling partial transcriptions from being
streamed when a subtranscription is started while in visual mode.

* Accommodate ignorecase. Fix change.

From testing on older different versions of vim, the test for
distinguishing an 'R' replace all from an 'r' replace could fail if
ignorecase was set. The comparison has been changed to explicitly
require case matching

Change detection has been moved to the execution section as it was missing the
change+motion case.

* Support registers. Fix README typo

There's no logic to prevent doubled register entry, but the functional
result is equivalent to if the same key order was typed into vim.

A minor typo in the readme. I've mismemorized the mnemonic for 't' as 'to'
instead of till., but 'to' can't be used as it's a homophone with '2'.
While there was no mistake in the actual logic, it was misleading to use
'to' in the readme.

22 months agowhisper : initial hipBLAS support (#1209)
ardfork [Sun, 27 Aug 2023 17:03:58 +0000 (17:03 +0000)]
whisper : initial hipBLAS support (#1209)

22 months agowhisper : allow whisper_full from mel spectrogram - no audio (#1214)
Georgi Gerganov [Sun, 27 Aug 2023 17:02:57 +0000 (20:02 +0300)]
whisper : allow whisper_full from mel spectrogram - no audio (#1214)

Co-authored-by: jbrough <redacted>
22 months agowhisper : significantly improve the inference quality (#1148)
bobqianic [Sun, 27 Aug 2023 16:51:33 +0000 (00:51 +0800)]
whisper : significantly improve the inference quality (#1148)

* Fix MSVC compile error C3688

Instead of simply using 'add_compile_options(/utf-8)' to address the MSVC compile error C3688, a better approach would be to handle it in a way that prevents passing '/utf-8' to NVCC.

* Significantly improve inference quality

In the function `log_mel_spectrogram_worker_thread`, there's an array out-of-bounds issue occurring during the calculation of complex number moduli. This issue is causing disruptions in the FFT spectrum, which, in turn, is reducing the quality of inference.

* Significantly improve inference quality

At last, I've pinpointed the actual source of the problem. Given that the frequency spectrum generated from real input data is symmetrical around the Nyquist frequency, there's a for-loop within the `log_mel_spectrogram_worker_thread` function that attempts to fold the frequency spectrum. Regrettably, a bug within this for-loop is causing a frame shift in the frequency spectrum. The previous attempt to remedy this, which involved using `fft_size + 1` when calculating the modulus, was merely a band-aid solution and did not address the underlying issue.

* Addressed a few minor issues

Fixed the issue of `fft_out` continuously expanding. Resolved the fallback caused by using 'break' instead of `fft_in[j] = 0`.

* Significantly improve inference quality

Thanks for your patience everyone. It's finally sorted out. Now, the right side of the FFT spectrum is being flipped over to the left, and the amplitudes at corresponding positions on the left and right are added together (the spectrum on the left needs to be shifted by one position), then the average is calculated. FFT_OUT[0] is no longer discarded, making full use of the limited space to pack in more information.

* Add annotation and performance improvement

* Calculate FFT only when fft_in are not all zero

* Some minor performance improvement

* Fixed a bug impacting inference quality

* The first version after all the analysis is completed.

* Fix some bugs and add debug mode

* Fixed several bugs

* Temporarily disable speed-up mode and add debug mode.

* Add debug mode

* Disable speed-up mode and add debug mode

* Fix CI error (#1)

* Fix error

* Fix error

* Fixed several bugs including [BLANK_AUDIO] problem

* Remove Hard-coded hann window

* Some Final Fix (#2)

* Fix error

* Fix error

* Probably the last commit

* Probably the last commit

* whisper : minor coding style changes

* whisper : remove debug from public API

---------

Co-authored-by: Georgi Gerganov <redacted>
22 months agowhisper.android : migrate from ndk-build to CMake (#1204)
junkfood [Sun, 27 Aug 2023 16:35:16 +0000 (00:35 +0800)]
whisper.android : migrate from ndk-build to CMake (#1204)

22 months agomain : log probs to text file (#1205)
Yunès [Sun, 27 Aug 2023 16:09:06 +0000 (18:09 +0200)]
main : log probs to text file (#1205)

* token/probability file generated with -ls

* code comment cleaning

* main : indentations

---------

Co-authored-by: Georgi Gerganov <redacted>
22 months agowhisper : minor fixes (#1154)
Fangjun Kuang [Sun, 27 Aug 2023 16:02:00 +0000 (00:02 +0800)]
whisper : minor fixes (#1154)

22 months agobuild : fix OpenBLAS detection under Arch Linux (#1173)
Marcin Mielniczuk [Fri, 25 Aug 2023 16:26:34 +0000 (18:26 +0200)]
build : fix OpenBLAS detection under Arch Linux (#1173)

22 months agomake : fix Linux machines supporting AVX1 not AVX2 (#1162)
Eric Swanson [Fri, 25 Aug 2023 12:52:22 +0000 (08:52 -0400)]
make : fix Linux machines supporting AVX1 not AVX2 (#1162)

e.g. ancient CPU E5-2670 (v1)

See issue #1126

Co-authored-by: Georgi Gerganov <redacted>
22 months agowhisper : add precalculated values of sin/cos for speeding up FFT (#1142)
Alexandr Graschenkov [Fri, 25 Aug 2023 12:51:14 +0000 (16:51 +0400)]
whisper : add precalculated values of sin/cos for speeding up FFT (#1142)

* Add sin/cos precalculated values to speedup FFT

* Update whisper.cpp

Co-authored-by: bobqianic <redacted>
* Update whisper.cpp

Co-authored-by: bobqianic <redacted>
---------

Co-authored-by: Georgi Gerganov <redacted>
Co-authored-by: bobqianic <redacted>
22 months agomake : simplify Makefile (#1147)
alonfaraj [Fri, 25 Aug 2023 12:20:44 +0000 (15:20 +0300)]
make : simplify Makefile (#1147)

* Simplify Architecture specific in Makefile

* unified OS specific check

22 months agocmake : fix PowerPC build failures introduced in #1174 (#1196)
Marcin Mielniczuk [Fri, 25 Aug 2023 12:19:48 +0000 (14:19 +0200)]
cmake : fix PowerPC build failures introduced in #1174 (#1196)

22 months agoFix AVX etc. under GCC/CMake (#1174)
Marcin Mielniczuk [Sat, 19 Aug 2023 18:39:03 +0000 (20:39 +0200)]
Fix AVX etc. under GCC/CMake (#1174)

22 months agoquantize : fix load vocab crash when len is 128 (#1160)
Jhen-Jie Hong [Sun, 6 Aug 2023 08:04:42 +0000 (16:04 +0800)]
quantize : fix load vocab crash when len is 128 (#1160)

* quantize : fix load vocab crash when len is 128

* ci : add quantize job

22 months agoexamples : add tinydiarization support for streaming (#1137)
Duncan McConnell [Thu, 3 Aug 2023 08:24:07 +0000 (03:24 -0500)]
examples : add tinydiarization support for streaming (#1137)

23 months agocmake : fix MSVC compile error C3688 (#1136)
bobqianic [Wed, 26 Jul 2023 15:57:25 +0000 (23:57 +0800)]
cmake : fix MSVC compile error C3688 (#1136)

Instead of simply using 'add_compile_options(/utf-8)' to address the MSVC compile error C3688, a better approach would be to handle it in a way that prevents passing '/utf-8' to NVCC.

23 months agoRevert "cmake : fix MSVC compile error C3688 on non-unicode Windows (#1110)"
Georgi Gerganov [Wed, 26 Jul 2023 07:25:09 +0000 (10:25 +0300)]
Revert "cmake : fix MSVC compile error C3688 on non-unicode Windows (#1110)"

This reverts commit fe5c1a7341a973107c1e38286c287d32090082db.

23 months agowhisper : fix visibility warning of struct whisper_full_params by declaring in advanc...
Yang Shen [Tue, 25 Jul 2023 16:15:57 +0000 (00:15 +0800)]
whisper : fix visibility warning of struct whisper_full_params by declaring in advance (#1124)

23 months agocmake : enable OpenBLAS on Windows (#1128)
bobqianic [Tue, 25 Jul 2023 16:15:08 +0000 (00:15 +0800)]
cmake : enable OpenBLAS on Windows (#1128)

Fixed the issue of not being able to find OpenBLAS on the Windows platform. Even though the name of the previously released binary file was whisper-blas-bin-x64.zip, BLAS was actually not enabled. After enabling, the inference speed can increase by 3-4 times.

23 months agomake : fix CLBlast build on MacOS (#1120)
Christian [Tue, 25 Jul 2023 16:12:03 +0000 (18:12 +0200)]
make : fix CLBlast build on MacOS (#1120)

23 months agomake : check nvcc version and set flag (#1115)
alonfaraj [Tue, 25 Jul 2023 16:10:54 +0000 (19:10 +0300)]
make : check nvcc version and set flag (#1115)

23 months agogo : implement SetSplitOnWord (#1114)
xdrudis [Tue, 25 Jul 2023 16:10:12 +0000 (09:10 -0700)]
go : implement SetSplitOnWord (#1114)

* Go binding: Implement SetSplitOnWord

* Add comment for consistency

23 months agomake : tests can be called as "make tests base.en" (#1113)
Jose [Tue, 25 Jul 2023 16:09:38 +0000 (18:09 +0200)]
make : tests can be called as "make tests base.en" (#1113)

23 months agocmake : fix MSVC compile error C3688 on non-unicode Windows (#1110)
Gang Chen [Tue, 25 Jul 2023 16:08:37 +0000 (00:08 +0800)]
cmake : fix MSVC compile error C3688 on non-unicode Windows (#1110)

Co-authored-by: Gang Chen <redacted>
23 months agoreadme : add OpenVINO support details (#1112)
Ryan Metcalfe [Tue, 25 Jul 2023 16:07:59 +0000 (12:07 -0400)]
readme : add OpenVINO support details (#1112)

23 months agoopencl : sync opencl compilation fix in ggml (#1111)
Gang Chen [Tue, 25 Jul 2023 16:07:08 +0000 (00:07 +0800)]
opencl : sync opencl compilation fix in ggml (#1111)

23 months agosamples : add a larger (30min) sample (#1092)
Vadim Peretokin [Tue, 25 Jul 2023 16:00:45 +0000 (18:00 +0200)]
samples : add a larger (30min) sample (#1092)

Co-authored-by: Vadim Peretokin <redacted>
23 months agowhisper : expose API to let user control log output (#1060)
Evan Martin [Tue, 25 Jul 2023 15:58:25 +0000 (08:58 -0700)]
whisper : expose API to let user control log output (#1060)

* expose api to let user control log output

Add
  whisper_set_log_callback()
that lets user set a callback for log messages.

Change all the
  fprintf(stderr, ...)
to call via the above.

* whisper : add <cstdarg>

---------

Co-authored-by: Georgi Gerganov <redacted>
23 months agowhisper : move progress calculation out of whisper.cpp (#1081)
Hrishikesh Barman [Tue, 25 Jul 2023 15:53:34 +0000 (21:23 +0530)]
whisper : move progress calculation out of whisper.cpp (#1081)

Current `progress_step` was hardcoded into whisper.cpp, this resulted in
bindings having to access progress only at that step even if progress
callback was being called at every iteration.

With this change we get greater granularity progress reporting from
whisper.cpp and bindings/implementations can define their own progress step.

23 months agoexamples : add Vim plugin (#1131)
AustinMroz [Tue, 25 Jul 2023 15:34:23 +0000 (10:34 -0500)]
examples : add Vim plugin (#1131)

* Initial proof of concept Vim plugin

At present, this is likely only slightly better than feature parity with
the existing whisper.nvim

Known issues:
 Trailing whitespace
 Up to an existing length(5 seconds) of speech may be processed when
  listening is enabled
 CPU cycles are spent processing speech even when not listening.

Fixing these issues is likely dependent upon future efforts to create a
dedicated library instead of wrapping examples/stream

* Support $WHISPER_CPP_HOME environment variable

A minor misunderstanding of the whisper.nvim implementation resulted in
a plugin that was functional, but not a drop in replacement as it should
be now.

23 months agoci : more platforms coverage (#1101)
alonfaraj [Sun, 16 Jul 2023 20:00:34 +0000 (23:00 +0300)]
ci : more platforms coverage (#1101)

* add multi platform

* add image name

* fix

* fix /bin/sh path

* add missing \

* add all platforms for check

* remove platforms

* remove s390x

* - add arm v6
- format run cmd

* remove arm v6

* - bump checkout to v3
- use setup emsdk action
- add arch to all ubuntu jobs

* mymindstorm/setup-emsdk to v12

* add missing QEMU step

* add fail-fast: false for debug

* add freebsd

* remark all jobs except freebsd for test

* add sudo

* enable all tests again

* format

* check __AVX__ support before include immintrin.h

* try auto detect flag by cmake

* fix check for immintrin.h

* fix include check for immintrin.h

* Remove all platforms for sanitizer build except amd64

We have no clue why they failed.

---------

Co-authored-by: Alon Faraj <redacted>
23 months agowhisper : minor OpenVINO refactoring (#1037)
Georgi Gerganov [Tue, 4 Jul 2023 17:28:27 +0000 (20:28 +0300)]
whisper : minor OpenVINO refactoring (#1037)

Hopefully I didn't break something - haven't tested

23 months agogo : call SetDuration appropriately (#1077)
Travis Cline [Tue, 4 Jul 2023 13:13:25 +0000 (06:13 -0700)]
go : call SetDuration appropriately (#1077)

23 months agogo : fix context.Process call in examples (#1067)
Murilo Santana [Tue, 4 Jul 2023 13:05:35 +0000 (10:05 -0300)]
go : fix context.Process call in examples (#1067)

23 months agowhisper : add OpenVINO support (#1037)
Ryan Metcalfe [Tue, 4 Jul 2023 12:56:11 +0000 (08:56 -0400)]
whisper : add OpenVINO support (#1037)

* openvino: use OpenVINO encoder inference

* openvino: add python script for OpenVINO model generation

* whisper: Fix 'unused' warnings when OpenVINO isn't enabled in build

* Apply suggestions from code review

Co-authored-by: Georgi Gerganov <redacted>
* whisper: Fix compilation error

* whisper: revert whisper_get_openvino_path_encoder & whisper_get_openvino_path_cache to non-const func signatures

* cmake: Add openvino-encoder as separate object target

* whisper : minor style fixes

* minor : indentation fixes

---------

Co-authored-by: Georgi Gerganov <redacted>
23 months agoreadme : better wording (#1064)
Martin Warnaar [Tue, 4 Jul 2023 12:30:31 +0000 (14:30 +0200)]
readme : better wording (#1064)

23 months agoreadme : add tinydiarize instructions (#1058)
Georgi Gerganov [Tue, 4 Jul 2023 06:51:22 +0000 (09:51 +0300)]
readme : add tinydiarize instructions (#1058)

23 months agowhisper : support speaker segmentation (local diarization) of mono audio via tinydiar...
Akash Mahajan [Tue, 4 Jul 2023 06:45:00 +0000 (23:45 -0700)]
whisper : support speaker segmentation (local diarization) of mono audio via tinydiarize (#1058)

* add HuggingFace mirror to download  ggml model

* support tdrz via simple hack overriding solm tokens

* fix incorrect translate/transcribe token_ids that are not static const

* add apollo 13 sample for tdrz demo

* render [SPEAKER TURN] consistently in all terminal output using vocab.id_to_token

* extend whisper_segment with speaker_turn_next field and save in json output

* fix failing go build

* slipped in some python syntax whoops

* whisper : finalize tinydiarize support (add flag + fixes)

* whisper : tdrz support for word-level timestamps (respect max_len)

* java : try to fix tests after adding tdrz_enable flag

* main : remove TODO leftover

* java : fix params order list after adding "tdrz_enable"

* whisper : fix solm and add nosp token

* main : print tinydiarize help

---------

Co-authored-by: Georgi Gerganov <redacted>
23 months agotalk-llama : fix new rope interface
Georgi Gerganov [Mon, 3 Jul 2023 16:24:01 +0000 (19:24 +0300)]
talk-llama : fix new rope interface

23 months agoRevert "ggml : do not use _GNU_SOURCE gratuitously (#1027)"
Georgi Gerganov [Sun, 2 Jul 2023 18:53:52 +0000 (21:53 +0300)]
Revert "ggml : do not use _GNU_SOURCE gratuitously (#1027)"

This reverts commit 3f7a03ebe3b65be0792849e300a122f6a050e3f8.

23 months agoggml : sync latest repo (mostly refactoring changes)
Georgi Gerganov [Sun, 2 Jul 2023 18:45:27 +0000 (21:45 +0300)]
ggml : sync latest repo (mostly refactoring changes)

2 years agotalk-llama : fix build on macOS (#1062)
Przemysław Pawełczyk [Wed, 28 Jun 2023 19:34:50 +0000 (21:34 +0200)]
talk-llama : fix build on macOS (#1062)

* talk-llama : use posix_madvise() instead of madvise() derived from BSD

sed -i 's,\<madvise\>,posix_&,g;s,\<MADV_,POSIX_&,g' examples/talk-llama/llama-util.h

* make : enable Darwin extensions for macOS builds

This is an attempt at fixing macOS build error coming from the fact that
RLIMIT_MEMLOCK define is not available there without Darwin extensions.

2 years agoextra : update 'quantize-all.sh' to quantize all downloaded models (#1054)
thefinaldegree [Wed, 28 Jun 2023 19:07:02 +0000 (07:07 +1200)]
extra : update 'quantize-all.sh' to quantize all downloaded models (#1054)

Script will now do what it says: quantize everything except testing models in the 'models'  directory.

2 years agowhisper : `split_on_word` no longer trims (#1046)
Georgi Gerganov [Sun, 25 Jun 2023 20:51:01 +0000 (23:51 +0300)]
whisper : `split_on_word` no longer trims (#1046)

2 years agoggml : do not use _GNU_SOURCE gratuitously (#1027)
Przemysław Pawełczyk [Sun, 25 Jun 2023 13:34:30 +0000 (15:34 +0200)]
ggml : do not use _GNU_SOURCE gratuitously (#1027)

* Do not use _GNU_SOURCE gratuitously.

What is needed to build whisper.cpp and examples is availability of
stuff defined in The Open Group Base Specifications Issue 6
(https://pubs.opengroup.org/onlinepubs/009695399/) known also as
Single Unix Specification v3 (SUSv3) or POSIX.1-2001 + XSI extensions.

There is no need to penalize musl libc which simply follows standards.

Not having feature test macros in source code gives greater flexibility
to those wanting to reuse it in 3rd party app, as they can build it with
minimal FTM (_XOPEN_SOURCE=600) or other FTM depending on their needs.

It builds without issues in Alpine (musl libc), Ubuntu (glibc), MSYS2.

* examples : include SDL headers before other headers

This is an attempt at fixing macOS build error coming from SDL2 relying
on Darwin extension memset_pattern4/8/16 coming from Apple's string.h.

2 years agotalk-llama : fix build after ggml sync (#1049)
Przemysław Pawełczyk [Sun, 25 Jun 2023 13:13:50 +0000 (15:13 +0200)]
talk-llama : fix build after ggml sync (#1049)

sed -i 's,GGML_BACKEND_CUDA,GGML_BACKEND_GPU,g' examples/talk-llama/llama.cpp

2 years agometal : sync ggml-metal (ref #1047)
Georgi Gerganov [Sun, 25 Jun 2023 12:40:30 +0000 (15:40 +0300)]
metal : sync ggml-metal (ref #1047)

2 years agoopencl : sync latest ggml-opencl
Georgi Gerganov [Sun, 25 Jun 2023 12:38:12 +0000 (15:38 +0300)]
opencl : sync latest ggml-opencl

2 years agowhisper : fix build with -Werror=undef (#1045)
Philippe Normand [Sun, 25 Jun 2023 12:30:39 +0000 (13:30 +0100)]
whisper : fix build with -Werror=undef (#1045)

2 years agomodels : add ggml_to_pt script (#1042)
Simon Moisselin [Sun, 25 Jun 2023 12:29:54 +0000 (02:29 -1000)]
models : add ggml_to_pt script (#1042)

* adding ggml_to_pt

* typo sys too many args

* fixing swap errors dimensions

---------

Co-authored-by: simonMoisselin <redacted>
2 years agomodels : cd statements are quoted to allow spaces in path (#1041)
Roddur Dasgupta [Sun, 25 Jun 2023 12:27:28 +0000 (05:27 -0700)]
models : cd statements are quoted to allow spaces in path (#1041)

2 years agomodels : handle paths with spaces in download script (close #1038)
Georgi Gerganov [Sun, 25 Jun 2023 12:22:49 +0000 (15:22 +0300)]
models : handle paths with spaces in download script (close #1038)

2 years agomain : add diarization support for all current output types (#1031)
Colin [Sun, 25 Jun 2023 12:07:57 +0000 (07:07 -0500)]
main : add diarization support for all current output types (#1031)

Co-authored-by: Georgi Gerganov <redacted>
2 years agoreadme : add java alternative binding (#1029)
GiviMAD [Sun, 25 Jun 2023 11:46:07 +0000 (04:46 -0700)]
readme : add java alternative binding (#1029)

Signed-off-by: Miguel Álvarez <redacted>
2 years agogo : add support for whisper_full_lang_id() (#1010)
Jay Binks [Sun, 25 Jun 2023 11:45:33 +0000 (21:45 +1000)]
go : add support for whisper_full_lang_id() (#1010)

* * Add support for whisper_full_lang_id() to go bindings

* Expose token.id so we can test beg, eot etc

---------

Co-authored-by: Jay Binks <redacted>
2 years agogo : fix "cb" -> "callNewSegment"
Georgi Gerganov [Sun, 25 Jun 2023 11:34:10 +0000 (14:34 +0300)]
go : fix "cb" -> "callNewSegment"