Skip to main content

Crate eegdino_rs

Crate eegdino_rs 

Source
Expand description

§eegdino-rs

Rust inference crate for the EEG-DINO foundation model, built on RLX.

EEG-DINO learns robust EEG representations via hierarchical self-distillation on 9 000+ hours of EEG data. This crate provides a faithful port of the encoder architecture with verified numerical parity (NRMSE < 1e-6) against the original PyTorch implementation on CPU, Metal, and MLX backends.

§Model sizes

VariantParamsd_modelHeadsLayersFFN dim
Small4.6 M200812512
Medium33 M51216161 024
Large201 M1 02416242 048

§Quick start

use eegdino_rs::prelude::*;

let device = parse_device("metal")?; // cpu | metal | mlx | gpu
let (mut encoder, load_ms) = EegDinoEncoder::load(
    "weights/eeg_dino_small.safetensors".as_ref(),
    None,
    device,
)?;

let signal = vec![0.0f32; 19 * 2000];
let result = encoder.encode_raw(&signal, 1, 19, 2000)?;
// result.shape == [1, 191, 200]

§Backends

Feature / deviceBackendNotes
cpu, rlx-cpuRLX CPURayon + SIMD; default
metalApple Metal / MPSmacOS
mlxApple MLXmacOS
gpu, wgpuRLX wgpuMetal/Vulkan/DX12 (parity vs CPU in progress)

Enable all with --features all-backends.

Re-exports§

pub use config::ModelConfig;
pub use config::ModelSize;
pub use error::EegDinoError;
pub use error::Result;
pub use rlx::detect_model_size;
pub use rlx::device_label;
pub use rlx::feature_for;
pub use rlx::is_device_available;
pub use rlx::parse_device;
pub use rlx::EegDinoEncoder;
pub use rlx::EegDinoEncoderBuilder;
pub use rlx::EncodingResult;

Modules§

config
error
Typed error type for the eegdino-rs public API.
prelude
Convenience re-exports for common usage patterns.
rlx
RLX-backed EEG-DINO inference (rlx::Graph + rlx::Session).

Functions§

init_threads
Configure the Rayon thread pool. Call once before model use.