Skip to content

Commit

Permalink
[BugFix] Lazy import ray (vllm-project#10021)
Browse files Browse the repository at this point in the history
Signed-off-by: Maxime Fournioux <[email protected]>
  • Loading branch information
GeneDer authored and mfournioux committed Nov 20, 2024
1 parent c4372e7 commit 40f1665
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions vllm/engine/multiprocessing/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

import cloudpickle
import zmq
from ray.exceptions import RayTaskError

from vllm import AsyncEngineArgs, SamplingParams
# yapf conflicts with isort for this block
Expand Down Expand Up @@ -306,11 +305,17 @@ def _health_check(self):
def _send_outputs(self, outputs: REQUEST_OUTPUTS_T):
"""Send List of RequestOutput to RPCClient."""
if outputs:
# RayTaskError might not pickelable here. We need to unpack the
# underlying exception as the real exception in the output.
if (isinstance(outputs, RPCError)
and isinstance(outputs.exception, RayTaskError)):
outputs.exception = outputs.exception.cause
try:
from ray.exceptions import RayTaskError

# RayTaskError might not pickelable here. We need to unpack the
# underlying exception as the real exception in the output.
if (isinstance(outputs, RPCError)
and isinstance(outputs.exception, RayTaskError)):
outputs.exception = outputs.exception.cause
except ImportError:
pass

output_bytes = pickle.dumps(outputs)
self.output_socket.send_multipart((output_bytes, ), copy=False)

Expand Down

0 comments on commit 40f1665

Please sign in to comment.