opensmile-python icon indicating copy to clipboard operation
opensmile-python copied to clipboard

About opensmile-python multithreading

Open ykingliu opened this issue 4 years ago • 12 comments

Hi, is opensmile-python possible to use multithreading? how to use it? i encountered some problems when i used it

return code: 6 configuration could not be loaded

ykingliu avatar Aug 25 '21 08:08 ykingliu

I am facing the same issue. Could anyone please help?

Issue: OpenSmile Code: 6

eracube avatar Nov 24 '21 17:11 eracube

Unfortunately, support for multi-threading is still blocked by https://github.com/audeering/opensmile/issues/20. You can use multi-processing, though.

frankenjoe avatar Nov 24 '21 18:11 frankenjoe

If multi-threading is broken or unreliable at the moment, would it make sense to remove the option from the library for now or throw an exception if it is set?

chausner-audeering avatar Nov 25 '21 08:11 chausner-audeering

We have removed the option to select multi-threading and automatically switch to multi-processing when multiple workers are set. But it may still happen that a user writes own code where she uses the same instance of Smile in multiple threads.

frankenjoe avatar Nov 25 '21 08:11 frankenjoe

I am using opensmile with dask, and whether I use multi-processing or multi-threading, I get the same error. Note: I am creating a different instance of Smile for each file.

eracube avatar Nov 25 '21 13:11 eracube

Did you try?

smile = Smile(..., num_workers=5)
smile.process_files(files)

frankenjoe avatar Nov 25 '21 14:11 frankenjoe

Thank you for your reply. I need to use process_signal instead of files (I am not reading files from the disk). Is there a way to disable multiprocessing all together? I tried the following but it doesn't seem to work.

smile = Smile(feature_set, feature_level) smile.process.multithreading = False

eracube avatar Nov 26 '21 15:11 eracube

Is there a way to disable multiprocessing all together?

It's off by default since the default value for num_workers is 1.

frankenjoe avatar Nov 26 '21 18:11 frankenjoe

Thank you for this, @frankenjoe. I am running smile.process_signal(array, sample_rate) on multiple processors/threads as a test on a single machine, and I see the following error that occurs in random.

[ 16.12.2021 - 13:54:20 ] (MSG) [2] SMILEapi: openSMILE starting! [ 16.12.2021 - 13:54:20 ] (MSG) [2] SMILEapi: config file is: /venv/lib/python3.9/site-packages/opensmile/core/config/egemaps/v02/eGeMAPSv02.conf [ 16.12.2021 - 13:54:20 ] (MSG) [2] cComponentManager: successfully registered 103 component types. [ 16.12.2021 - 13:54:20 ] (ERR) [1] configManager: ConfigType::findFieldH: referenced base field with name 'Segments.maxNumSeg' not found! [ 16.12.2021 - 13:54:20 ] (ERR) [1] configManager: (line 48) cFileConfigReader::getInstance: unknown field type (name 'Segments.maxNumSeg') (in ConfigType 'cFunctionals') ty=-1

Is it a known bug, or I am doing something wrong?

eracube avatar Dec 17 '21 09:12 eracube

Yes, it's a known bug and requires a fix for https://github.com/audeering/opensmile/issues/20

frankenjoe avatar Dec 17 '21 10:12 frankenjoe

Now that https://github.com/audeering/opensmile/issues/20 is fixed, can this update be propagated to the python module?

agkphysics avatar Jan 10 '22 00:01 agkphysics

@agkphysics it's now available with version 2.4.1. Just make sure to set num_workers>1 and multiprocessing=False.

frankenjoe avatar Jan 10 '22 14:01 frankenjoe