Skip to main content

CodecDecoder

Struct CodecDecoder 

Source
pub struct CodecDecoder<B: Backend> { /* private fields */ }
Expand description

Full codec decoder: conv-transformer autoencoder producing 24 kHz audio.

Loads 117 tensors from SafeTensors with weight norm fusion. The decoder_blocks layout is:

  • Even blocks (0, 2, 4, 6): convolution (input proj or upsample)
  • Odd blocks (1, 3, 5, 7): transformer groups (2 layers each)
  • Output: weight-normed Conv1d [1024→240, k=7]

Implementations§

Source§

impl<B: Backend> CodecDecoder<B>

Source

pub fn from_components( input_conv: CausalConv1d<B>, transformer_group_layers: Vec<Vec<CodecTransformerLayer<B>>>, upsample_convs: Vec<CausalConvTranspose1d<B>>, output_conv: CausalConv1d<B>, vq_codebook: VqCodebook<B>, ) -> Self

Create a codec decoder from pre-loaded components (for GGUF loading).

transformer_group_layers is a Vec of 4 groups, each a Vec of layers.

Source

pub fn from_safetensors( safetensors: &SafeTensors<'_>, config: &CodecDecoderConfig, device: &B::Device, ) -> Result<Self>

Load the full codec decoder from SafeTensors.

§Arguments
  • safetensors - SafeTensors data containing all codec weights
  • config - Codec decoder configuration
  • device - Device for tensor allocation
Source

pub fn decode( &self, semantic_indices: &[usize], acoustic_indices: Tensor<B, 2>, ) -> Tensor<B, 2>

Decode quantized tokens into a 24 kHz waveform.

§Arguments
  • semantic_indices - Semantic token indices per frame, each in [0, 8191]. Shape: [N]
  • acoustic_indices - Acoustic FSQ indices per frame [N, 36], each in [0, 20] as f32
§Returns

Audio samples [1, total_samples] at 24 kHz.

Source

pub fn vq_codebook(&self) -> &VqCodebook<B>

Access the VQ codebook (for external use).

Auto Trait Implementations§

§

impl<B> !Freeze for CodecDecoder<B>

§

impl<B> !RefUnwindSafe for CodecDecoder<B>

§

impl<B> !Sync for CodecDecoder<B>

§

impl<B> !UnwindSafe for CodecDecoder<B>

§

impl<B> Send for CodecDecoder<B>
where CausalConv1d<B>: Send, Vec<TransformerGroup<B>>: Send, Vec<CausalConvTranspose1d<B>>: Send, VqCodebook<B>: Send,

§

impl<B> Unpin for CodecDecoder<B>
where CausalConv1d<B>: Unpin, Vec<TransformerGroup<B>>: Unpin, Vec<CausalConvTranspose1d<B>>: Unpin, VqCodebook<B>: Unpin,

§

impl<B> UnsafeUnpin for CodecDecoder<B>

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<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoComptime for T

Source§

fn comptime(self) -> Self

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

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

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more