pub fn get_embeddings_parallel(
model: &MPNetModel,
tokenizer: &Tokenizer,
pooler: Option<&MPNetPooler>,
sentences: &[&str],
chunksize: usize,
) -> Result<Tensor>Expand description
Computes embeddings for the given sentences in parallel chunks.
This function takes a model, a tokenizer, an optional pooler, a vector of sentences, and a chunk size, and computes embeddings for the sentences in parallel chunks.
§Arguments
model- A reference to an instance ofMPNetModel.tokenizer- A reference to an instance ofTokenizer.pooler- An optional reference to an instance ofMPNetPooler.sentences- A reference to a vector of sentences.chunksize- The size of each chunk for parallel processing.
§Returns
Result<Tensor>- AResultwhich isOkif the embeddings could be computed successfully. TheErrvariant contains an error message.
§Errors
This function will return an error if the tokenization or the forward pass of the model fails.