pub struct ZeroShotClassifier<B: Backend> { /* private fields */ }Expand description
Zero-shot classifier backed by a SensorLM model.
Implementations§
Source§impl<B: Backend> ZeroShotClassifier<B>
impl<B: Backend> ZeroShotClassifier<B>
Sourcepub fn new<F>(
model: SensorLMModel<B>,
cfg: &ClassifierConfig,
tokenize: F,
) -> Self
pub fn new<F>( model: SensorLMModel<B>, cfg: &ClassifierConfig, tokenize: F, ) -> Self
Construct the classifier and pre-compute class embeddings.
§Arguments
model– A trained SensorLM model.cfg– Classifier configuration.tokenize– A closure that converts a prompt string into(token_ids, attention_mask)tensors of shape(1, L).
Auto Trait Implementations§
impl<B> !Freeze for ZeroShotClassifier<B>
impl<B> !RefUnwindSafe for ZeroShotClassifier<B>
impl<B> Send for ZeroShotClassifier<B>
impl<B> !Sync for ZeroShotClassifier<B>
impl<B> Unpin for ZeroShotClassifier<B>where
<B as Backend>::FloatTensorPrimitive<2>: Unpin,
<B as Backend>::QuantizedTensorPrimitive<2>: Unpin,
<B as Backend>::FloatTensorPrimitive<1>: Unpin,
<B as Backend>::QuantizedTensorPrimitive<1>: Unpin,
<B as Backend>::FloatTensorPrimitive<3>: Unpin,
<B as Backend>::QuantizedTensorPrimitive<3>: Unpin,
<B as Backend>::Device: Unpin,
<B as Backend>::FloatTensorPrimitive<4>: Unpin,
<B as Backend>::QuantizedTensorPrimitive<4>: Unpin,
impl<B> UnsafeUnpin for ZeroShotClassifier<B>where
<B as Backend>::FloatTensorPrimitive<2>: UnsafeUnpin,
<B as Backend>::QuantizedTensorPrimitive<2>: UnsafeUnpin,
<B as Backend>::FloatTensorPrimitive<1>: UnsafeUnpin,
<B as Backend>::QuantizedTensorPrimitive<1>: UnsafeUnpin,
<B as Backend>::FloatTensorPrimitive<3>: UnsafeUnpin,
<B as Backend>::QuantizedTensorPrimitive<3>: UnsafeUnpin,
<B as Backend>::Device: UnsafeUnpin,
<B as Backend>::FloatTensorPrimitive<4>: UnsafeUnpin,
<B as Backend>::QuantizedTensorPrimitive<4>: UnsafeUnpin,
impl<B> UnwindSafe for ZeroShotClassifier<B>where
<B as Backend>::FloatTensorPrimitive<2>: UnwindSafe,
<B as Backend>::QuantizedTensorPrimitive<2>: UnwindSafe,
<B as Backend>::FloatTensorPrimitive<1>: UnwindSafe,
<B as Backend>::QuantizedTensorPrimitive<1>: UnwindSafe,
<B as Backend>::FloatTensorPrimitive<3>: UnwindSafe,
<B as Backend>::QuantizedTensorPrimitive<3>: UnwindSafe,
<B as Backend>::FloatTensorPrimitive<4>: UnwindSafe,
<B as Backend>::QuantizedTensorPrimitive<4>: UnwindSafe,
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> 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