Update whisper.cpp version to 1.5.5

This commit is contained in:
arizhih 2024-04-23 16:54:23 +02:00
parent 018447cc3a
commit 813a433a52
7 changed files with 59 additions and 8 deletions

View file

@ -4,7 +4,7 @@ exclude = ["examples/full_usage"]
[package]
name = "whisper-rs"
version = "0.11.0"
version = "0.12.0"
edition = "2021"
description = "Rust bindings for whisper.cpp"
license = "Unlicense"
@ -14,7 +14,7 @@ repository = "https://github.com/tazz4843/whisper-rs"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
whisper-rs-sys = { path = "sys", version = "0.8" }
whisper-rs-sys = { path = "sys", version = "0.10.0" }
log = { version = "0.4", optional = true }
tracing = { version = "0.1", optional = true }

View file

@ -42,5 +42,5 @@ pub type WhisperNewSegmentCallback = whisper_rs_sys::whisper_new_segment_callbac
pub type WhisperStartEncoderCallback = whisper_rs_sys::whisper_encoder_begin_callback;
pub type WhisperProgressCallback = whisper_rs_sys::whisper_progress_callback;
pub type WhisperLogitsFilterCallback = whisper_rs_sys::whisper_logits_filter_callback;
pub type WhisperAbortCallback = whisper_rs_sys::whisper_abort_callback;
pub type WhisperAbortCallback = whisper_rs_sys::ggml_abort_callback;
pub type WhisperLogCallback = whisper_rs_sys::ggml_log_callback;

View file

@ -105,7 +105,7 @@ pub struct SystemInfo {
pub f16c: bool,
pub blas: bool,
pub clblast: bool,
pub cublas: bool,
pub cuda: bool,
}
impl Default for SystemInfo {
@ -118,7 +118,7 @@ impl Default for SystemInfo {
f16c: whisper_rs_sys::ggml_cpu_has_f16c() != 0,
blas: whisper_rs_sys::ggml_cpu_has_blas() != 0,
clblast: whisper_rs_sys::ggml_cpu_has_clblast() != 0,
cublas: whisper_rs_sys::ggml_cpu_has_cublas() != 0,
cuda: whisper_rs_sys::ggml_cpu_has_cuda() != 0,
}
}
}

View file

@ -552,6 +552,21 @@ pub struct WhisperContextParameters {
/// **Warning**: Does not have an effect if OpenCL is selected as GPU backend
/// (in that case, GPU is always enabled).
pub use_gpu: bool,
/// GPU device id, default 0
pub gpu_device: c_int,
/// [EXPERIMENTAL] Enable Token-level timestamps with DTW, default 0
pub dtw_token_timestamps: bool,
/// Preset id for DTW, default whisper_alignment_heads_preset_WHISPER_AHEADS_NONE
pub dtw_aheads_preset : whisper_rs_sys::whisper_alignment_heads_preset,
/// Number of top text layers used from model. Only with whisper_alignment_heads_preset_WHISPER_AHEADS_N_TOP_MOST preset.
pub dtw_n_top : c_int,
/// Custom aheads, only with whisper_alignment_heads_preset_WHISPER_AHEADS_CUSTOM preset
/// See details https://github.com/ggerganov/whisper.cpp/pull/1485#discussion_r1519681143
pub dtw_aheads: whisper_rs_sys::whisper_aheads,
/// Memory size for DTW
///
/// **Warning**: Might be removed in next version of whisper.cpp
pub dtw_mem_size : usize
}
#[allow(clippy::derivable_impls)] // this impl cannot be derived
@ -559,6 +574,12 @@ impl Default for WhisperContextParameters {
fn default() -> Self {
Self {
use_gpu: cfg!(feature = "_gpu"),
gpu_device: 0,
dtw_token_timestamps: false,
dtw_aheads_preset : whisper_rs_sys::whisper_alignment_heads_preset_WHISPER_AHEADS_NONE,
dtw_n_top: -1,
dtw_aheads : whisper_rs_sys::whisper_aheads { n_heads: 0, heads: std::ptr::null() },
dtw_mem_size : 1024 * 1024 * 128
}
}
}
@ -570,9 +591,39 @@ impl WhisperContextParameters {
self.use_gpu = use_gpu;
self
}
pub fn gpu_device(&mut self, gpu_device: c_int) -> &mut Self {
self.gpu_device = gpu_device;
self
}
pub fn dtw_token_timestamps(&mut self, dtw_token_timestamps: bool) -> &mut Self {
self.dtw_token_timestamps = dtw_token_timestamps;
self
}
pub fn dtw_aheads_preset(&mut self, dtw_aheads_preset: whisper_rs_sys::whisper_alignment_heads_preset) -> &mut Self {
self.dtw_aheads_preset = dtw_aheads_preset;
self
}
pub fn dtw_n_top(&mut self, dtw_n_top: c_int) -> &mut Self {
self.dtw_n_top = dtw_n_top;
self
}
pub fn dtw_aheads(&mut self, dtw_aheads: whisper_rs_sys::whisper_aheads) -> &mut Self {
self.dtw_aheads = dtw_aheads;
self
}
pub fn dtw_mem_size(&mut self, dtw_mem_size: usize) -> &mut Self {
self.dtw_mem_size = dtw_mem_size;
self
}
fn to_c_struct(&self) -> whisper_rs_sys::whisper_context_params {
whisper_rs_sys::whisper_context_params {
use_gpu: self.use_gpu,
gpu_device: self.gpu_device,
dtw_token_timestamps: self.dtw_token_timestamps,
dtw_aheads_preset: self.dtw_aheads_preset,
dtw_n_top: self.dtw_n_top,
dtw_aheads: self.dtw_aheads,
dtw_mem_size: self.dtw_mem_size,
}
}
}

View file

@ -1,6 +1,6 @@
[package]
name = "whisper-rs-sys"
version = "0.8.1"
version = "0.10.0"
edition = "2021"
description = "Rust bindings for whisper.cpp (FFI bindings)"
license = "Unlicense"

View file

@ -121,7 +121,7 @@ fn main() {
}
if cfg!(feature = "cuda") {
config.define("WHISPER_CUBLAS", "ON");
config.define("WHISPER_CUDA", "ON");
}
if cfg!(feature = "openblas") {

@ -1 +1 @@
Subproject commit 0b9af32a8b3fa7e2ae5f15a9a08f5b10394993f5
Subproject commit 7395c70a748753e3800b63e3422a2b558a097c80