You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ConverterError:input resource[0] expected type resource !=float, the type of contextnet_greedy_while_contextnet_decoder_contextnet_prediction_embedding_embedding_lookup_24797_0[0]
#236
Open
MhmudAlpurd opened this issue
Nov 13, 2021
· 2 comments
Hi everyone, I'm going to convert h5 to tflite of contexnet model, by executing tflite.py in the examples/contextnet/ direction, and I get several errors. I run these commands in order, git clone https://github.com/TensorSpeech/TensorFlowASR.git \n cd TensorFlowASR \n pip3 install -e ".[tf2.x]" # or ".[tf2.x-gpu]" \n pip3 install -U "TensorFlowASR[tf2.x]" \n
error occurs: File "tflite.py", line 65, in <module> tflite_model = converter.convert() File "/usr/local/lib/python3.7/dist-packages/tensorflow/lite/python/lite.py", line 1682, in convert return super(TFLiteConverterV2, self).convert() File "/usr/local/lib/python3.7/dist-packages/tensorflow/lite/python/lite.py", line 782, in wrapper return self._convert_and_export_metrics(convert_func, *args, **kwargs) File "/usr/local/lib/python3.7/dist-packages/tensorflow/lite/python/lite.py", line 768, in _convert_and_export_metrics result = convert_func(self, *args, **kwargs) File "/usr/local/lib/python3.7/dist-packages/tensorflow/lite/python/lite.py", line 1352, in convert self).convert(graph_def, input_tensors, output_tensors) File "/usr/local/lib/python3.7/dist-packages/tensorflow/lite/python/lite.py", line 956, in convert **converter_kwargs) File "/usr/local/lib/python3.7/dist-packages/tensorflow/lite/python/convert_phase.py", line 213, in wrapper raise converter_error from None # Re-throws the exception. File "/usr/local/lib/python3.7/dist-packages/tensorflow/lite/python/convert_phase.py", line 206, in wrapper return func(*args, **kwargs) File "/usr/local/lib/python3.7/dist-packages/tensorflow/lite/python/convert.py", line 828, in toco_convert_impl enable_mlir_converter=enable_mlir_converter) File "/usr/local/lib/python3.7/dist-packages/tensorflow/lite/python/convert.py", line 311, in toco_convert_protos
raise converter_error tensorflow.lite.python.convert_phase.ConverterError: input resource[0] expected type resource != float, the type of contextnet_greedy_while_contextnet_decoder_contextnet_prediction_embedding_embedding_lookup_24797_0[0] In {{node contextnet_greedy/while/contextnet_decoder/contextnet_prediction_embedding/embedding_lookup}} Failed to functionalize Control Flow V1 ops. Consider using Control Flow V2 ops instead. See https://www.tensorflow.org/api_docs/python/tf/compat/v1/enable_control_flow_v2.
then I execute tflite conversion codes that come to the ReadMe.md. but I do not succeed until now. How can I convert transducer or contextnet h5 models to tflite, directly?
The text was updated successfully, but these errors were encountered:
MhmudAlpurd
changed the title
How to convert transducer.h5 or contextnet.h5 to tflite, directly?
ConverterError: input resource[0] expected type resource != float, the type of contextnet_greedy_while_contextnet_decoder_contextnet_prediction_embedding_embedding_lookup_24797_0[0]
Nov 15, 2021
MhmudAlpurd
changed the title
ConverterError: input resource[0] expected type resource != float, the type of contextnet_greedy_while_contextnet_decoder_contextnet_prediction_embedding_embedding_lookup_24797_0[0]
ConverterError:input resource[0] expected type resource !=float, the type of contextnet_greedy_while_contextnet_decoder_contextnet_prediction_embedding_embedding_lookup_24797_0[0]
Nov 15, 2021
This bug has been resolved tensorflow/tensorflow#42410 (comment). Basically, we just need to load model while are are loading the concrete function, i.e., change this line to converter = tf.lite.TFLiteConverter.from_concrete_functions([concrete_func], model).
Hi everyone, I'm going to convert h5 to tflite of contexnet model, by executing tflite.py in the examples/contextnet/ direction, and I get several errors. I run these commands in order,
git clone https://github.com/TensorSpeech/TensorFlowASR.git \n cd TensorFlowASR \n pip3 install -e ".[tf2.x]" # or ".[tf2.x-gpu]" \n pip3 install -U "TensorFlowASR[tf2.x]" \n
error occurs:
File "tflite.py", line 65, in <module> tflite_model = converter.convert() File "/usr/local/lib/python3.7/dist-packages/tensorflow/lite/python/lite.py", line 1682, in convert return super(TFLiteConverterV2, self).convert() File "/usr/local/lib/python3.7/dist-packages/tensorflow/lite/python/lite.py", line 782, in wrapper return self._convert_and_export_metrics(convert_func, *args, **kwargs) File "/usr/local/lib/python3.7/dist-packages/tensorflow/lite/python/lite.py", line 768, in _convert_and_export_metrics result = convert_func(self, *args, **kwargs) File "/usr/local/lib/python3.7/dist-packages/tensorflow/lite/python/lite.py", line 1352, in convert self).convert(graph_def, input_tensors, output_tensors) File "/usr/local/lib/python3.7/dist-packages/tensorflow/lite/python/lite.py", line 956, in convert **converter_kwargs) File "/usr/local/lib/python3.7/dist-packages/tensorflow/lite/python/convert_phase.py", line 213, in wrapper raise converter_error from None # Re-throws the exception. File "/usr/local/lib/python3.7/dist-packages/tensorflow/lite/python/convert_phase.py", line 206, in wrapper return func(*args, **kwargs) File "/usr/local/lib/python3.7/dist-packages/tensorflow/lite/python/convert.py", line 828, in toco_convert_impl enable_mlir_converter=enable_mlir_converter) File "/usr/local/lib/python3.7/dist-packages/tensorflow/lite/python/convert.py", line 311, in toco_convert_protos
raise converter_error tensorflow.lite.python.convert_phase.ConverterError: input resource[0] expected type resource != float, the type of contextnet_greedy_while_contextnet_decoder_contextnet_prediction_embedding_embedding_lookup_24797_0[0] In {{node contextnet_greedy/while/contextnet_decoder/contextnet_prediction_embedding/embedding_lookup}} Failed to functionalize Control Flow V1 ops. Consider using Control Flow V2 ops instead. See https://www.tensorflow.org/api_docs/python/tf/compat/v1/enable_control_flow_v2.
then I execute tflite conversion codes that come to the ReadMe.md. but I do not succeed until now. How can I convert transducer or contextnet h5 models to tflite, directly?
The text was updated successfully, but these errors were encountered: