Keras h5py Version Mismatch

  • Open
  • quality assurance status badge
Details
2 participants
  • Zacchaeus Scheffer
  • zimoun
Owner
unassigned
Submitted by
Zacchaeus Scheffer
Severity
normal
Merged with
Z
Z
Zacchaeus Scheffer wrote on 4 Jan 2023 02:37
(name . bug-guix@gnu.org)(address . bug-guix@gnu.org)
CY4PR03MB27591E805538BEE2A385256098F59@CY4PR03MB2759.namprd03.prod.outlook.com
Hi Guix!


It would seem that the current keras version expects an earlier h5py version for loading models. Specifically, running:

from tensorflow.keras.models import load_model
model = load_model("model.h5")

fails with:

File "/gnu/store/idfn4l2kxil9id21v1yci4jcw6103fah-profile/lib/python3.9/site-packages/tensorflow/python/keras/engine/saving.py", line 228, in load_model
model_config = json.loads(model_config.decode('utf-8'))
AttributeError: 'str' object has no attribute 'decode'

The above works fine in my local pip environment (see below). A quick search online indicates that this can be fixed by downgrading h5py to version 2.10. The current h5py version in guix is 3.6.

My assumption is that this could also be fixed with an upgrade to keras, but upgrading keras sounds much more involved. For a short-term fix, would it be possible to add back a package definition for an earlier h5py in addition to the current version? I'm sure an appropriate version exists somewhere in guix's git history, though my git-foo is too weak for me to check.


Thanks,
Zacchae


P.S.
working (pip): keras 2.10.0, h5py 3.7.0
not working (current guix): keras 2.2.4, h5py 3.6.0
Attachment: file
Z
Z
zimoun wrote on 6 Jan 2023 15:40
87o7rbiv4m.fsf@gmail.com
Hi,

On Wed, 04 Jan 2023 at 01:37, Zacchaeus Scheffer <Zacchaeus.Scheffer@synaptics.com> wrote:

Toggle quote (3 lines)
> working (pip): keras 2.10.0, h5py 3.7.0
> not working (current guix): keras 2.2.4, h5py 3.6.0

Indeed, it is collateral to ea403bf290f4bf8c7bae314e32dbb90653f92996

Toggle snippet (6 lines)
gnu: python-h5py: Update to 3.6.0.

* gnu/packages/python-xyz.scm (python-h5py): Update to 3.6.0.
[arguments]: Set HDF5_DIR variable instead of patching files.

Well, the update of Keras to 2.11.0 (the current latest) requires some
work. First, fetch from Github instead of PyPI because the sources are
not available after v2.6.0; e.g.,


Then, second adapt the recipe. Do you want to give a try?


Cheers,
simon
S
S
Simon Tournier wrote on 9 Jan 2023 13:00
control message for bug #60608
(address . control@debbugs.gnu.org)
874jszzzmw.fsf@gmail.com
merge 60608 60545
quit
Z
Z
Zacchaeus Scheffer wrote on 1 Feb 2023 00:01
Re: bug#60545: Keras h5py Version Mismatch
CY4PR03MB27599F8ABE114B8822E4ABFF98D09@CY4PR03MB2759.namprd03.prod.outlook.com
Hi,

I should probably mention that I am not looking into this. I want to learn more guix, but keras and the additional dependencies required for later versions is kind of a monster to me at the moment.

Thanks,
Zacchae
________________________________
From: zimoun <zimon.toutoune@gmail.com>
Sent: Friday, January 6, 2023 6:40 AM
To: Zacchaeus Scheffer <Zacchaeus.Scheffer@synaptics.com>; 60545@debbugs.gnu.org <60545@debbugs.gnu.org>
Subject: Re: bug#60545: Keras h5py Version Mismatch

CAUTION: Email originated externally, do not click links or open attachments unless you recognize the sender and know the content is safe.


Hi,

On Wed, 04 Jan 2023 at 01:37, Zacchaeus Scheffer <Zacchaeus.Scheffer@synaptics.com> wrote:

Toggle quote (3 lines)
> working (pip): keras 2.10.0, h5py 3.7.0
> not working (current guix): keras 2.2.4, h5py 3.6.0

Indeed, it is collateral to ea403bf290f4bf8c7bae314e32dbb90653f92996

Toggle snippet (6 lines)
gnu: python-h5py: Update to 3.6.0.

* gnu/packages/python-xyz.scm (python-h5py): Update to 3.6.0.
[arguments]: Set HDF5_DIR variable instead of patching files.

Well, the update of Keras to 2.11.0 (the current latest) requires some
work. First, fetch from Github instead of PyPI because the sources are
not available after v2.6.0; e.g.,


Then, second adapt the recipe. Do you want to give a try?


Cheers,
simon
Attachment: file
?
Your comment

Commenting via the web interface is currently disabled.

To comment on this conversation send an email to 60545@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 60545
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch