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 3 version compatibility #214

Open
jonnor opened this issue Mar 24, 2024 · 3 comments
Open

Keras 3 version compatibility #214

jonnor opened this issue Mar 24, 2024 · 3 comments

Comments

@jonnor
Copy link
Contributor

jonnor commented Mar 24, 2024

Hi. I cannot see that there is any documentation on which Keras versions are supported. I tried running with the latest versions as per today - Keras 3.1.1.

This gives the following exception.

Traceback (most recent call last):
  File "/home/jon/projects/embeddedml/handson/nnom/train_mobilenet.py", line 27, in <module>
    nnom.generate_model(model, data, name=out_path)
  File "/home/jon/projects/embeddedml/handson/nnom/nnom/scripts/nnom.py", line 757, in generate_model
    quantize_weights(model, per_channel_quant=per_channel_quant, name=name, format=format, layer_q_list=layer_q_list)
  File "/home/jon/projects/embeddedml/handson/nnom/nnom/scripts/nnom.py", line 610, in quantize_weights
    print(dir(layer.outbound_nodes[0].output_tensors))
              ^^^^^^^^^^^^^^^^^^^^
AttributeError: 'Conv2D' object has no attribute 'outbound_nodes'. Did you mean: '_outbound_nodes'?

I tried to fix that line, but then just get stuck a couple of lines down.

Traceback (most recent call last):
  File "/home/jon/projects/embeddedml/handson/nnom/train_mobilenet.py", line 27, in <module>
    nnom.generate_model(model, data, name=out_path)
  File "/home/jon/projects/embeddedml/handson/nnom/nnom/scripts/nnom.py", line 757, in generate_model
    quantize_weights(model, per_channel_quant=per_channel_quant, name=name, format=format, layer_q_list=layer_q_list)
  File "/home/jon/projects/embeddedml/handson/nnom/nnom/scripts/nnom.py", line 614, in quantize_weights
    ('batch_normalization' in layer.outbound_nodes[0].outbound_layer.name):
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'Node' object has no attribute 'outbound_layer'

So I believe Keras 3.x does not really work. But which version should I go back to that is known to be working?

jonnor added a commit to jonnor/embeddedml that referenced this issue Mar 24, 2024
Not working with Keras 3.1.1 at least
Issue filed here majianjia/nnom#214
@jonnor
Copy link
Contributor Author

jonnor commented Apr 7, 2024

For now TF 2.12.1 and TF 2.14.1 with Keras 2.x works. Keras 3 is getting more popular though, so this issue should probably stay open to track progress in supporting that.

@kanndil
Copy link
Contributor

kanndil commented Aug 22, 2024

Make sure to have Python3.11 or less installed, since TF 2.12.1 and TF 2.14.1 are not compatible with Python3.12

@songdaw
Copy link
Contributor

songdaw commented Oct 29, 2024

Keras 2.6.0 works fine for me, I think what we really need is the model weights. So, I use Pytorch to debug and train the model, then transfer model weights to Keras, at last to NNOM.

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

3 participants