fix: rustfmt
This commit is contained in:
parent
8b587b97a9
commit
f30d0ea0a1
5 changed files with 18 additions and 18 deletions
|
|
@ -5,6 +5,7 @@ mod error;
|
||||||
mod standalone;
|
mod standalone;
|
||||||
mod utilities;
|
mod utilities;
|
||||||
mod whisper_ctx;
|
mod whisper_ctx;
|
||||||
|
mod whisper_ctx_wrapper;
|
||||||
mod whisper_grammar;
|
mod whisper_grammar;
|
||||||
mod whisper_params;
|
mod whisper_params;
|
||||||
mod whisper_state;
|
mod whisper_state;
|
||||||
|
|
@ -12,7 +13,6 @@ mod whisper_state;
|
||||||
mod whisper_sys_log;
|
mod whisper_sys_log;
|
||||||
#[cfg(feature = "whisper-cpp-tracing")]
|
#[cfg(feature = "whisper-cpp-tracing")]
|
||||||
mod whisper_sys_tracing;
|
mod whisper_sys_tracing;
|
||||||
mod whisper_ctx_wrapper;
|
|
||||||
|
|
||||||
#[cfg(any(feature = "whisper-cpp-log", feature = "whisper-cpp-tracing"))]
|
#[cfg(any(feature = "whisper-cpp-log", feature = "whisper-cpp-tracing"))]
|
||||||
static LOG_TRAMPOLINE_INSTALL: Once = Once::new();
|
static LOG_TRAMPOLINE_INSTALL: Once = Once::new();
|
||||||
|
|
@ -22,9 +22,9 @@ pub use standalone::*;
|
||||||
#[cfg(any(feature = "whisper-cpp-log", feature = "whisper-cpp-tracing"))]
|
#[cfg(any(feature = "whisper-cpp-log", feature = "whisper-cpp-tracing"))]
|
||||||
use std::sync::Once;
|
use std::sync::Once;
|
||||||
pub use utilities::*;
|
pub use utilities::*;
|
||||||
|
pub use whisper_ctx::WhisperContextParameters;
|
||||||
use whisper_ctx::WhisperInnerContext;
|
use whisper_ctx::WhisperInnerContext;
|
||||||
pub use whisper_ctx_wrapper::WhisperContext;
|
pub use whisper_ctx_wrapper::WhisperContext;
|
||||||
pub use whisper_ctx::WhisperContextParameters;
|
|
||||||
pub use whisper_grammar::{WhisperGrammarElement, WhisperGrammarElementType};
|
pub use whisper_grammar::{WhisperGrammarElement, WhisperGrammarElementType};
|
||||||
pub use whisper_params::{FullParams, SamplingStrategy};
|
pub use whisper_params::{FullParams, SamplingStrategy};
|
||||||
#[cfg(feature = "raw-api")]
|
#[cfg(feature = "raw-api")]
|
||||||
|
|
|
||||||
|
|
@ -114,7 +114,6 @@ impl WhisperInnerContext {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// Convert the provided text into tokens.
|
/// Convert the provided text into tokens.
|
||||||
///
|
///
|
||||||
/// # Arguments
|
/// # Arguments
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,9 @@
|
||||||
use std::ffi::{c_int, CStr};
|
use std::ffi::{c_int, CStr};
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
use crate::{WhisperInnerContext, WhisperContextParameters, WhisperError, WhisperState, WhisperToken};
|
use crate::{
|
||||||
|
WhisperContextParameters, WhisperError, WhisperInnerContext, WhisperState, WhisperToken,
|
||||||
|
};
|
||||||
|
|
||||||
pub struct WhisperContext {
|
pub struct WhisperContext {
|
||||||
ctx: Arc<WhisperInnerContext>,
|
ctx: Arc<WhisperInnerContext>,
|
||||||
|
|
@ -9,9 +11,7 @@ pub struct WhisperContext {
|
||||||
|
|
||||||
impl WhisperContext {
|
impl WhisperContext {
|
||||||
fn wrap(ctx: WhisperInnerContext) -> Self {
|
fn wrap(ctx: WhisperInnerContext) -> Self {
|
||||||
Self {
|
Self { ctx: Arc::new(ctx) }
|
||||||
ctx: Arc::new(ctx),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Create a new WhisperContext from a file, with parameters.
|
/// Create a new WhisperContext from a file, with parameters.
|
||||||
|
|
@ -83,7 +83,6 @@ impl WhisperContext {
|
||||||
Ok(Self::wrap(ctx))
|
Ok(Self::wrap(ctx))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// Convert the provided text into tokens.
|
/// Convert the provided text into tokens.
|
||||||
///
|
///
|
||||||
/// # Arguments
|
/// # Arguments
|
||||||
|
|
@ -453,7 +452,6 @@ impl WhisperContext {
|
||||||
self.ctx.full_get_segment_speaker_turn_next(i_segment)
|
self.ctx.full_get_segment_speaker_turn_next(i_segment)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// we don't implement `whisper_init()` here since i have zero clue what `whisper_model_loader` does
|
// we don't implement `whisper_init()` here since i have zero clue what `whisper_model_loader` does
|
||||||
|
|
||||||
/// Create a new state object, ready for use.
|
/// Create a new state object, ready for use.
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
use std::ffi::{c_int, CStr};
|
use std::ffi::{c_int, CStr};
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
use crate::{FullParams, WhisperInnerContext, WhisperError, WhisperToken, WhisperTokenData};
|
use crate::{FullParams, WhisperError, WhisperInnerContext, WhisperToken, WhisperTokenData};
|
||||||
|
|
||||||
/// Rustified pointer to a Whisper state.
|
/// Rustified pointer to a Whisper state.
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
|
@ -27,10 +27,7 @@ impl WhisperState {
|
||||||
ctx: Arc<WhisperInnerContext>,
|
ctx: Arc<WhisperInnerContext>,
|
||||||
ptr: *mut whisper_rs_sys::whisper_state,
|
ptr: *mut whisper_rs_sys::whisper_state,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
Self {
|
Self { ctx, ptr }
|
||||||
ctx,
|
|
||||||
ptr,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Convert raw PCM audio (floating point 32 bit) to log mel spectrogram.
|
/// Convert raw PCM audio (floating point 32 bit) to log mel spectrogram.
|
||||||
|
|
@ -495,7 +492,10 @@ impl WhisperState {
|
||||||
) -> Result<String, WhisperError> {
|
) -> Result<String, WhisperError> {
|
||||||
let ret = unsafe {
|
let ret = unsafe {
|
||||||
whisper_rs_sys::whisper_full_get_token_text_from_state(
|
whisper_rs_sys::whisper_full_get_token_text_from_state(
|
||||||
self.ctx.ctx, self.ptr, segment, token,
|
self.ctx.ctx,
|
||||||
|
self.ptr,
|
||||||
|
segment,
|
||||||
|
token,
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
if ret.is_null() {
|
if ret.is_null() {
|
||||||
|
|
@ -527,7 +527,10 @@ impl WhisperState {
|
||||||
) -> Result<String, WhisperError> {
|
) -> Result<String, WhisperError> {
|
||||||
let ret = unsafe {
|
let ret = unsafe {
|
||||||
whisper_rs_sys::whisper_full_get_token_text_from_state(
|
whisper_rs_sys::whisper_full_get_token_text_from_state(
|
||||||
self.ctx.ctx, self.ptr, segment, token,
|
self.ctx.ctx,
|
||||||
|
self.ptr,
|
||||||
|
segment,
|
||||||
|
token,
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
if ret.is_null() {
|
if ret.is_null() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue