Skip to content

Pre-trained RNN-T .h5 to tflite Conversion Issue #259

@ksettaluri6

Description

@ksettaluri6

Hello,

I am trying to take this pre-trained RNN-T model saved as h5 and convert it to tflite.

I have installed the required packages according to the requirements.txt, and have tried unsuccessfully to convert to tflite using various TensorFlow versions (for example tf 2.5 has tensorflow-text=2.5 and tensorflow-io=0.18). Specifically:

  1. Using any tf versions >2.5 leads to a Failed to functionalize Control Flow V1 ops. Consider using Control Flow V2 ops instead. error. Though there are some resources online on how to resolve this, they suggest running those commands at the initial saving of the trained model. No solutions I found worked here, including tf.enable_control_flow_v2(). I specifically tried tf 2.5, tf 2.8, tf 2.9 and tf-nightly.
  2. Some posted issues on the github mention using tf-nightly to get it to work, however tf-nightly does not save any versions < 2.9.0. I tried a tf-nightly version (tf 2.10) but the tensorflow-text module seems to only support up to tf2.9 - so it downgrades tf every time I try to install. Some solutions appeared to have used tf-nightly ~2.4. Looks like there are no nightly versions that date back that far.
  3. tf2.4: it appears that others had a unique error that occurred here as well, specifically tensorflow.python.framework.errors_impl.InvalidArgumentError: Attempting to add a duplicate function with name: __inference_standard_lstm_11544 where the previous and current definitions differ. Previous definiton: signature. I've tried suggestions on the issue tracker say to go to nightly (doesn't work see 3), or tf 2.3.X.
  4. tf 2.3.0 and tf 2.3.X: lead to the same error - tensorflow.lite.python.convert.ConverterError: input resource[0] expected type resource != float, the type of streaming_transducer_greedy_while_streaming_transducer_decoder_streaming_transducer_prediction_embedding_embedding_lookup_11637_0[0] , again solutions say to go to tf-nightly or tf2.4.

Is there a specific tensorflow, tensorflow-text, and tensorflow-io that can be used to load the pre-trained RNN-T h5 model? Or could you add tf.enable_control_flow_v2() when saving the h5?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingneed to reproduceNeed a code or time to reproduce the issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions