Solve onnx build issue Android (#2948)

## Description

Solve build issue on Android
This commit is contained in:
Laurens Priem
2024-08-26 16:38:50 +02:00
committed by GitHub
4 changed files with 11 additions and 5 deletions

View File

@@ -55,7 +55,9 @@ class ClipImageEncoder extends MlModel {
final embedding = (outputs[0]?.value as List<List<double>>)[0];
inputOrt.release();
runOptions.release();
outputs.forEach((element) => element?.release());
for (var element in outputs) {
element?.release();
}
normalizeEmbedding(embedding);
w.stopWithLog("done");
return embedding;

View File

@@ -303,6 +303,7 @@ class SemanticSearchService {
ByteData imageByteData,
int clipImageAddress,
) async {
final startTime = DateTime.now();
final embedding = await ClipImageEncoder.predict(
image,
imageByteData,
@@ -311,6 +312,9 @@ class SemanticSearchService {
final clipResult = ClipResult(fileID: enteFileID, embedding: embedding);
dev.log('Finished running ClipImage for $enteFileID in '
'${DateTime.now().difference(startTime).inMilliseconds} ms');
return clipResult;
}
}

View File

@@ -1667,11 +1667,11 @@ packages:
dependency: "direct main"
description:
path: "."
ref: ente_onnxruntime
resolved-ref: fb9393e36013790938b5bc995a4dca15fed3c944
ref: ios_only
resolved-ref: "70e163745e082b81235d7330b9d5e8c110ed68e4"
url: "https://github.com/ente-io/onnxruntime.git"
source: git
version: "1.1.0"
version: "1.4.1"
open_mail_app:
dependency: "direct main"
description:

View File

@@ -131,7 +131,7 @@ dependencies:
onnxruntime:
git:
url: https://github.com/ente-io/onnxruntime.git
ref: ente_onnxruntime
ref: ios_only
open_mail_app: ^0.4.5
package_info_plus: ^4.1.0
page_transition: ^2.0.2