Make whisper-tflite and precise-lite-runner use 2 threads

This commit is contained in:
j1nx 2022-12-12 14:04:13 +01:00
parent f1cdf8e45e
commit 2ec55a7698
2 changed files with 27 additions and 2 deletions

View File

@ -1,7 +1,7 @@
From bdf1875bcd4e34766d45a6514ec9fed9d2cf1a9a Mon Sep 17 00:00:00 2001
From: j1nx <p.steenbergen@j1nx.nl>
Date: Wed, 8 Jun 2022 11:44:11 +0200
Subject: [PATCH 1/1] Try to use 4 threads Tensorflow v2.3.0+ supports
Subject: [PATCH 1/1] Try to use 2 threads Tensorflow v2.3.0+ supports
multithreading.
---
@ -17,7 +17,7 @@ index 7e56a30..0aadf73 100644
# Setup tflite environment
self.interpreter = tflite.Interpreter(model_path=model_name)
+ try:
+ self.interpreter.set_num_threads(4)
+ self.interpreter.set_num_threads(2)
+ except:
+ pass
+

View File

@ -0,0 +1,25 @@
From 4aa7797f8f043df84104b76ceca423832824ea13 Mon Sep 17 00:00:00 2001
From: j1nx <p.steenbergen@j1nx.nl>
Date: Fri, 9 Dec 2022 20:25:46 +0100
Subject: [PATCH 1/1] Add multithread support
---
tflite_minimal/minimal.cc | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tflite_minimal/minimal.cc b/tflite_minimal/minimal.cc
index cd045e0..82e9b11 100644
--- a/tflite_minimal/minimal.cc
+++ b/tflite_minimal/minimal.cc
@@ -200,6 +200,8 @@ int main(int argc, char* argv[]) {
else if (argc == 3) {
memcpy(input, mel.data.data(), mel.n_mel*mel.n_len*sizeof(float));
}
+ interpreter->SetNumThreads(2);
+
// Fill input buffers
// TODO(user): Insert code to fill input tensors.
// Note: The buffer of the input tensor with index `i` of type T can
--
2.34.1