google / automl

Google Brain AutoML
Apache License 2.0
6.24k stars 1.45k forks source link

TensorRT Non-Unique Argument Names for Saved Model #372

Closed RoboEvangelist closed 4 years ago

RoboEvangelist commented 4 years ago

I habe Ubuntu 18, tensorRT 7, tensorflow 2.1.0

Here is the error I get: ValueError: Got non-flat/non-unique argument names for SavedModel signature 'serving_base64': more than one argument to '__inference_signature_wrapper_144191' was named 'image_files:0'. Signatures have one Tensor per named input, so to have predictable names Python functions used to generate these signatures should avoid *args and Tensors in nested structures unless unique names are specified for each. Use tf.TensorSpec(..., name=...) to provide a name for a Tensor input.

Here is the conversion code I use:

import tensorflow as tf from tensorflow.python.compiler.tensorrt import trt_convert as trt params = trt.DEFAULT_TRT_CONVERSION_PARAMS._replace( precision_mode='FP16') converter = tf.experimental.tensorrt.Converter( input_saved_model_dir="/tmp/saved_model", conversion_params=params) converter.convert() converter.save("/tmp/saved_model/saved")

How exactly can we convert using tensorrt?

Thanks,

RoboEvangelist commented 4 years ago

I wonder if trimming the network and eliminating layers preceding "image_arrays" can help with this?

tcxia commented 4 years ago

@RoboEvangelist have you solved this problem?

RoboEvangelist commented 4 years ago

@tcxia no, I have not. I still don't know how to fix that problem I try to optimize the graph with tensorrt

mingxingtan commented 4 years ago

Hi @RoboEvangelist @tcxia , I removed the other signature. You may want to try it again?

mingxingtan commented 4 years ago

I am going to close this issue since signature is unique now. But feel free to open another issue if TensorRT has other issues. Thanks!

RoboEvangelist commented 4 years ago

I am going to close this issue since signature is unique now. But feel free to open another issue if TensorRT has other issues. Thanks!

Awesome! Thank you very much for this amazing work that you guys are doing!

RoboEvangelist commented 4 years ago

Yes, the fix worked. Thanks.