pub struct Mimi<T: Tensor> {
pub quantizer: SplitResidualVectorQuantizer<T>,
/* private fields */
}Expand description
Mimi audio tokenizer.
Fields§
§quantizer: SplitResidualVectorQuantizer<T>Split residual vector quantizer.
Implementations§
Source§impl<T: Tensor> Mimi<T>
impl<T: Tensor> Mimi<T>
Sourcepub fn new(config: Config, context: &T::Context) -> Result<Self, Error>
pub fn new(config: Config, context: &T::Context) -> Result<Self, Error>
Creates an unloaded Mimi tokenizer from config.
Sourcepub fn mimi_config(&self) -> &Config
pub fn mimi_config(&self) -> &Config
Returns the Mimi configuration.
Sourcepub fn encode_latent(
&mut self,
latent: &T,
context: &T::Context,
) -> Result<T, Error>
pub fn encode_latent( &mut self, latent: &T, context: &T::Context, ) -> Result<T, Error>
Encodes latent frames shaped [batch, 512, frames] into Mimi tokens.
Sourcepub fn encode(&mut self, pcm: &T, context: &T::Context) -> Result<T, Error>
pub fn encode(&mut self, pcm: &T, context: &T::Context) -> Result<T, Error>
Encodes PCM shaped [batch, 1, samples] into Mimi tokens [batch, codebooks, frames].
Sourcepub fn reset_encode_state(&mut self)
pub fn reset_encode_state(&mut self)
Resets state used by Mimi::encode_step.
Sourcepub fn encode_step(
&mut self,
pcm: &T,
context: &T::Context,
) -> Result<Option<T>, Error>
pub fn encode_step( &mut self, pcm: &T, context: &T::Context, ) -> Result<Option<T>, Error>
Encodes one PCM frame into the next Mimi token frame.
Accepts PCM shaped [batch, 1, samples]. Returns None until the
streaming encoder has enough samples to emit a complete codec frame.
Sourcepub fn decode_latent(
&mut self,
codes: &T,
context: &T::Context,
) -> Result<T, Error>
pub fn decode_latent( &mut self, codes: &T, context: &T::Context, ) -> Result<T, Error>
Decodes Mimi tokens shaped [batch, codebooks, frames] into latent frames.
Sourcepub fn decode(&mut self, codes: &T, context: &T::Context) -> Result<T, Error>
pub fn decode(&mut self, codes: &T, context: &T::Context) -> Result<T, Error>
Decodes Mimi tokens shaped [batch, codebooks, frames] into PCM [batch, 1, samples].
Sourcepub fn reset_decode_state(&mut self)
pub fn reset_decode_state(&mut self)
Resets state used by Mimi::decode_step.
Trait Implementations§
Source§impl<T: Tensor> AudioTokenizer for Mimi<T>
impl<T: Tensor> AudioTokenizer for Mimi<T>
Source§impl<T: Tensor> Parameterized<T> for Mimi<T>
impl<T: Tensor> Parameterized<T> for Mimi<T>
Source§fn visit_parameters<'a, V>(&'a self, visitor: &mut V)where
V: ParameterVisitor<'a, T>,
fn visit_parameters<'a, V>(&'a self, visitor: &mut V)where
V: ParameterVisitor<'a, T>,
Visits every parameter exactly once using stable identities.
Source§fn visit_parameters_mut<'a, V>(&'a mut self, visitor: &mut V)where
V: ParameterVisitorMut<'a, T>,
fn visit_parameters_mut<'a, V>(&'a mut self, visitor: &mut V)where
V: ParameterVisitorMut<'a, T>,
Mutably visits every parameter exactly once using stable identities.
Source§fn set_trainable(&mut self, trainable: bool)
fn set_trainable(&mut self, trainable: bool)
Updates whether all parameters in this module are trainable.
Auto Trait Implementations§
impl<T> Freeze for Mimi<T>
impl<T> RefUnwindSafe for Mimi<T>where
SplitResidualVectorQuantizer<T>: RefUnwindSafe,
SeaNetEncoder<T>: RefUnwindSafe,
MimiTransformer<T>: RefUnwindSafe,
StreamableConv1d<T>: RefUnwindSafe,
StreamableConvTranspose1d<T>: RefUnwindSafe,
SeaNetDecoder<T>: RefUnwindSafe,
impl<T> Send for Mimi<T>
impl<T> Sync for Mimi<T>
impl<T> Unpin for Mimi<T>
impl<T> UnsafeUnpin for Mimi<T>where
SplitResidualVectorQuantizer<T>: UnsafeUnpin,
SeaNetEncoder<T>: UnsafeUnpin,
MimiTransformer<T>: UnsafeUnpin,
StreamableConv1d<T>: UnsafeUnpin,
StreamableConvTranspose1d<T>: UnsafeUnpin,
SeaNetDecoder<T>: UnsafeUnpin,
impl<T> UnwindSafe for Mimi<T>where
SplitResidualVectorQuantizer<T>: UnwindSafe,
SeaNetEncoder<T>: UnwindSafe,
MimiTransformer<T>: UnwindSafe,
StreamableConv1d<T>: UnwindSafe,
StreamableConvTranspose1d<T>: UnwindSafe,
SeaNetDecoder<T>: UnwindSafe,
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