vllm.executor.ray_utils
RayWorkerWrapper
¶
Bases: WorkerWrapperBase
Ray wrapper for vllm.worker.Worker, allowing Worker to be lazily initialized after Ray sets CUDA_VISIBLE_DEVICES.
Source code in vllm/executor/ray_utils.py
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 |
|
input_decoder
instance-attribute
¶
input_decoder = Decoder(
ExecuteModelRequest, dec_hook=decode_hook
)
__init__
¶
Source code in vllm/executor/ray_utils.py
execute_model_ray
¶
execute_model_ray(
scheduler_output: Union[
SchedulerOutput,
Tuple[SchedulerOutput, IntermediateTensors],
],
) -> Union[
ModelRunnerOutput,
Tuple[SchedulerOutput, IntermediateTensors],
]
Source code in vllm/executor/ray_utils.py
execute_model_spmd
¶
execute_model_spmd(
req_or_tuple: Union[
bytes, Tuple[bytes, Optional[IntermediateTensors]]
],
) -> bytes
Execute model in SPMD fashion: used only when SPMD worker and compiled DAG are both enabled.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
req_or_tuple
|
Union[bytes, Tuple[bytes, Optional[IntermediateTensors]]]
|
A request or a tuple containing the request and intermediate tensors. Intermediate tensors are None unless if it is provided because it is > 0 pipeline stage. The request is serialized by msgspec. |
required |
Source code in vllm/executor/ray_utils.py
get_node_and_gpu_ids
¶
Source code in vllm/executor/ray_utils.py
override_env_vars
¶
setup_device_if_necessary
¶
Source code in vllm/executor/ray_utils.py
_verify_bundles
¶
_verify_bundles(
placement_group: PlacementGroup,
parallel_config: ParallelConfig,
device_str: str,
)
Verify a given placement group has bundles located in the right place.
There are 2 rules. - Warn if all tensor parallel workers cannot fit in a single node. - Fail if driver node is not included in a placement group.
Source code in vllm/executor/ray_utils.py
_wait_until_pg_ready
¶
Wait until a placement group is ready.
It prints the informative log messages if the placement group is not created within time.
Source code in vllm/executor/ray_utils.py
_wait_until_pg_removed
¶
Source code in vllm/executor/ray_utils.py
assert_ray_available
¶
Raise an exception if Ray is not available.
get_num_nodes_in_placement_group
¶
get_num_nodes_in_placement_group() -> int
Source code in vllm/executor/ray_utils.py
get_num_tpu_nodes
¶
get_num_tpu_nodes() -> int
Source code in vllm/executor/ray_utils.py
initialize_ray_cluster
¶
initialize_ray_cluster(
parallel_config: ParallelConfig,
ray_address: Optional[str] = None,
)
Initialize the distributed cluster with Ray.
it will connect to the Ray cluster and create a placement group for the workers, which includes the specification of the resources for each distributed worker.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
parallel_config
|
ParallelConfig
|
The configurations for parallel execution. |
required |
ray_address
|
Optional[str]
|
The address of the Ray cluster. If None, uses the default Ray cluster address. |
None
|
Source code in vllm/executor/ray_utils.py
268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 |
|