feat: add multimodal search and granular performance diagnostics
Core CI / core (ubuntu-latest) (push) Failing after 3m31s
Core CI / core (macos-latest) (push) Canceled after 0s
Core CI / core (windows-latest) (push) Canceled after 0s
Core CI / desktop (ubuntu-latest) (push) Successful in 5m39s
Core CI / desktop (macos-latest) (push) Canceled after 0s
Core CI / desktop (windows-latest) (push) Canceled after 0s
Core CI / core (ubuntu-latest) (push) Failing after 3m31s
Core CI / core (macos-latest) (push) Canceled after 0s
Core CI / core (windows-latest) (push) Canceled after 0s
Core CI / desktop (ubuntu-latest) (push) Successful in 5m39s
Core CI / desktop (macos-latest) (push) Canceled after 0s
Core CI / desktop (windows-latest) (push) Canceled after 0s
This commit is contained in:
1 parent
d3bb8c7618
commit
b8400c4fbf
110 files changed
+79395
-250
No files matched your search
@@ -1,6 +1,49 @@
|
||||
use anyhow::Result;
|
||||
use searchi_semantic::{Device, GemmaEmbedder, GEMMA_DIMENSIONS};
|
||||
|
||||
#[test]
|
||||
#[ignore = "Requires explicitly provisioned Google model and CPU worker"]
|
||||
fn google_cpu_debug_query_reports_actual_worker_stages_without_changing_vectors() -> Result<()> {
|
||||
let model = std::env::var_os("SEARCHI_GEMMA_MODEL_DIR").expect("Set SEARCHI_GEMMA_MODEL_DIR");
|
||||
let worker = std::env::var_os("SEARCHI_GEMMA_WORKER").expect("Set SEARCHI_GEMMA_WORKER");
|
||||
let mut embedder = GemmaEmbedder::load_with_device(model, worker, 1, Device::Cpu)?;
|
||||
let query = "supplier contract cancellation policy";
|
||||
let debug = embedder.embed_query_debug(query)?;
|
||||
let diagnostics = embedder.query_diagnostics();
|
||||
for name in [
|
||||
"request_encode_us",
|
||||
"request_write_us",
|
||||
"worker_wait_and_response_decode_us",
|
||||
"response_validate_us",
|
||||
"worker_tokenization_us",
|
||||
"worker_batch_prepare_us",
|
||||
"worker_inference_us",
|
||||
"worker_pool_normalize_us",
|
||||
"worker_token_count",
|
||||
] {
|
||||
assert!(
|
||||
diagnostics.contains_key(name),
|
||||
"Missing actual stage {name}: {diagnostics:?}"
|
||||
);
|
||||
}
|
||||
assert!(diagnostics["worker_inference_us"] > 0);
|
||||
assert!(diagnostics["worker_token_count"] > 0);
|
||||
assert!(!serde_json::to_string(&diagnostics)?.contains(query));
|
||||
let normal = embedder.embed_query(query)?;
|
||||
assert!(embedder.query_diagnostics().is_empty());
|
||||
let cosine: f64 = debug
|
||||
.iter()
|
||||
.zip(&normal)
|
||||
.map(|(a, b)| f64::from(*a) * f64::from(*b))
|
||||
.sum();
|
||||
assert!(
|
||||
cosine >= 0.99999,
|
||||
"Debug tracing changed embeddings: {cosine}"
|
||||
);
|
||||
println!("CPU query diagnostics: {diagnostics:?}; debug/normal cosine {cosine:.8}");
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[ignore = "Requires explicitly provisioned Google model and CPU worker"]
|
||||
fn google_cpu_real_embeddings_and_verified_tail_windows() -> Result<()> {
|
||||
|
||||
Reference in new issue
Block a user