pub struct CodebookConfig {
pub num_centroids: usize,
pub centroid_dim: usize,
pub index_bits: u8,
pub product_quantization: bool,
pub pq_subspaces: usize,
}Expand description
Configuration for a codebook
Fields§
§num_centroids: usizeNumber of centroids (codewords)
centroid_dim: usizeDimension of each centroid
index_bits: u8Bits per index (log2 of num_centroids)
product_quantization: boolWhether to use product quantization
pq_subspaces: usizeNumber of subspaces for PQ
Implementations§
Source§impl CodebookConfig
impl CodebookConfig
Sourcepub fn attention_qk() -> Self
pub fn attention_qk() -> Self
Create config for attention Q/K weights
Sourcepub fn attention_vo() -> Self
pub fn attention_vo() -> Self
Create config for attention V/O weights
Sourcepub fn normalization() -> Self
pub fn normalization() -> Self
Create config for normalization weights
Sourcepub fn memory_size(&self) -> usize
pub fn memory_size(&self) -> usize
Compute memory size for codebook in bytes
Sourcepub fn bits_per_weight(&self) -> f32
pub fn bits_per_weight(&self) -> f32
Compute bits per weight
Trait Implementations§
Source§impl Clone for CodebookConfig
impl Clone for CodebookConfig
Source§fn clone(&self) -> CodebookConfig
fn clone(&self) -> CodebookConfig
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CodebookConfig
impl Debug for CodebookConfig
Source§impl<'de> Deserialize<'de> for CodebookConfig
impl<'de> Deserialize<'de> for CodebookConfig
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 CodebookConfig
impl RefUnwindSafe for CodebookConfig
impl Send for CodebookConfig
impl Sync for CodebookConfig
impl Unpin for CodebookConfig
impl UnsafeUnpin for CodebookConfig
impl UnwindSafe for CodebookConfig
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