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>
impl<B: Backend> CodecDecoder<B>
Sourcepub 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
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.
Sourcepub fn from_safetensors(
safetensors: &SafeTensors<'_>,
config: &CodecDecoderConfig,
device: &B::Device,
) -> Result<Self>
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 weightsconfig- Codec decoder configurationdevice- Device for tensor allocation
Sourcepub fn decode(
&self,
semantic_indices: &[usize],
acoustic_indices: Tensor<B, 2>,
) -> Tensor<B, 2>
pub fn decode( &self, semantic_indices: &[usize], acoustic_indices: Tensor<B, 2>, ) -> Tensor<B, 2>
Sourcepub fn vq_codebook(&self) -> &VqCodebook<B>
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>where
CausalConv1d<B>: UnsafeUnpin,
Vec<TransformerGroup<B>>: UnsafeUnpin,
Vec<CausalConvTranspose1d<B>>: UnsafeUnpin,
VqCodebook<B>: UnsafeUnpin,
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