We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2b757f4 commit 980b24bCopy full SHA for 980b24b
1 file changed
embeddings/src/model/local.rs
@@ -999,11 +999,14 @@ impl OnnxEmbeddingModel {
999
.map(|worker_texts| {
1000
s.spawn(move || -> Result<Vec<Vec<f32>>, LibError> {
1001
let mut embeddings = Vec::with_capacity(worker_texts.len());
1002
- // Process in batches of bs — same efficiency as batched path
1003
- for batch in worker_texts.chunks(bs) {
1004
- let embs =
1005
- Self::tokenize_and_infer(session, tokenizer, batch, max_input)
1006
- .map_err(|_| LibError::OnnxModelEvalFailed)?;
+ for text in worker_texts {
+ let embs = Self::tokenize_and_infer(
+ session,
+ tokenizer,
+ std::slice::from_ref(text),
1007
+ max_input,
1008
+ )
1009
+ .map_err(|_| LibError::OnnxModelEvalFailed)?;
1010
embeddings.extend(embs);
1011
}
1012
Ok(embeddings)
0 commit comments