ina-foss / inaSpeechSegmenter

CNN-based audio segmentation toolkit. Allows to detect speech, music, noise and speaker gender. Has been designed for large scale gender equality studies based on speech time per gender.
MIT License
736 stars 126 forks source link

does not work with TF2.5 #64

Closed keighrim closed 3 years ago

keighrim commented 3 years ago

I found the segmenter does not get along with tensorflow 2.5.0, spitting this error

$ ina_speech_segmenter.py -i ~/some.input.mp3 -o ~/output
Traceback (most recent call last):
  File "/usr/local/anaconda3/envs/tf25/bin/ina_speech_segmenter.py", line 68, in <module>
    from inaSpeechSegmenter import Segmenter, seg2csv
  File "/usr/local/anaconda3/envs/tf25/lib/python3.8/site-packages/inaSpeechSegmenter/__init__.py", line 26, in <module>
    from .segmenter import Segmenter, seg2csv
  File "/usr/local/anaconda3/envs/tf25/lib/python3.8/site-packages/inaSpeechSegmenter/segmenter.py", line 31, in <module>
    import keras
  File "/usr/local/anaconda3/envs/tf25/lib/python3.8/site-packages/keras/__init__.py", line 20, in <module>
    from . import initializers
  File "/usr/local/anaconda3/envs/tf25/lib/python3.8/site-packages/keras/initializers/__init__.py", line 124, in <module>
    populate_deserializable_objects()
  File "/usr/local/anaconda3/envs/tf25/lib/python3.8/site-packages/keras/initializers/__init__.py", line 82, in populate_deserializable_objects
    generic_utils.populate_dict_with_module_objects(
AttributeError: module 'keras.utils.generic_utils' has no attribute 'populate_dict_with_module_objects'

Most likely related to this issue: https://github.com/keras-team/keras/issues/14632.

I was able to workaround the issue by uninstalling all keras distribution and reinstalling tensorflow.

python3 -m pip uninstall -y keras keras-nightly
python3 -m pip install --upgrade --force-reinstall $(grep tensorflow requirements.txt)

My simple guess is that merely removing keras from this line would resolve the issue.

DavidDoukhan commented 3 years ago

Dear @keighrim , thanks a lot for raising this issue. Following your advice, I've updated setup.py & the README and tf 2.5 is now currently managed. Everything seems ok on my machine, please let me know if this new packaging works fine for you Kind regards,