pub struct ModelConfig {Show 13 fields
pub encoder_name: String,
pub num_leads: usize,
pub patch_size_time: usize,
pub patch_size_ch: usize,
pub lead_wise: usize,
pub sample_rate: usize,
pub window_size_sec: usize,
pub seq_len: usize,
pub width: usize,
pub depth: usize,
pub heads: usize,
pub mlp_dim: usize,
pub dim_head: usize,
}Expand description
Model and data configuration for OSF inference.
ModelConfig mirrors the Python OSF ViT hyperparameters stored in
the metadata dict of osf_backbone.pth.
Fields§
§encoder_name: StringModel variant name (e.g. “vit_base”).
num_leads: usizeNumber of input channels (default 12).
patch_size_time: usizeTemporal patch size in samples (default 64).
patch_size_ch: usizeChannel patch size (default 4).
lead_wise: usize0 = 1D patchify (all channels), 1 = 2D patchify (channel groups).
sample_rate: usizeSampling rate (Hz, default 64).
window_size_sec: usizeWindow size in seconds (default 30).
seq_len: usizeSequence length = sample_rate * window_size_sec (default 1920).
width: usizeTransformer hidden dimension (default 768).
depth: usizeNumber of transformer blocks (default 12).
heads: usizeNumber of attention heads (default 12).
mlp_dim: usizeMLP hidden dimension (default 3072 = 4 * width).
dim_head: usizeAttention head dimension (default 64 = width / heads).
Implementations§
Source§impl ModelConfig
impl ModelConfig
Sourcepub fn num_patches_time(&self) -> usize
pub fn num_patches_time(&self) -> usize
Number of time patches per channel row.
Sourcepub fn num_lead_rows(&self) -> usize
pub fn num_lead_rows(&self) -> usize
Number of channel rows (lead groups).
Sourcepub fn num_patches(&self) -> usize
pub fn num_patches(&self) -> usize
Total number of patches (excluding CLS token).
Sourcepub fn for_variant(name: &str) -> Self
pub fn for_variant(name: &str) -> Self
Build config for a specific variant.
Trait Implementations§
Source§impl Clone for ModelConfig
impl Clone for ModelConfig
Source§fn clone(&self) -> ModelConfig
fn clone(&self) -> ModelConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ModelConfig
impl Debug for ModelConfig
Source§impl Default for ModelConfig
impl Default for ModelConfig
Source§impl<'de> Deserialize<'de> for ModelConfig
impl<'de> Deserialize<'de> for ModelConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for ModelConfig
impl RefUnwindSafe for ModelConfig
impl Send for ModelConfig
impl Sync for ModelConfig
impl Unpin for ModelConfig
impl UnsafeUnpin for ModelConfig
impl UnwindSafe for ModelConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more