Skip to content

Commit fef83f3

Browse files
committed
gate tensorrt plugin
1 parent bf54056 commit fef83f3

File tree

3 files changed

+309
-274
lines changed

3 files changed

+309
-274
lines changed

py/torch_tensorrt/_features.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"dynamo_frontend",
1616
"fx_frontend",
1717
"refit",
18+
"tensorrt_plugin",
1819
],
1920
)
2021

@@ -39,14 +40,27 @@
3940
_FX_FE_AVAIL = True
4041
_REFIT_AVAIL = True
4142

43+
try:
44+
import tensorrt.plugin as trtp
45+
46+
assert trtp
47+
_TENSORRT_PLUGIN_AVAIL = True
48+
except ImportError:
49+
_TENSORRT_PLUGIN_AVAIL = False
50+
4251
ENABLED_FEATURES = FeatureSet(
43-
_TS_FE_AVAIL, _TORCHTRT_RT_AVAIL, _DYNAMO_FE_AVAIL, _FX_FE_AVAIL, _REFIT_AVAIL
52+
_TS_FE_AVAIL,
53+
_TORCHTRT_RT_AVAIL,
54+
_DYNAMO_FE_AVAIL,
55+
_FX_FE_AVAIL,
56+
_REFIT_AVAIL,
57+
_TENSORRT_PLUGIN_AVAIL,
4458
)
4559

4660

4761
def _enabled_features_str() -> str:
4862
enabled = lambda x: "ENABLED" if x else "DISABLED"
49-
out_str: str = f"Enabled Features:\n - Dynamo Frontend: {enabled(_DYNAMO_FE_AVAIL)}\n - Torch-TensorRT Runtime: {enabled(_TORCHTRT_RT_AVAIL)}\n - FX Frontend: {enabled(_FX_FE_AVAIL)}\n - TorchScript Frontend: {enabled(_TS_FE_AVAIL)}\n" # type: ignore[no-untyped-call]
63+
out_str: str = f"Enabled Features:\n - Dynamo Frontend: {enabled(_DYNAMO_FE_AVAIL)}\n - Torch-TensorRT Runtime: {enabled(_TORCHTRT_RT_AVAIL)}\n - FX Frontend: {enabled(_FX_FE_AVAIL)}\n - TorchScript Frontend: {enabled(_TS_FE_AVAIL)}\n - TensorRT Plugin: {enabled(_TENSORRT_PLUGIN_AVAIL)}\n" # type: ignore[no-untyped-call]
5064
return out_str
5165

5266

0 commit comments

Comments
 (0)