nnom icon indicating copy to clipboard operation
nnom copied to clipboard

Keras 3 version compatibility

Open jonnor opened this issue 11 months ago • 2 comments

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 avatar Mar 24 '24 11:03 jonnor