Skip to main content

ZunaDecoder

Struct ZunaDecoder 

Source
pub struct ZunaDecoder<B: Backend> {
    pub model_cfg: ModelConfig,
    pub data_cfg: DataConfig,
    pub global_sigma: f32,
    /* private fields */
}
Expand description

Standalone ZUNA decoder.

Reconstructs EEG signals from latent embeddings produced by crate::encoder::ZunaEncoder using a rectified-flow diffusion loop.

Load with ZunaDecoder::load (decoder weights only — saves ~50 % memory vs the full crate::ZunaInference).

Fields§

§model_cfg: ModelConfig

Architecture hyperparameters (from config.json).

§data_cfg: DataConfig

Preprocessing / tokenisation parameters.

§global_sigma: f32

Diffusion noise standard deviation (σ).

Implementations§

Source§

impl<B: Backend> ZunaDecoder<B>

Source

pub fn load( config_path: &Path, weights_path: &Path, device: B::Device, ) -> Result<(Self, f64)>

Load decoder weights from a HuggingFace config.json and model.safetensors. Encoder tensors are read from disk but not kept in memory.

Returns (decoder, weight_load_ms).

Source

pub fn describe(&self) -> String

One-line description of the loaded decoder.

Source

pub fn decode_embeddings( &self, embeddings: &EncodingResult, steps: usize, cfg: f32, data_norm: f32, ) -> Result<InferenceResult>

Reconstruct EEG signals from pre-computed embeddings.

This is the pure decode path — no FIF loading or preprocessing happens here. The EncodingResult must have been produced by [ZunaEncoder::encode_fif] or [ZunaEncoder::encode_batch].

§Arguments
  • embeddings — pre-computed encoder latents
  • steps — diffusion denoising steps (50 = full quality, 10 = fast)
  • cfg — classifier-free guidance scale (1.0 = disabled)
  • data_norm — divisor used during preprocessing; multiplied back into the output to restore the original signal scale
Source

pub fn decode_tensor( &self, enc_out: Tensor<B, 3>, tok_idx: Tensor<B, 2, Int>, steps: usize, cfg: f32, ) -> Tensor<B, 3>

Decode a single epoch from a raw encoder output tensor [1, S, output_dim].

tok_idx is [S, 4]. Returns the reconstructed token matrix [1, S, input_dim] before inversion of the chop-and-reshape.

Auto Trait Implementations§

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

Source§

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

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

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

Source§

type Error = Infallible

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

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

Source§

fn vzip(self) -> V