pub enum PoolingType {
None,
Mean,
Cls,
Last,
Rank,
}Expand description
enum llama_pooling_type, by its wire values.
Variants§
None
No pooling: every token’s hidden state is returned.
Mean
Arithmetic mean over the sequence.
Cls
The first token’s row. What BERT/BGE checkpoints use, because
their [CLS] position is the one the model was trained to put
the sentence representation in.
Last
The last token’s row. Decoder-style embedding models.
Rank
Not pooling — a reranker classification head. See module docs.
Implementations§
Source§impl PoolingType
impl PoolingType
Sourcepub fn name(self) -> &'static str
pub fn name(self) -> &'static str
The name upstream prints, so a refusal names the same thing the
user’s llama-embedding --pooling flag does.
Sourcepub fn from_gguf(
file: &impl TensorSource,
arch: &str,
) -> Result<Option<Self>, PoolingError>
pub fn from_gguf( file: &impl TensorSource, arch: &str, ) -> Result<Option<Self>, PoolingError>
Reads {arch}.pooling_type. Ok(None) means the key is absent
or explicitly unspecified — the caller picks a default and says
so, rather than this function inventing one.
Trait Implementations§
Source§impl Clone for PoolingType
impl Clone for PoolingType
Source§fn clone(&self) -> PoolingType
fn clone(&self) -> PoolingType
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 moreimpl Copy for PoolingType
Source§impl Debug for PoolingType
impl Debug for PoolingType
impl Eq for PoolingType
Source§impl PartialEq for PoolingType
impl PartialEq for PoolingType
impl StructuralPartialEq for PoolingType
Auto Trait Implementations§
impl Freeze for PoolingType
impl RefUnwindSafe for PoolingType
impl Send for PoolingType
impl Sync for PoolingType
impl Unpin for PoolingType
impl UnsafeUnpin for PoolingType
impl UnwindSafe for PoolingType
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> 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