1

I am trying to run Keras with my GPU on my Macbook Pro (2020). tried to run a test with plaidml

$ plaidbench keras mobilenet

I get the following error:

'str' object has no attribute 'decode'
Set --print-stacktraces to see the entire traceback

I read to install h5py==2.10.0 However, this fails since it's not able to build a wheel for h5py==2.10.0

These are my installed packaged:

keras==2.2.4
tensorflow==2.5.3
pyopencl==2021.2.13
plaidml-keras==0.7.0
plaidbench==0.7.0

Python version (installed via virtualenv): 3.9.7

Please help!!

:)

Niels Hoogeveen
  • 365
  • 4
  • 19
  • 1
    Something, somewhere is expecting a `bytes` object but is getting a `str`. I can't tell where from this. Perhaps use the `--print-stacktraces` as it suggests? – Keith Feb 08 '22 at 11:21
  • No it's a problem of h5py version. However, when I downgrade it to 2.10.0 is fails to build the wheel. – Niels Hoogeveen Feb 08 '22 at 12:01
  • It may be a version problem, but it's a version causing something to get a `str` when it expects a `bytes`. Keith's description of the problem is unambiguously correct. (`.decode()` is what one calls to convert `bytes` to `str`). – Charles Duffy Feb 16 '22 at 01:39

1 Answers1

2

You can avoid the problem by editing keras' code...

Access your 'site-packages' directory ... to open up 'saving.py'

i.e. /usr/lib/python3.9/site-packages/keras/engine/saving.py

Then go to line 1004 and 1008 to comment out .decode('utf-8') parts of the code.