scenic icon indicating copy to clipboard operation
scenic copied to clipboard

Is there a way to Convert Owl-ViT to ONNX to be later converted to TensorRT?

Open Karimashraf01 opened this issue 2 years ago • 1 comments

Thanks for your amazing work. Are you planning on releasing a way to convert Owl-ViT to ONNX?

Karimashraf01 avatar Aug 17 '22 13:08 Karimashraf01

We have a colab that shows how to convert the JAX model to a TensorFlow tf.SavedModel. I believe you can then convert the tf.SavedModel to TensorRT with something like this (I haven't tested this):

params = tf.experimental.tensorrt.ConversionParams(precision_mode='FP32')
converter = tf.experimental.tensorrt.Converter(input_saved_model_dir=model_dir, conversion_params=params)
converter.convert()

Please let us know if that works!

mjlm avatar Aug 17 '22 14:08 mjlm

Hi @mjlm, I've tried and this is the output.

################################################################################
TensorRT unsupported/non-converted OP Report:
        - Identity -> 5x
        - NoOp -> 2x
        - Placeholder -> 2x
        - StatefulPartitionedCall -> 1x
--------------------------------------------------------------------------------
        - Total nonconverted OPs: 10
        - Total nonconverted OP Types: 4
For more information see https://docs.nvidia.com/deeplearning/frameworks/tf-trt-user-guide/index.html#supported-ops.
################################################################################

2023-03-28 17:19:16.894536: W tensorflow/compiler/tf2tensorrt/segment/segment.cc:1298] The environment variable TF_TRT_MAX_ALLOWED_ENGINES=20 has no effect since there are only 0 TRT Engines with  at least minimum_segment_size=3 nodes.
2023-03-28 17:19:16.894625: I tensorflow/compiler/tf2tensorrt/convert/convert_graph.cc:799] Number of TensorRT candidate segments: 0
Segmentation fault

I'm not gonna try to fix it as finding and replacing the unsupported ops might take quite a while. Just wanted to let you know. Amazing work by the way.

andrearosasco avatar Mar 28 '23 18:03 andrearosasco