Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Remove remaining direct ML logging

laurenspriem6239de9d1d68
diff --git a/rust/bindings/napi/photos/src/lib.rs b/rust/bindings/napi/photos/src/lib.rs
index e0eab8d5f9..e1d568a003 100644
--- a/rust/bindings/napi/photos/src/lib.rs
+++ b/rust/bindings/napi/photos/src/lib.rs
@@ -68,7 +68,7 @@ impl AssetStore {
for warning in
assets::migrate_desktop_models(&inner, std::path::Path::new(&legacy_models_dir))
{
- eprintln!("Photos model migration: {warning}");
+ ::log::warn!("Photos model migration: {warning}");
}
Self { inner }
}
diff --git a/rust/crates/photos/src/ml/pet/detect.rs b/rust/crates/photos/src/ml/pet/detect.rs
index 309329ad6e..7a89ce3fbc 100644
--- a/rust/crates/photos/src/ml/pet/detect.rs
+++ b/rust/crates/photos/src/ml/pet/detect.rs
@@ -56,7 +56,7 @@ fn postprocess_pet_face_tensor<T: onnx::FloatTensorData>(
*output_shape.last().unwrap() as usize
} else if output_shape.len() == 1 {
let total = output_data.len();
- let inferred = if total.is_multiple_of(13) {
+ if total.is_multiple_of(13) {
13
} else if total.is_multiple_of(12) {
12
@@ -67,19 +67,7 @@ fn postprocess_pet_face_tensor<T: onnx::FloatTensorData>(
"unexpected pet face detector output size: {} (shape: {:?})",
total, output_shape
)));
- };
- let candidates = [11usize, 12, 13];
- let valid_count = candidates
- .iter()
- .filter(|&&c| total.is_multiple_of(c))
- .count();
- if valid_count > 1 {
- eprintln!(
- "[ml][pet] WARNING: flat output len={total} is divisible by {valid_count} row-length candidates; using {inferred}. \
- Prefer a model with 2D output shape for reliability."
- );
}
- inferred
} else {
return Err(MlError::Postprocess(
"pet face detector output shape is empty".to_string(),
diff --git a/rust/crates/photos/src/ml/vector_db.rs b/rust/crates/photos/src/ml/vector_db.rs
index 2278a27ae2..00cdf46391 100644
--- a/rust/crates/photos/src/ml/vector_db.rs
+++ b/rust/crates/photos/src/ml/vector_db.rs
@@ -41,13 +41,11 @@ impl VectorDB {
let db = Self { index, path };
if file_exists {
- println!("Loading index from disk.");
// `view` is immutable, but the reloaded index must remain writable.
db.index
.load(file_path)
.map_err(|e| format!("Failed to load index from {file_path}: {e}"))?;
} else {
- println!("Creating new index.");
db.save_index()?;
}
Ok(db)
@@ -90,7 +88,6 @@ impl VectorDB {
));
}
- println!("Successfully saved index atomically");
Ok(())
}
@@ -428,8 +425,6 @@ impl VectorDB {
if self.path.exists() {
std::fs::remove_file(&self.path)
.map_err(|e| format!("Failed to delete index file {}: {e}", self.path.display()))?;
- } else {
- println!("Index file does not exist.");
}
Ok(())
}