pub enum ModelSize {
Tiny,
Small,
Base,
}Expand description
Named ViT model-size variants, matching the standard ViT paper dimensions.
Memory figures assume fp32, N = 2448 patches, chunk = 64, and cover attention score/weight tensors for one transformer layer (the practical backward-pass peak). Total GPU memory is 3–5× higher once weights, activations, and Adam optimizer states are included.
| Size | d_model | heads | ~params | per-layer bwd B=16 | per-layer bwd B=4 |
|---|---|---|---|---|---|
| Tiny | 192 | 3 | ~11 M | 2.1 GB | 0.5 GB |
| Small | 384 | 6 | ~44 M | 4.4 GB | 1.1 GB |
| Base | 768 | 12 | ~205 M | 17.5 GB ✗ | 2.2 GB |
Recommended --batch-size per preset (WGPU / Metal, 16 GB device):
tiny: up to 16 — comfortable; per-layer bwd ≈ 2.1 GBsmall: up to 8 — comfortable; per-layer bwd ≈ 2.2 GBbase: up to 4 — per-layer bwd ≈ 2.2 GB; total ≈ 10 GB
Variants§
Tiny
ViT-Ti: d=192, depth=12, heads=3, mlp=768. Fits in ~2 GB VRAM.
Small
ViT-S: d=384, depth=12, heads=6, mlp=1536. Fits in ~6 GB VRAM.
Base
ViT-B: d=768, depth=12, heads=12, mlp=3072. Requires ≥ 16 GB VRAM.
Implementations§
Source§impl ModelSize
impl ModelSize
Sourcepub fn sensor_encoder_config(self) -> SensorEncoderConfig
pub fn sensor_encoder_config(self) -> SensorEncoderConfig
Build a SensorEncoderConfig for this size with sensible defaults.
Sourcepub fn text_encoder_config(self) -> TextEncoderConfig
pub fn text_encoder_config(self) -> TextEncoderConfig
Build a TextEncoderConfig for this size.
Sourcepub fn sensorlm_config(self) -> SensorLMConfig
pub fn sensorlm_config(self) -> SensorLMConfig
Build a complete SensorLMConfig for this size.
Sourcepub fn approx_params(self) -> &'static str
pub fn approx_params(self) -> &'static str
Human-readable approximate parameter count for both towers combined.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for ModelSize
impl<'de> Deserialize<'de> for ModelSize
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>,
impl Copy for ModelSize
impl Eq for ModelSize
impl StructuralPartialEq for ModelSize
Auto Trait Implementations§
impl Freeze for ModelSize
impl RefUnwindSafe for ModelSize
impl Send for ModelSize
impl Sync for ModelSize
impl Unpin for ModelSize
impl UnsafeUnpin for ModelSize
impl UnwindSafe for ModelSize
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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