Skip to main content

Mimi

Struct Mimi 

Source
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>

Source

pub fn new(config: Config, context: &T::Context) -> Result<Self, Error>

Creates an unloaded Mimi tokenizer from config.

Source

pub fn mimi_config(&self) -> &Config

Returns the Mimi configuration.

Source

pub fn load_parameters( &mut self, parameters: impl IntoIterator<Item = (String, T)>, ) -> Result<(), Error>

Strictly replaces every model parameter with backend-native checkpoint tensors using Eredu’s stable parameter names.

Backend integrations remain responsible for reading their preferred checkpoint format and converting weight layouts. Mimi owns parameter completeness and shape validation, so those integrations do not need to reproduce the architecture or its parameter tree.

Source

pub fn encode_latent( &mut self, latent: &T, context: &T::Context, ) -> Result<T, Error>

Encodes latent frames shaped [batch, 512, frames] into Mimi tokens.

Source

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].

Source

pub fn reset_encode_state(&mut self)

Resets state used by Mimi::encode_step.

Source

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.

Source

pub fn decode_latent( &mut self, codes: &T, context: &T::Context, ) -> Result<T, Error>

Decodes Mimi tokens shaped [batch, codebooks, frames] into latent frames.

Source

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].

Source

pub fn reset_decode_state(&mut self)

Resets state used by Mimi::decode_step.

Source

pub fn decode_step( &mut self, codes: &T, context: &T::Context, ) -> Result<T, Error>

Decodes one Mimi token frame into the next PCM chunk.

Accepts codes shaped [batch, codebooks] or [batch, codebooks, 1].

Trait Implementations§

Source§

impl<T: Tensor> AudioTokenizer for Mimi<T>

Source§

type Tensor = T

Backend-native tensor handle.
Source§

fn config(&self) -> AudioTokenizerConfig

Codec configuration.
Source§

fn encode(&mut self, pcm: &T, context: &T::Context) -> Result<T, Error>

Encodes mono PCM shaped [batch, channels, samples] into codec tokens.
Source§

fn decode(&mut self, codes: &T, context: &T::Context) -> Result<T, Error>

Decodes codec tokens shaped [batch, codebooks, frames] into PCM.
Source§

impl<T: Clone + Tensor> Clone for Mimi<T>

Source§

fn clone(&self) -> Mimi<T>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Debug + Tensor> Debug for Mimi<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: Tensor> Parameterized<T> for Mimi<T>

Source§

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>,

Mutably visits every parameter exactly once using stable identities.
Source§

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>
where SplitResidualVectorQuantizer<T>: Freeze, SeaNetEncoder<T>: Freeze, MimiTransformer<T>: Freeze, StreamableConv1d<T>: Freeze, StreamableConvTranspose1d<T>: Freeze, SeaNetDecoder<T>: Freeze,

§

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>
where SplitResidualVectorQuantizer<T>: Send, SeaNetEncoder<T>: Send, MimiTransformer<T>: Send, StreamableConv1d<T>: Send, StreamableConvTranspose1d<T>: Send, SeaNetDecoder<T>: Send,

§

impl<T> Sync for Mimi<T>
where SplitResidualVectorQuantizer<T>: Sync, SeaNetEncoder<T>: Sync, MimiTransformer<T>: Sync, StreamableConv1d<T>: Sync, StreamableConvTranspose1d<T>: Sync, SeaNetDecoder<T>: Sync,

§

impl<T> Unpin for Mimi<T>
where SplitResidualVectorQuantizer<T>: Unpin, SeaNetEncoder<T>: Unpin, MimiTransformer<T>: Unpin, StreamableConv1d<T>: Unpin, StreamableConvTranspose1d<T>: Unpin, SeaNetDecoder<T>: Unpin,

§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.