Manav Rathi 1 سال پیش
والد
کامیت
7dccdecff3
2فایلهای تغییر یافته به همراه10 افزوده شده و 9 حذف شده
  1. 4 1
      desktop/src/main/log.ts
  2. 6 8
      desktop/src/services/clip-service.ts

+ 4 - 1
desktop/src/main/log.ts

@@ -64,7 +64,10 @@ const logInfo = (...params: any[]) => {
 };
 
 const logDebug = (param: () => any) => {
-    if (isDev) console.log(`[debug] ${util.inspect(param())}`);
+    if (isDev) {
+        const p = param();
+        console.log(`[debug] ${typeof p == "string" ? p : util.inspect(p)}`);
+    }
 };
 
 /**

+ 6 - 8
desktop/src/services/clip-service.ts

@@ -172,10 +172,9 @@ const clipImageEmbedding_ = async (jpegFilePath: string) => {
     };
     const t2 = Date.now();
     const results = await imageSession.run(feeds);
-    log.info(
-        `onnx image embedding time: ${Date.now() - t1} ms (prep:${
-            t2 - t1
-        } ms, extraction: ${Date.now() - t2} ms)`,
+    log.debug(
+        () =>
+            `CLIP image embedding took ${Date.now() - t1} ms (prep: ${t2 - t1} ms, inference: ${Date.now() - t2} ms)`,
     );
     const imageEmbedding = results["output"].data; // Float32Array
     return normalizeEmbedding(imageEmbedding);
@@ -280,10 +279,9 @@ export const clipTextEmbedding = async (text: string) => {
     };
     const t2 = Date.now();
     const results = await imageSession.run(feeds);
-    log.info(
-        `onnx text embedding time: ${Date.now() - t1} ms (prep:${
-            t2 - t1
-        } ms, extraction: ${Date.now() - t2} ms)`,
+    log.debug(
+        () =>
+            `CLIP text embedding took ${Date.now() - t1} ms (prep: ${t2 - t1} ms, inference: ${Date.now() - t2} ms)`,
     );
     const textEmbedding = results["output"].data;
     return normalizeEmbedding(textEmbedding);