Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keras/tensorflow dependency bugs #6

Open
sedurCode opened this issue Jun 7, 2021 · 6 comments
Open

Keras/tensorflow dependency bugs #6

sedurCode opened this issue Jun 7, 2021 · 6 comments

Comments

@sedurCode
Copy link

sedurCode commented Jun 7, 2021

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
Copy link
Owner

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
Copy link
Author

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
Copy link
Author

sedurCode commented Jun 7, 2021

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
Copy link
Owner

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
Copy link
Author

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
Copy link
Author

sedurCode commented Jun 8, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants