@@ -434,6 +434,7 @@ def _initialize_kv_caches(self) -> None:
434
434
@classmethod
435
435
def _get_executor_cls (cls ,
436
436
engine_config : VllmConfig ) -> Type [ExecutorBase ]:
437
+ # distributed_executor_backend must be set in VllmConfig.__post_init__
437
438
distributed_executor_backend = (
438
439
engine_config .parallel_config .distributed_executor_backend )
439
440
# Initialize the cluster and specify the executor class.
@@ -443,30 +444,29 @@ def _get_executor_cls(cls,
443
444
"distributed_executor_backend must be a subclass of "
444
445
f"ExecutorBase. Got { distributed_executor_backend } ." )
445
446
executor_class = distributed_executor_backend
446
- elif engine_config .parallel_config .world_size > 1 :
447
- if distributed_executor_backend == "ray" :
448
- from vllm .executor .ray_distributed_executor import (
449
- RayDistributedExecutor )
450
- executor_class = RayDistributedExecutor
451
- elif distributed_executor_backend == "mp" :
452
- from vllm .executor .mp_distributed_executor import (
453
- MultiprocessingDistributedExecutor )
454
- assert not envs .VLLM_USE_RAY_SPMD_WORKER , (
455
- "multiprocessing distributed executor backend does not "
456
- "support VLLM_USE_RAY_SPMD_WORKER=1" )
457
- executor_class = MultiprocessingDistributedExecutor
458
- elif distributed_executor_backend == "uni" :
459
- # JAX-style, single-process, multi-device executor.
460
- from vllm .executor .uniproc_executor import UniProcExecutor
461
- executor_class = UniProcExecutor
462
- elif distributed_executor_backend == "external_launcher" :
463
- # executor with external launcher
464
- from vllm .executor .uniproc_executor import ( # noqa
465
- ExecutorWithExternalLauncher )
466
- executor_class = ExecutorWithExternalLauncher
467
- else :
447
+ elif distributed_executor_backend == "ray" :
448
+ from vllm .executor .ray_distributed_executor import (
449
+ RayDistributedExecutor )
450
+ executor_class = RayDistributedExecutor
451
+ elif distributed_executor_backend == "mp" :
452
+ from vllm .executor .mp_distributed_executor import (
453
+ MultiprocessingDistributedExecutor )
454
+ assert not envs .VLLM_USE_RAY_SPMD_WORKER , (
455
+ "multiprocessing distributed executor backend does not "
456
+ "support VLLM_USE_RAY_SPMD_WORKER=1" )
457
+ executor_class = MultiprocessingDistributedExecutor
458
+ elif distributed_executor_backend == "uni" :
459
+ # JAX-style, single-process, multi-device executor.
468
460
from vllm .executor .uniproc_executor import UniProcExecutor
469
461
executor_class = UniProcExecutor
462
+ elif distributed_executor_backend == "external_launcher" :
463
+ # executor with external launcher
464
+ from vllm .executor .uniproc_executor import ( # noqa
465
+ ExecutorWithExternalLauncher )
466
+ executor_class = ExecutorWithExternalLauncher
467
+ else :
468
+ raise ValueError ("unrecognized distributed_executor_backend: "
469
+ f"{ distributed_executor_backend } " )
470
470
return executor_class
471
471
472
472
@classmethod
0 commit comments