pub struct TernModel {
pub source_model: String,
pub format_version: u32,
pub layers: Vec<TernLayer>,
pub architecture: String,
pub vocab_size: usize,
pub hidden_size: usize,
pub num_layers: usize,
}Expand description
A complete ternary-quantized LLM.
Fields§
§source_model: StringSource model identifier (e.g. “meta-llama/Llama-3.2-1B”).
format_version: u32ternlang-compress format version.
layers: Vec<TernLayer>All compressed weight layers.
architecture: StringModel architecture metadata (passed through from source).
vocab_size: usizeVocabulary size.
Hidden dimension.
num_layers: usizeNumber of transformer layers.
Implementations§
Source§impl TernModel
impl TernModel
Sourcepub fn total_params(&self) -> usize
pub fn total_params(&self) -> usize
Total number of parameters across all layers.
Sourcepub fn total_memory_bytes(&self) -> usize
pub fn total_memory_bytes(&self) -> usize
Total ternary weight memory in bytes.
Sourcepub fn mean_sparsity(&self) -> f64
pub fn mean_sparsity(&self) -> f64
Average sparsity across all layers.
Sourcepub fn compression_ratio_vs_f16(&self) -> f64
pub fn compression_ratio_vs_f16(&self) -> f64
Compression ratio vs original f16 storage.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for TernModel
impl<'de> Deserialize<'de> for TernModel
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>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for TernModel
impl RefUnwindSafe for TernModel
impl Send for TernModel
impl Sync for TernModel
impl Unpin for TernModel
impl UnsafeUnpin for TernModel
impl UnwindSafe for TernModel
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Converts
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>
Converts
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