pub struct LmModel { /* private fields */ }Expand description
Moshi temporal LM (Helium) + optional DepFormer depth decoder.
Implementations§
Source§impl LmModel
impl LmModel
pub fn open( cfg: LmConfig, weights: HashMap<String, (Vec<f32>, Vec<usize>)>, ) -> Result<LmModel, Error>
pub fn config(&self) -> &LmConfig
pub fn reset_state(&mut self)
pub fn text_start_token(&self) -> u32
pub fn audio_pad_token(&self) -> u32
Sourcepub fn forward_step(
&mut self,
text_token: Option<u32>,
audio_tokens: &[Option<u32>],
) -> Result<(ArrayBase<OwnedRepr<f32>, Dim<[usize; 1]>>, ArrayBase<OwnedRepr<f32>, Dim<[usize; 1]>>), Error>
pub fn forward_step( &mut self, text_token: Option<u32>, audio_tokens: &[Option<u32>], ) -> Result<(ArrayBase<OwnedRepr<f32>, Dim<[usize; 1]>>, ArrayBase<OwnedRepr<f32>, Dim<[usize; 1]>>), Error>
Single streaming step: sum embeddings → temporal transformer → text logits + hidden.
pub fn depformer_sample( &mut self, hidden: &ArrayBase<OwnedRepr<f32>, Dim<[usize; 1]>>, text_token: Option<u32>, forced: &[Option<u32>], lp: &mut LogitsProcessor, ) -> Result<Option<Vec<u32>>, Error>
Auto Trait Implementations§
impl Freeze for LmModel
impl RefUnwindSafe for LmModel
impl Send for LmModel
impl Sync for LmModel
impl Unpin for LmModel
impl UnsafeUnpin for LmModel
impl UnwindSafe for LmModel
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> ErasedDestructor for Twhere
T: 'static,
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