mirror of
https://github.com/osmarks/meme-search-engine.git
synced 2024-11-13 23:34:49 +00:00
probably I should do better testing
This commit is contained in:
parent
5eae8674ce
commit
74d91d52e5
14
src/main.rs
14
src/main.rs
@ -734,23 +734,23 @@ async fn handle_request(config: Arc<WConfig>, client: Arc<Client>, index: &IInde
|
|||||||
|
|
||||||
if !image_batch.is_empty() {
|
if !image_batch.is_empty() {
|
||||||
batches.push(
|
batches.push(
|
||||||
EmbeddingRequest::Images {
|
(EmbeddingRequest::Images {
|
||||||
images: image_batch
|
images: image_batch
|
||||||
}
|
}, image_weights)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if !text_batch.is_empty() {
|
if !text_batch.is_empty() {
|
||||||
batches.push(
|
batches.push(
|
||||||
EmbeddingRequest::Text {
|
(EmbeddingRequest::Text {
|
||||||
text: text_batch,
|
text: text_batch,
|
||||||
}
|
}, text_weights)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
for batch in batches {
|
for (batch, weights) in batches {
|
||||||
let embs: Vec<Vec<u8>> = query_clip_server(&client, &config.service.clip_server, "/", batch).await?;
|
let embs: Vec<Vec<u8>> = query_clip_server(&client, &config.service.clip_server, "/", batch).await?;
|
||||||
for emb in embs {
|
for (emb, weight) in embs.into_iter().zip(weights) {
|
||||||
total_embedding += &ndarray::Array::from_vec(decode_fp16_buffer(&emb));
|
total_embedding += &(ndarray::Array::from_vec(decode_fp16_buffer(&emb)) * weight);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user