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: ModelConfigArchitecture hyperparameters (from config.json).
data_cfg: DataConfigPreprocessing / tokenisation parameters.
global_sigma: f32Diffusion noise standard deviation (σ).
Implementations§
Source§impl<B: Backend> ZunaDecoder<B>
impl<B: Backend> ZunaDecoder<B>
Sourcepub fn load(
config_path: &Path,
weights_path: &Path,
device: B::Device,
) -> Result<(Self, f64)>
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).
Sourcepub fn decode_embeddings(
&self,
embeddings: &EncodingResult,
steps: usize,
cfg: f32,
data_norm: f32,
) -> Result<InferenceResult>
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 latentssteps— 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
Sourcepub fn decode_tensor(
&self,
enc_out: Tensor<B, 3>,
tok_idx: Tensor<B, 2, Int>,
steps: usize,
cfg: f32,
) -> Tensor<B, 3>
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§
impl<B> !Freeze for ZunaDecoder<B>
impl<B> !RefUnwindSafe for ZunaDecoder<B>
impl<B> Send for ZunaDecoder<B>
impl<B> !Sync for ZunaDecoder<B>
impl<B> Unpin for ZunaDecoder<B>where
<B as Backend>::Device: Unpin,
<B as Backend>::FloatTensorPrimitive: Unpin,
<B as Backend>::QuantizedTensorPrimitive: Unpin,
impl<B> UnsafeUnpin for ZunaDecoder<B>where
<B as Backend>::Device: UnsafeUnpin,
<B as Backend>::FloatTensorPrimitive: UnsafeUnpin,
<B as Backend>::QuantizedTensorPrimitive: UnsafeUnpin,
impl<B> !UnwindSafe for ZunaDecoder<B>
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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