sharathadavanne / seld-dcase2021

Baseline method for sound event localization task of DCASE 2021 challenge
Other
39 stars 18 forks source link

Keras/tensorflow dependency bugs #6

Open sedurCode opened 3 years ago

sedurCode commented 3 years ago

Good morning, Can you please add the pre-requisit tensorflow version, along with the other project pre-requisits such as librosa to the readme. As it stands, when using an environment with the given python and keras versions, the current code in this repository does not run.

sharathadavanne commented 3 years ago

Hi @sedurCode thanks for using this repo. I have tested this code with Keras 2.2.4 and Tensorflow 1.14.0, which is basically one of the preconfigured TensorFlow environments in my university. I have used librosa 0.8.0 for feature extraction purpose.

sedurCode commented 3 years ago

Hi @sharathadavanne thank you very much for responding so quickly! I will reconfigure my environment, stash my changes and see if I can get the baseline to run successfully!

sedurCode commented 3 years ago

I found two subsequent bugs, one caused by h5py being of a version >= 3.0.0 [this is a known keras/tensorflow bug] The other being in Keras saving.py line 251 where testing against the implicit booleanness of a numpy type nd_array caused an exception when the array was not empty. I am assuming this is a sensible legal operation on earlier versions of numpy.

Could you please express which numpy and h5py versions are in your distribution @sharathadavanne

sharathadavanne commented 3 years ago

Hi @sedurCode I am sorry you are facing so many issues with this repo. Here are the versions you asked for, numpy==1.20.3 and h5py==3.2.1

sedurCode commented 3 years ago

Great, thank you @sharathadavanne! I will update to those package versions and give it another go! Interesting your h5py is >3.0.0 but your Keras is 2.2.4, yet you don't get the model loading bug. I assume it is not patched internally.

sedurCode commented 3 years ago

Yeah ok, i'm guessing the h5py related known bug is either patched in your institutional distro or there is some other mistmatch related to writing and reading files and strings. The symptom of the issue is line 224 of 'saving.py' in keras: model_config = json.loads(model_config.decode('utf-8')) because model_config as a string in this case is already decoded from utf8 into a JSON format and is not the expected byte array type. For anyone else who has this issue, a fix is to revert h5py version to version 2.10.0.

WRT the numpy related bug, at line 251 of 'saving,py' it doesn't appear changing the numpy version to 1.20.3 solved this for me. Instead it is possible to patch the file at the line with the following replacement: if weight_names.size is not 0: This allows the code to run successfully.

I appreciate the time and effort you have made in order to release this code, thank you again.