usefulsensors / openai-whisper

Robust Speech Recognition via Large-Scale Weak Supervision
MIT License
62 stars 24 forks source link

Multithread support #7

Open j1nx opened 1 year ago

j1nx commented 1 year ago

Looking at CPU resources while running the inference, only 1 CPU seems to be used on a rpi4.

Is it a possibility to add multithread support?

nyadla-sys commented 1 year ago
  //enable multithreading
  const auto processor_count = std:: thread ::hardware_concurrency();
  interpreter->SetNumThreads(processor_count);

//For more details refer this link

Sets the number of threads used by the interpreter and available to CPU kernels. If not set, the interpreter will use an implementation-dependent default number of threads. Currently, only a subset of kernels, such as conv, support multi-threading. num_threads should be >= -1. Setting num_threads to 0 has the effect to disable multithreading, which is equivalent to setting num_threads to 1. If set to the value -1, the number of threads used will be implementation-defined and platform-dependent.

nyadla-sys commented 1 year ago

Please update steps in README to run tflite on the Raspberry Pi 4 if you wish.