Hi,
Recently I am trying to convert the tensor2tensor machine translation model to android. There showed an error when trying to use tflite-convert tool.
Here is the error code:
Traceback (most recent call last):
File "/usr/local/bin/tflite_convert", line 11, in <module>
sys.exit(main())
File "/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/lite/python/tflite_convert.py", line 320, in main
app.run(main=run_main, argv=sys.argv[:1])
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/platform/app.py", line 125, in run
_sys.exit(main(argv))
File "/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/lite/python/tflite_convert.py", line 316, in run_main
_convert_model(tflite_flags)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/lite/python/tflite_convert.py", line 121, in _convert_model
output_data = converter.convert()
File "/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/lite/python/lite.py", line 309, in convert
allow_custom_ops=self.allow_custom_ops)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/lite/python/convert.py", line 206, in toco_convert
input_tensor.dtype))
ValueError: Tensors serialized_example:0 not known type tf.string
I am using tensorflow 1.9.0rc2, firstly I have convert the original model to saved model with t2t-exporter tool, then the error came out when trying to convert the saved model to tflite model.
Can someone help me fix this problem? Thanks.
update
OS: Ubuntu 16.04
TensorFlow Install from pip
TensorFlow version 1.9.0rc2
Bazel version:0.15.0
CUDA 9.0 cuDNN 7.0
GPU: Nvidia GTX Titan V 12GB
I firstly used the following command to export the model
t2t-exporter \ --model=transformer \ --hparams_set=transformer_base_single_gpu \ --problem=translate_enzh_wmt32k \ --data_dir=../\ --output_dir=./
then I got the exported model with a new folder "export"
after that I used the command
tflite_convert --output_file=example.tflite --saved_model_dir=export/Servo/1531989270/
Now I got the error I have described before.
Hi,
Recently I am trying to convert the tensor2tensor machine translation model to android. There showed an error when trying to use tflite-convert tool.
Here is the error code:
I am using tensorflow 1.9.0rc2, firstly I have convert the original model to saved model with t2t-exporter tool, then the error came out when trying to convert the saved model to tflite model.
Can someone help me fix this problem? Thanks.
update
OS: Ubuntu 16.04
TensorFlow Install from pip
TensorFlow version 1.9.0rc2
Bazel version:0.15.0
CUDA 9.0 cuDNN 7.0
GPU: Nvidia GTX Titan V 12GB
I firstly used the following command to export the model
t2t-exporter \ --model=transformer \ --hparams_set=transformer_base_single_gpu \ --problem=translate_enzh_wmt32k \ --data_dir=../\ --output_dir=./
then I got the exported model with a new folder "export"
after that I used the command
tflite_convert --output_file=example.tflite --saved_model_dir=export/Servo/1531989270/
Now I got the error I have described before.