brain2qwerty 0.0.1

Brain2Qwerty V1/V2 MEG neural decoding inference in Rust (parity-tested vs Python)
Documentation
//! Paths to bundled configs, weights, and parity reference data.

use std::path::PathBuf;

/// Data root: `BRAIN2QWERTY_DATA_DIR` if set, otherwise `../../data` relative to the crate.
pub fn data_dir() -> PathBuf {
    if let Ok(p) = std::env::var("BRAIN2QWERTY_DATA_DIR") {
        return PathBuf::from(p);
    }
    PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("../../data")
}

/// Tiny V2 CI parity references (dim=32).
pub fn parity_refs_dir() -> PathBuf {
    data_dir().join("parity_refs")
}

/// Production V2 parity references (dim=1024).
pub fn parity_refs_v2_dir() -> PathBuf {
    data_dir().join("parity_refs_v2")
}

/// V1 parity references.
pub fn parity_refs_v1_dir() -> PathBuf {
    data_dir().join("parity_refs_v1")
}

/// V2 production config (`config.yaml`).
pub fn config_path() -> PathBuf {
    data_dir().join("config.yaml")
}

/// Default / tiny V2 encoder weights.
pub fn encoder_weights_path() -> PathBuf {
    data_dir().join("encoder.safetensors")
}

/// Production V2 synthetic parity weights.
pub fn encoder_v2_weights_path() -> PathBuf {
    data_dir().join("encoder_v2.safetensors")
}

/// V1 tiny / converted weights.
pub fn encoder_v1_weights_path() -> PathBuf {
    data_dir().join("encoder_v1.safetensors")
}

/// V1 production config.
pub fn v1_config_path() -> PathBuf {
    data_dir().join("v1_config.yaml")
}

pub fn build_args_path() -> PathBuf {
    data_dir().join("build_args.json")
}

pub fn llm_dir() -> PathBuf {
    data_dir().join("llm")
}

pub fn llm_tiny_dir() -> PathBuf {
    llm_dir().join("tiny")
}

pub fn encoder_weights_available() -> bool {
    encoder_weights_path().is_file()
}

pub fn parity_refs_available() -> bool {
    parity_refs_dir().join("input_neuros.bin").is_file()
}

pub fn parity_refs_v2_available() -> bool {
    parity_refs_v2_dir().join("input_neuros.bin").is_file()
}

pub fn encoder_v2_weights_available() -> bool {
    encoder_v2_weights_path().is_file()
}

pub fn parity_refs_v1_available() -> bool {
    parity_refs_v1_dir().join("input_neuros.bin").is_file()
}

pub fn encoder_v1_weights_available() -> bool {
    encoder_v1_weights_path().is_file()
}