tensorflow / hub

A library for transfer learning by reusing parts of TensorFlow models.
https://tensorflow.org/hub
Apache License 2.0
3.48k stars 1.66k forks source link

Feature request: Using hub.Module with TensorRT #108

Closed dchichkov closed 3 years ago

dchichkov commented 6 years ago

I'm trying it with TensorRT and hitting an issue: 'Graph' object has no attribute 'SerializeToString'. Is this expected? By the way, does it make sense to try to quantize/prune your MobilNet model with TensorRT?

graph = tf.Graph()
with graph.as_default():  
      mobilnet_op = hub.Module("https://tfhub.dev/google/imagenet/mobilenet_v2_100_128/feature_vector/2", trainable=True)
...
trt.create_inference_graph(input_graph_def = graph, outputs = "image_feature_vector",
    max_batch_size=1, max_workspace_size_bytes=50000000, precision_mode="FP16", minimum_segment_size=3)
vbardiovskyg commented 6 years ago

Hi, the graph object here is not a GraphDef. You can get it by calling graph.as_graph_def().

As for the second question, we haven't yet looked into using TensorFlow Hub graph defs with TensorRT, so we don't fully understand all the implications at this moment. We can keep this issue open to track any progress.

captain-pool commented 5 years ago

@vbardiovskyg, as discussed earlier, I'ld like to work on this as a part of GSoC (most probably this month or in the coming month). can you assign this to me?

akhorlin commented 3 years ago

Closing due to deprecated status of hub.Module()