pub struct EmbeddingModelBuilder { /* private fields */ }Expand description
Configure an embedding model with the various parameters for loading, running, and other inference behaviors.
Implementations§
Source§impl EmbeddingModelBuilder
 
impl EmbeddingModelBuilder
Sourcepub fn new(model_id: impl ToString) -> Self
 
pub fn new(model_id: impl ToString) -> Self
A few defaults are applied here:
- Token source is from the cache (.cache/huggingface/token)
 - Automatic device mapping with model defaults according to 
AutoDeviceMapParams 
Sourcepub fn with_throughput_logging(self) -> Self
 
pub fn with_throughput_logging(self) -> Self
Enable runner throughput logging.
Sourcepub fn with_topology(self, topology: Topology) -> Self
 
pub fn with_topology(self, topology: Topology) -> Self
Set the model topology for use during loading. If there is an overlap, the topology type is used over the ISQ type.
Sourcepub fn with_tokenizer_json(self, tokenizer_json: impl ToString) -> Self
 
pub fn with_tokenizer_json(self, tokenizer_json: impl ToString) -> Self
Path to a discrete tokenizer.json file.
Sourcepub fn with_loader_type(self, loader_type: EmbeddingLoaderType) -> Self
 
pub fn with_loader_type(self, loader_type: EmbeddingLoaderType) -> Self
Manually set the model loader type. Otherwise, it will attempt to automatically determine the loader type.
Sourcepub fn with_dtype(self, dtype: ModelDType) -> Self
 
pub fn with_dtype(self, dtype: ModelDType) -> Self
Load the model in a certain dtype.
Sourcepub fn with_force_cpu(self) -> Self
 
pub fn with_force_cpu(self) -> Self
Force usage of the CPU device. Do not use PagedAttention with this.
Sourcepub fn with_token_source(self, token_source: TokenSource) -> Self
 
pub fn with_token_source(self, token_source: TokenSource) -> Self
Source of the Hugging Face token.
Sourcepub fn with_hf_revision(self, revision: impl ToString) -> Self
 
pub fn with_hf_revision(self, revision: impl ToString) -> Self
Set the revision to use for a Hugging Face remote model.
Sourcepub fn with_isq(self, isq: IsqType) -> Self
 
pub fn with_isq(self, isq: IsqType) -> Self
Use ISQ of a certain type. If there is an overlap, the topology type is used over the ISQ type.
Sourcepub fn with_logging(self) -> Self
 
pub fn with_logging(self) -> Self
Enable logging.
Sourcepub fn with_device_mapping(self, device_mapping: DeviceMapSetting) -> Self
 
pub fn with_device_mapping(self, device_mapping: DeviceMapSetting) -> Self
Provide metadata to initialize the device mapper.
Sourcepub fn from_uqff(self, path: Vec<PathBuf>) -> Self
 👎Deprecated: Use UqffTextModelBuilder to load a UQFF model instead of the generic from_uqff
pub fn from_uqff(self, path: Vec<PathBuf>) -> Self
UqffTextModelBuilder to load a UQFF model instead of the generic from_uqffPath to read a .uqff file from. Other necessary configuration files must be present at this location.
For example, these include:
residual.safetensorstokenizer.jsonconfig.json- More depending on the model
 
Sourcepub fn write_uqff(self, path: PathBuf) -> Self
 
pub fn write_uqff(self, path: PathBuf) -> Self
Path to write a .uqff file to and serialize the other necessary files.
The parent (part of the path excluding the filename) will determine where any other files serialized are written to.
For example, these include:
residual.safetensorstokenizer.jsonconfig.json- More depending on the model
 
Sourcepub fn from_hf_cache_path(self, hf_cache_path: PathBuf) -> Self
 
pub fn from_hf_cache_path(self, hf_cache_path: PathBuf) -> Self
Cache path for Hugging Face models downloaded locally
Sourcepub fn with_device(self, device: Device) -> Self
 
pub fn with_device(self, device: Device) -> Self
Set the main device to load this model onto. Automatic device mapping will be performed starting with this device.
pub async fn build(self) -> Result<Model>
Trait Implementations§
Source§impl Clone for EmbeddingModelBuilder
 
impl Clone for EmbeddingModelBuilder
Source§fn clone(&self) -> EmbeddingModelBuilder
 
fn clone(&self) -> EmbeddingModelBuilder
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
 
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl From<UqffEmbeddingModelBuilder> for EmbeddingModelBuilder
 
impl From<UqffEmbeddingModelBuilder> for EmbeddingModelBuilder
Source§fn from(value: UqffEmbeddingModelBuilder) -> Self
 
fn from(value: UqffEmbeddingModelBuilder) -> Self
Auto Trait Implementations§
impl Freeze for EmbeddingModelBuilder
impl RefUnwindSafe for EmbeddingModelBuilder
impl Send for EmbeddingModelBuilder
impl Sync for EmbeddingModelBuilder
impl Unpin for EmbeddingModelBuilder
impl UnwindSafe for EmbeddingModelBuilder
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> CloneToUninit for Twhere
    T: Clone,
 
impl<T> CloneToUninit for Twhere
    T: Clone,
§impl<T> Downcast for Twhere
    T: AsAny + ?Sized,
 
impl<T> Downcast for Twhere
    T: AsAny + ?Sized,
§fn downcast_ref<T>(&self) -> Option<&T>where
    T: AsAny,
 
fn downcast_ref<T>(&self) -> Option<&T>where
    T: AsAny,
Any.§fn downcast_mut<T>(&mut self) -> Option<&mut T>where
    T: AsAny,
 
fn downcast_mut<T>(&mut self) -> Option<&mut T>where
    T: AsAny,
Any.§impl<T> Instrument for T
 
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
 
fn instrument(self, span: Span) -> Instrumented<Self>
§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§impl<F, T> IntoSample<T> for Fwhere
    T: FromSample<F>,
 
impl<F, T> IntoSample<T> for Fwhere
    T: FromSample<F>,
fn into_sample(self) -> T
§impl<T> Pointable for T
 
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
    T: ?Sized,
 
impl<T> PolicyExt for Twhere
    T: ?Sized,
§impl<SS, SP> SupersetOf<SS> for SPwhere
    SS: SubsetOf<SP>,
 
impl<SS, SP> SupersetOf<SS> for SPwhere
    SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
 
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
 
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
 
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
 
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.