Expand description
§eegdino-rs
Rust inference crate for the EEG-DINO foundation model, built on the Burn ML framework.
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.
§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 (builder)
ⓘ
use eegdino_rs::prelude::*;
use burn::backend::NdArray;
type B = NdArray;
let encoder = EegDinoEncoder::<B>::builder()
.weights("weights/eeg_dino_small.safetensors")
.size(ModelSize::Small)
.device(Default::default())
.build()?;
let signal = vec![0.0f32; 19 * 2000];
let result = encoder.encode_raw(&signal, 1, 19, 2000)?;
// result.shape == [1, 191, 200]§Batch encoding
ⓘ
let signals: Vec<Vec<f32>> = load_recordings();
// Single batched forward pass (fastest):
let result = encoder.encode_batch(&signals, 19, 2000)?;
// Or one-by-one:
let results = encoder.encode_many(&signals, 19, 2000);§Backends
| Feature | Backend | Notes |
|---|---|---|
ndarray (default) | CPU | Multi-threaded via Rayon + SIMD |
blas-accelerate | CPU + Accelerate | Recommended on Apple Silicon |
wgpu | GPU | Metal (macOS) / Vulkan (Linux) |
wgpu-f16 | GPU f16 | Half-precision, 2x less memory |
Re-exports§
pub use config::ModelConfig;pub use config::ModelSize;pub use error::EegDinoError;pub use error::Result;pub use inference::EegDinoEncoder;pub use inference::EegDinoEncoderBuilder;pub use inference::EncodingResult;pub use inference::EegDinoClassifier;pub use inference::ClassificationResult;pub use inference::detect_model_size;pub use model::encoder::EEGEncoder;pub use model::classifier::ClassificationModel;pub use model::embedding::EmbeddingCache;pub use model::embedding::PatchEmbedding;
Modules§
- config
- error
- Typed error type for the eegdino-rs public API.
- inference
- model
- prelude
- Convenience re-exports for common usage patterns.
Functions§
- init_
threads - Configure the Rayon thread pool. Call once before model use.