Skip to content

Commit

Permalink
Updated whisper.cpp to 1.5.0 (Macoron#60)
Browse files Browse the repository at this point in the history
* Updated code and windows

* Update build_cpp.yml

* Update build_cpp.yml

* Update build_cpp.yml

* Update build_cpp.yml

* Update build_cpp.yml

* Update build_cpp.yml

* Update build_cpp.yml

* Update build_cpp.yml

* Update build_cpp.yml

* Update build_cpp.yml

* Updated Linux lib

* Disabled metal for now

* Updated mac, ios and android

* Update README.md

* Update test.yml

* Update test.yml

* Delete .github/workflows/activation.yml

* Reset tests

* Update test.yml
  • Loading branch information
Macoron authored Nov 19, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 7f4c33f commit f2f432e
Showing 6 changed files with 20 additions and 4 deletions.
Binary file modified Plugins/Android/libwhisper.a
Binary file not shown.
Binary file modified Plugins/Linux/libwhisper.so
Binary file not shown.
Binary file modified Plugins/MacOS/libwhisper.dylib
Binary file not shown.
Binary file modified Plugins/Windows/libwhisper.dll
Binary file not shown.
Binary file modified Plugins/iOS/libwhisper.a
Binary file not shown.
24 changes: 20 additions & 4 deletions Runtime/Native/WhisperNativeParams.cs
Original file line number Diff line number Diff line change
@@ -8,6 +8,7 @@
using whisper_context_ptr = System.IntPtr;
using whisper_state_ptr = System.IntPtr;
using whisper_token = System.Int32;
using System;

namespace Whisper.Native
{
@@ -19,11 +20,11 @@ public enum WhisperSamplingStrategy

[UnmanagedFunctionPointer(CallingConvention.StdCall)]
public delegate void whisper_new_segment_callback(whisper_context_ptr ctx, whisper_state_ptr state,
int n_new, System.IntPtr user_data);
int n_new, IntPtr user_data);

[UnmanagedFunctionPointer(CallingConvention.StdCall)]
public delegate void whisper_progress_callback(whisper_context_ptr ctx, whisper_state_ptr state,
int progress, System.IntPtr user_data);
int progress, IntPtr user_data);

/// <summary>
/// This is direct copy of C++ struct.
@@ -66,6 +67,7 @@ public unsafe struct WhisperNativeParams

[MarshalAs(UnmanagedType.U1)] public bool translate;
[MarshalAs(UnmanagedType.U1)] public bool no_context; // do not use past transcription (if any) as initial prompt for the decoder
[MarshalAs(UnmanagedType.U1)] bool no_timestamps; // do not generate timestamps
[MarshalAs(UnmanagedType.U1)] public bool single_segment; // force single segment output (useful for streaming)
[MarshalAs(UnmanagedType.U1)] public bool print_special; // print special tokens (e.g. <SOT>, <EOT>, <BEG>, etc.)
[MarshalAs(UnmanagedType.U1)] public bool print_progress; // print progress information
@@ -83,8 +85,12 @@ public unsafe struct WhisperNativeParams
// [EXPERIMENTAL] speed-up techniques
// note: these can significantly reduce the quality of the output
[MarshalAs(UnmanagedType.U1)] public bool speed_up; // speed-up the audio by 2x using Phase Vocoder
[MarshalAs(UnmanagedType.U1)] bool debug_mode; // enable debug_mode provides extra info (eg. Dump log_mel)
public int audio_ctx; // overwrite the audio context size (0 = use default)

// [EXPERIMENTAL] [TDRZ] tinydiarize
[MarshalAs(UnmanagedType.U1)] bool tdrz_enable; // enable tinydiarize speaker turn detection

// tokens to provide to the whisper decoder as initial prompt
// these are prepended to any existing text context from a previous call
public byte* initial_prompt;
@@ -129,18 +135,28 @@ struct beam_search_struct

// called for every newly generated text segment
public whisper_new_segment_callback new_segment_callback;
public System.IntPtr new_segment_callback_user_data;
public IntPtr new_segment_callback_user_data;

// called on each progress update
public whisper_progress_callback progress_callback;
public System.IntPtr progress_callback_user_data;
public IntPtr progress_callback_user_data;

// called each time before the encoder starts
void* encoder_begin_callback;
void* encoder_begin_callback_user_data;

// called each time before ggml computation starts
void* abort_callback;
void* abort_callback_user_data;

// called by each decoder to filter obtained logits
void* logits_filter_callback;
void* logits_filter_callback_user_data;


IntPtr grammar_rules;
UIntPtr n_grammar_rules;
UIntPtr i_start_rule;
float grammar_penalty;
}
}

0 comments on commit f2f432e

Please sign in to comment.