Skip to content

Commit 1e54bbf

Browse files
committed
Further changes in error logging of the TRT-LLM installation tool
1 parent c075924 commit 1e54bbf

File tree

1 file changed

+19
-14
lines changed

1 file changed

+19
-14
lines changed

py/torch_tensorrt/dynamo/conversion/converter_utils.py

+19-14
Original file line numberDiff line numberDiff line change
@@ -1014,7 +1014,7 @@ def download_plugin_lib_path(py_version: str, platform: str) -> str:
10141014
# Downloading TRT-LLM lib
10151015
# TODO: check how to fix the 0.18.0 hardcode below
10161016
base_url = "https://pypi.nvidia.com/tensorrt-llm/"
1017-
file_name = f"tensorrt_llm-0.18.0.post1-{py_version}-{py_version}-{platform}.whl"
1017+
file_name = f"tensorrt_llm-0.18.0-{py_version}-{py_version}-{platform}.whl"
10181018
download_url = base_url + file_name
10191019
cmd = ["wget", download_url]
10201020
if not (os.path.exists(file_name)):
@@ -1051,19 +1051,14 @@ def download_plugin_lib_path(py_version: str, platform: str) -> str:
10511051
def load_tensorrt_llm() -> bool:
10521052
"""
10531053
Attempts to load the TensorRT-LLM plugin and initialize it.
1054-
Either the env variable TRTLLM_PLUGINS_PATH specifies the path
1055-
If the above is not, the user can specify USE_TRTLLM_PLUGINS as either of 1, true, yes, on to download the TRT-LLM distribution and load it
1054+
Either the env variable TRTLLM_PLUGINS_PATH can specify the path
1055+
Or the user can specify USE_TRTLLM_PLUGINS as either of (1, true, yes, on) to download the TRT-LLM distribution and load it
10561056
10571057
Returns:
10581058
bool: True if the plugin was successfully loaded and initialized, False otherwise.
10591059
"""
10601060
plugin_lib_path = os.environ.get("TRTLLM_PLUGINS_PATH")
10611061
if not plugin_lib_path:
1062-
_LOGGER.warning(
1063-
"Please set the TRTLLM_PLUGINS_PATH to the directory containing libnvinfer_plugin_tensorrt_llm.so to use converters for torch.distributed ops or else set the USE_TRTLLM_PLUGINS variable to download the shared library",
1064-
)
1065-
# for key, value in os.environ.items():
1066-
# print(f"{key}: {value}")
10671062
# this option can be used by user if TRTLLM_PLUGINS_PATH is not set by user
10681063
use_trtllm_plugin = os.environ.get("USE_TRTLLM_PLUGINS", "0").lower() in (
10691064
"1",
@@ -1073,7 +1068,7 @@ def load_tensorrt_llm() -> bool:
10731068
)
10741069
if not use_trtllm_plugin:
10751070
_LOGGER.warning(
1076-
"Neither TRTLLM_PLUGIN_PATH is set nor is it directed to download the shared library"
1071+
"Neither TRTLLM_PLUGIN_PATH is set nor is it directed to download the shared library. Please set either of the two to use TRT-LLM libraries in torchTRT"
10771072
)
10781073
return False
10791074
else:
@@ -1083,16 +1078,25 @@ def load_tensorrt_llm() -> bool:
10831078

10841079
platform = str(platform).lower()
10851080
plugin_lib_path = download_plugin_lib_path(py_version, platform)
1081+
10861082
try:
10871083
# Load the shared TRT-LLM file
10881084
handle = ctypes.CDLL(plugin_lib_path)
10891085
_LOGGER.info(f"Successfully loaded plugin library: {plugin_lib_path}")
10901086
except OSError as e_os_error:
1091-
_LOGGER.error(
1092-
f"Failed to load libnvinfer_plugin_tensorrt_llm.so from {plugin_lib_path}"
1093-
f"Ensure the path is correct and the library is compatible",
1094-
exc_info=e_os_error,
1095-
)
1087+
if "libmpi" in str(e_os_error):
1088+
_LOGGER.warning(
1089+
f"Failed to load libnvinfer_plugin_tensorrt_llm.so from {plugin_lib_path}. "
1090+
f"The dependency libmpi.so is missing. "
1091+
f"Please install the packages libmpich-dev and libopenmpi-dev.",
1092+
exc_info=e_os_error,
1093+
)
1094+
else:
1095+
_LOGGER.warning(
1096+
f"Failed to load libnvinfer_plugin_tensorrt_llm.so from {plugin_lib_path}"
1097+
f"Ensure the path is correct and the library is compatible",
1098+
exc_info=e_os_error,
1099+
)
10961100
return False
10971101

10981102
try:
@@ -1121,3 +1125,4 @@ def load_tensorrt_llm() -> bool:
11211125
exc_info=e_initialization_error,
11221126
)
11231127
return False
1128+
return False

0 commit comments

Comments
 (0)