reve-rs
Pure-Rust inference for the REVE (Representation for EEG with Versatile Embeddings) foundation model, built on Burn 0.20.
REVE is pretrained on 60,000+ hours of EEG data from 92 datasets spanning 25,000 subjects. Its key innovation is a 4D Fourier positional encoding scheme that enables generalization across arbitrary electrode configurations without retraining.
Architecture
EEG [B, C, T]
│
├─ Overlapping Patch Extraction (unfold)
│ → [B, C, n_patches, patch_size]
│
├─ Linear Patch Embedding
│ → [B, C*n_patches, embed_dim]
│
├─ 4D Positional Encoding (Fourier + MLP)
│ (x, y, z, t) → [B, C*n_patches, embed_dim]
│
├─ Transformer Encoder (RMSNorm, GEGLU, Multi-Head Attention)
│ → [B, C*n_patches, embed_dim]
│
└─ Classification Head (Flatten+LN+Linear or Attention Pooling)
→ [B, n_outputs]
Quick Start
use ;
use Path;
// Load model
let = load?;
// Build input batch
let batch = ;
// Run inference
let output = model.run_batch?;
println!;
Build
# CPU (default — NdArray + Rayon)
# CPU with Apple Accelerate BLAS (macOS)
# GPU (Metal on macOS)
# GPU (Vulkan on Linux/Windows)
CLI Inference
# Download weights (requires HuggingFace access)
# Run inference
Pretrained Weights
Weights are on HuggingFace:
| Model | Params | Embed Dim | Layers |
|---|---|---|---|
brain-bzh/reve-base |
72M | 512 | 22 |
brain-bzh/reve-large |
~400M | 1250 | — |
Note: You must agree to the data usage terms on HuggingFace before downloading.
Features
| Feature | Description |
|---|---|
ndarray (default) |
CPU backend with Rayon multi-threading |
blas-accelerate |
Apple Accelerate BLAS (macOS) |
openblas-system |
System OpenBLAS (Linux) |
wgpu |
GPU via wgpu (auto-detect Metal/Vulkan/DX12) |
metal |
Native Metal shaders (macOS) |
vulkan |
Native Vulkan shaders (Linux/Windows) |
hf-download |
HuggingFace Hub weight download |
References
- El Ouahidi et al. (2025). REVE: A Foundation Model for EEG — Adapting to Any Setup with Large-Scale Pretraining on 25,000 Subjects. NeurIPS 2025.
- braindecode Python implementation
License
Apache-2.0