audeering / opensmile-python

Python package for openSMILE

Home Page:https://audeering.github.io/opensmile-python/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

About opensmile-python multithreading

ykingliu opened this issue · 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

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

Issue:
OpenSmile Code: 6

Unfortunately, support for multi-threading is still blocked by audeering/opensmile#20. You can use multi-processing, though.

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?

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.

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.

Did you try?

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

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

Is there a way to disable multiprocessing all together?

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

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?

Yes, it's a known bug and requires a fix for audeering/opensmile#20

Now that audeering/opensmile#20 is fixed, can this update be propagated to the python module?

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