pub struct ColbertBuilder { /* private fields */ }
Expand description
A builder for configuring and creating a ColBERT
model from the Hugging Face Hub.
This struct provides an interface to set various configuration options
before downloading the model files and initializing the ColBERT
instance.
This is only available when the hf-hub
feature is enabled.
Implementations§
Source§impl ColbertBuilder
impl ColbertBuilder
Sourcepub fn with_query_prefix(self, query_prefix: String) -> Self
pub fn with_query_prefix(self, query_prefix: String) -> Self
Sets the query prefix token. Overrides the value from the config file.
Sourcepub fn with_document_prefix(self, document_prefix: String) -> Self
pub fn with_document_prefix(self, document_prefix: String) -> Self
Sets the document prefix token. Overrides the value from the config file.
Sourcepub fn with_mask_token(self, mask_token: String) -> Self
pub fn with_mask_token(self, mask_token: String) -> Self
Sets the mask token. Overrides the value from the special_tokens_map.json
file.
Sourcepub fn with_attend_to_expansion_tokens(self, attend: bool) -> Self
pub fn with_attend_to_expansion_tokens(self, attend: bool) -> Self
Sets whether to attend to expansion tokens. Overrides the value from the config file.
Sourcepub fn with_query_length(self, query_length: usize) -> Self
pub fn with_query_length(self, query_length: usize) -> Self
Sets the maximum query length. Overrides the value from the config file.
Sourcepub fn with_document_length(self, document_length: usize) -> Self
pub fn with_document_length(self, document_length: usize) -> Self
Sets the maximum document length. Overrides the value from the config file.
Sourcepub fn with_batch_size(self, batch_size: usize) -> Self
pub fn with_batch_size(self, batch_size: usize) -> Self
Sets the batch size for encoding. Defaults to 32.
Sourcepub fn with_device(self, device: Device) -> Self
pub fn with_device(self, device: Device) -> Self
Sets the device to run the model on.
Trait Implementations§
Source§impl TryFrom<ColbertBuilder> for ColBERT
impl TryFrom<ColbertBuilder> for ColBERT
Source§fn try_from(builder: ColbertBuilder) -> Result<Self, Self::Error>
fn try_from(builder: ColbertBuilder) -> Result<Self, Self::Error>
Builds the ColBERT
model by downloading files from the hub and initializing the model.
Source§type Error = ColbertError
type Error = ColbertError
Auto Trait Implementations§
impl Freeze for ColbertBuilder
impl RefUnwindSafe for ColbertBuilder
impl Send for ColbertBuilder
impl Sync for ColbertBuilder
impl Unpin for ColbertBuilder
impl UnwindSafe for ColbertBuilder
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> 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