@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / b77c7d327f
Fork 0

A high-throughput and memory-efficient inference and serving engine for LLMs

Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git

Synced Nov 15, 01:00 UTC

[BugFix] Fix ray import error mem cleanup bug (#21381)

Signed-off-by: Travis Johnson <tsjohnso@us.ibm.com> Signed-off-by: Joe Runde <Joseph.Runde@ibm.com> Co-authored-by: Travis Johnson <tsjohnso@us.ibm.com>

Joe Runde committed Jul 22, 2025 at 17:19 UTC b77c7d327f2a463bb9ef8be36f30e920bc066502
2 files changed +8 -5
vllm/config.py
+3 -2
@@ -2137,10 +2137,11 @@ class ParallelConfig:
2137 elif (current_platform.is_cuda()
2138 and cuda_device_count_stateless() < self.world_size):
2139 if not ray_found:
2140 - raise ValueError("Unable to load Ray which is "
2140 + raise ValueError("Unable to load Ray: "
2141 + f"{ray_utils.ray_import_err}. Ray is "
2142 "required for multi-node inference, "
2143 "please install Ray with `pip install "
2143 - "ray`.") from ray_utils.ray_import_err
2144 + "ray`.")
2145 backend = "ray"
2146 elif self.data_parallel_backend == "ray":
2147 logger.info("Using ray distributed inference because "
vllm/executor/ray_utils.py
+5 -3
@@ -145,7 +145,9 @@ try:
145
146 except ImportError as e:
147 ray = None # type: ignore
148 - ray_import_err = e
148 + # only capture string to avoid variable references in the traceback that can
149 + # prevent garbage collection in some cases
150 + ray_import_err = str(e)
151 RayWorkerWrapper = None # type: ignore
152
153
@@ -157,8 +159,8 @@ def ray_is_available() -> bool:
159 def assert_ray_available():
160 """Raise an exception if Ray is not available."""
161 if ray is None:
160 - raise ValueError("Failed to import Ray, please install Ray with "
161 - "`pip install ray`.") from ray_import_err
162 + raise ValueError(f"Failed to import Ray: {ray_import_err}."
163 + "Please install Ray with `pip install ray`.")
164
165
166 def _verify_bundles(placement_group: "PlacementGroup",