pub struct BeamSearchDecoder { /* private fields */ }Expand description
Beam search decoder for Whisper
Implementations§
Source§impl BeamSearchDecoder
impl BeamSearchDecoder
Sourcepub fn new(config: DecodingConfig) -> Self
pub fn new(config: DecodingConfig) -> Self
Create a new beam search decoder
Sourcepub fn decode(
&self,
token_probs: &[Vec<f32>],
initial_token: u32,
vocab_size: usize,
eos_token: u32,
_pad_token: u32,
) -> Result<Vec<u32>>
pub fn decode( &self, token_probs: &[Vec<f32>], initial_token: u32, vocab_size: usize, eos_token: u32, _pad_token: u32, ) -> Result<Vec<u32>>
Decode token probabilities to a sequence using beam search
§Arguments
token_probs- Matrix of shape (seq_len, vocab_size) with log probabilities per tokeninitial_token- Starting token (usually language token or BOS)vocab_size- Size of vocabularyeos_token- End-of-sequence token ID_pad_token- Padding token ID (reserved for future use)
§Returns
Vector of token IDs representing the decoded sequence
Auto Trait Implementations§
impl Freeze for BeamSearchDecoder
impl RefUnwindSafe for BeamSearchDecoder
impl Send for BeamSearchDecoder
impl Sync for BeamSearchDecoder
impl Unpin for BeamSearchDecoder
impl UnsafeUnpin for BeamSearchDecoder
impl UnwindSafe for BeamSearchDecoder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more