Coordinate foreground search and background inference CPU budgets
This commit is contained in:
1 parent
6b78c8bb7f
commit
d85746db5b
12 files changed
+858
-60
No files matched your search
@@ -258,14 +258,15 @@ impl HybridSearch {
|
||||
work.report.chunks + windows.len() <= MAX_SCAN_CHUNKS,
|
||||
"Corpus exceeds ANN generation resource budget of {MAX_SCAN_CHUNKS} chunks"
|
||||
);
|
||||
for (batch_index, batch) in windows.chunks(MAX_BATCH).enumerate() {
|
||||
let batch_limit = self.embedder.document_batch_limit().clamp(1, MAX_BATCH);
|
||||
for (batch_index, batch) in windows.chunks(batch_limit).enumerate() {
|
||||
let texts: Vec<_> = batch.iter().map(|window| window.text.as_str()).collect();
|
||||
work.report.document_inference_calls += 1;
|
||||
let vectors = self.embedder.embed_documents(&texts, title)?;
|
||||
self.store.insert(
|
||||
generation,
|
||||
passage,
|
||||
batch_index * MAX_BATCH,
|
||||
batch_index * batch_limit,
|
||||
batch,
|
||||
&vectors,
|
||||
)?;
|
||||
|
||||
Reference in new issue
Block a user