tensorflow / tensorrt

TensorFlow/TensorRT integration
Apache License 2.0
737 stars 226 forks source link

"ValueError: Failed to import metagraph, check error log for more info." Error #325

Open liuxingbin opened 2 years ago

liuxingbin commented 2 years ago

When I convert savedmodel to tftrt, I get "ValueError: Failed to import metagraph, check error log for more info."

Environment:

tf:2.4.0

code:

from tensorflow.python.saved_model import tag_constants
import os
import sys
import tensorflow.compat.v1 as tf
tf.disable_eager_execution()
from tensorflow.python.compiler.tensorrt import trt_convert as trt

converter = trt.TrtGraphConverter(
            input_saved_model_dir=saved_dir,
            precision_mode=trt.TrtPrecisionMode.FP32)
converter.convert()
converter.save(conver32_dir)

Error:

2022-09-21 17:45:21.819949: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcudart.so.11.0
2022-09-21 17:45:21.819977: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcublas.so.11
2022-09-21 17:45:21.819989: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcublasLt.so.11
2022-09-21 17:45:21.820000: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcufft.so.10
2022-09-21 17:45:21.820012: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcurand.so.10
2022-09-21 17:45:21.820022: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcusolver.so.10
2022-09-21 17:45:21.820033: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcusparse.so.11
2022-09-21 17:45:21.820044: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcudnn.so.8
2022-09-21 17:45:21.821707: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1862] Adding visible gpu devices: 0
2022-09-21 17:45:21.821744: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1261] Device interconnect StreamExecutor with strength 1 edge matrix:
2022-09-21 17:45:21.821754: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1267]      0 
2022-09-21 17:45:21.821767: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1280] 0:   N 
2022-09-21 17:45:21.823520: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1406] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 28879 MB memory) -> physical GPU (device: 0, name: Tesla V100-PCIE-32GB, pci bus id: 0000:1f:00.0, compute capability: 7.0)
2022-09-21 17:45:21.897424: E tensorflow/core/grappler/grappler_item_builder.cc:429] Failed to detect the fetch node(s), skipping this input
Traceback (most recent call last):
  File "test.py", line 49, in <module>
    converter.convert()
  File "/usr/local/lib/python3.7/dist-packages/tensorflow/python/compiler/tensorrt/trt_convert.py", line 655, in convert
    self._convert_saved_model()
  File "/usr/local/lib/python3.7/dist-packages/tensorflow/python/compiler/tensorrt/trt_convert.py", line 643, in _convert_saved_model
    self._run_conversion()
  File "/usr/local/lib/python3.7/dist-packages/tensorflow/python/compiler/tensorrt/trt_convert.py", line 560, in _run_conversion
    graph_id=b"tf_graph")
  File "/usr/local/lib/python3.7/dist-packages/tensorflow/python/grappler/tf_optimizer.py", line 58, in OptimizeGraph
    graph_id, strip_default_attributes)
ValueError: Failed to import metagraph, check error log for more info.
ncomly-nvidia commented 2 years ago

@DEKHTIARJonathan

oasis-0927 commented 5 days ago

@liuxingbin Same issue here. Did you find any solution? Thanks.