Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update whisper.cpp version to 1.6.2 #142

Merged
merged 9 commits into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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 }

Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,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;
4 changes: 2 additions & 2 deletions src/standalone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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,
}
}
}
Expand Down
59 changes: 59 additions & 0 deletions src/whisper_ctx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -475,13 +475,37 @@ 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,
/// Enable flash attention, default false
pub flash_attn : 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,
arizhih marked this conversation as resolved.
Show resolved Hide resolved
/// 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,
arizhih marked this conversation as resolved.
Show resolved Hide resolved
/// 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
impl Default for WhisperContextParameters {
fn default() -> Self {
Self {
use_gpu: cfg!(feature = "_gpu"),
flash_attn : false,
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
}
}
}
Expand All @@ -493,9 +517,44 @@ impl WhisperContextParameters {
self.use_gpu = use_gpu;
self
}
pub fn flash_attn(&mut self, flash_attn: bool) -> &mut Self {
self.flash_attn = flash_attn;
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,
flash_attn: self.flash_attn,
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,
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion sys/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
2 changes: 1 addition & 1 deletion sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ fn main() {
}

if cfg!(feature = "cuda") {
config.define("WHISPER_CUBLAS", "ON");
config.define("WHISPER_CUDA", "ON");
}

if cfg!(feature = "openblas") {
Expand Down
2 changes: 1 addition & 1 deletion sys/whisper.cpp
Submodule whisper.cpp updated 196 files
Loading