Keras-inference-time-optimizer icon indicating copy to clipboard operation
Keras-inference-time-optimizer copied to clipboard

Uninformative error

Open KyloRen1 opened this issue 2 years ago • 0 comments

Hello,

I have a pre-trained model composed of MobileNetV2 in the TimeDistrbuted module and an LSTM temporal model.

I am loading the model using keras.load that works fine. model = tf.keras.models.load_model(model_location)

After that, I am trying to use KITO as following model_reduced = reduce_keras_model(model)

and get the following error

KeyError                                  Traceback (most recent call last)
[<ipython-input-8-65370f45cc6b>](https://11vpthhhaxh-496ff2e9c6d22116-0-colab.googleusercontent.com/outputframe.html?vrz=colab-20220718-060046-RC01_461659493#) in <module>()
      9 
     10 # KITO reducing model size by fusing Conv and BatchNorm
---> 11 model_reduced = reduce_keras_model(model)

1 frames
[/usr/local/lib/python3.7/dist-packages/kito/__init__.py](https://11vpthhhaxh-496ff2e9c6d22116-0-colab.googleusercontent.com/outputframe.html?vrz=colab-20220718-060046-RC01_461659493#) in reduce_keras_model(model, verbose)
    341             continue
    342 
--> 343         input_layers = get_input_layers_ids(model, layer, verbose)
    344         output_layers = get_output_layers_ids(model, layer, verbose)
    345         if verbose:

[/usr/local/lib/python3.7/dist-packages/kito/__init__.py](https://11vpthhhaxh-496ff2e9c6d22116-0-colab.googleusercontent.com/outputframe.html?vrz=colab-20220718-060046-RC01_461659493#) in get_input_layers_ids(model, layer, verbose)
     53             for inbound_layer in node_inbound_layers:
     54                 inbound_layer_id = str(id(inbound_layer))
---> 55                 inbound_layers.append(res[inbound_layer_id])
     56     return inbound_layers
     57 

KeyError: '140599805748752'

My tf version is '2.8.2'

KyloRen1 avatar Jul 20 '22 07:07 KyloRen1