Skip to content

Commit

Permalink
fix loading trt engine
Browse files Browse the repository at this point in the history
  • Loading branch information
hnyu committed Oct 9, 2024
1 parent 3487f59 commit 809c6af
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions alf/utils/tensorrt_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,10 @@ def _load_or_build_engine(self, onnx_file: Optional[str],
memory_limit_gb: float):
if (not force_build_engine and engine_file is not None
and os.path.isfile(engine_file)):
# According to https://github.com/onnx/onnx-tensorrt/issues/597,
# this line solves the issue of "getPluginCreator could not find plugin InstanceNormalization_TRT version 1"
# when loading a saved TRT engine.
trt.init_libnvinfer_plugins(None, "")
runtime = trt.Runtime(trt.Logger(trt.Logger.WARNING))
with open(engine_file, "rb") as f:
engine_data = f.read()
Expand Down

0 comments on commit 809c6af

Please sign in to comment.