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
| Variant | Params | d_model | Heads | Layers | FFN dim |
|---|---|---|---|---|---|
| Small | 4.6 M | 200 | 8 | 12 | 512 |
| Medium | 33 M | 512 | 16 | 16 | 1 024 |
| Large | 201 M | 1 024 | 16 | 24 | 2 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 / device | Backend | Notes |
|---|---|---|
cpu, rlx-cpu | RLX CPU | Rayon + SIMD; default |
metal | Apple Metal / MPS | macOS |
mlx | Apple MLX | macOS |
gpu, wgpu | RLX wgpu | Metal/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.