Add multithread support to Whisper-tflite

This commit is contained in:
j1nx 2023-01-20 14:57:19 +01:00
parent edb8057f7f
commit 5e277d5e24
1 changed files with 25 additions and 0 deletions

View File

@ -0,0 +1,25 @@
From 624f7abc65cf1dee85d803c398b36a9b35106720 Mon Sep 17 00:00:00 2001
From: j1nx <p.steenbergen@j1nx.nl>
Date: Fri, 20 Jan 2023 14:22:23 +0100
Subject: [PATCH 1/1] 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 82e9b11..e7d0187 100644
--- a/tflite_minimal/minimal.cc
+++ b/tflite_minimal/minimal.cc
@@ -186,6 +186,8 @@ int main(int argc, char* argv[]) {
tflite::InterpreterBuilder builder(*model, resolver);
std::unique_ptr<tflite::Interpreter> interpreter;
builder(&interpreter);
+ const auto processor_count = std:: thread ::hardware_concurrency();
+ interpreter->SetNumThreads(processor_count);
TFLITE_MINIMAL_CHECK(interpreter != nullptr);
// Allocate tensor buffers.
--
2.34.1