[Startup] Parallelize torch/transformers import + weight prefetch + forkserver prewarm (#40331)

Signed-off-by: simon-mo <simon@inferact.ai>
This commit is contained in:
Simon Mo
2026-04-21 10:49:32 +08:00
committed by GitHub
parent 8097591286
commit 8256833fe6
3 changed files with 220 additions and 6 deletions
+7 -3
View File
@@ -62,7 +62,7 @@ if TYPE_CHECKING:
VLLM_USE_RAY_WRAPPED_PP_COMM: bool = True
VLLM_USE_RAY_V2_EXECUTOR_BACKEND: bool = False
VLLM_XLA_USE_SPMD: bool = False
VLLM_WORKER_MULTIPROC_METHOD: Literal["fork", "spawn"] = "fork"
VLLM_WORKER_MULTIPROC_METHOD: Literal["fork", "spawn", "forkserver"] = "fork"
VLLM_ASSETS_CACHE: str = os.path.join(VLLM_CACHE_ROOT, "assets")
VLLM_ASSETS_CACHE_MODEL_CLEAN: bool = False
VLLM_IMAGE_FETCH_TIMEOUT: int = 5
@@ -765,9 +765,13 @@ environment_variables: dict[str, Callable[[], Any]] = {
int(os.getenv("VLLM_USE_RAY_V2_EXECUTOR_BACKEND", "0"))
),
# Use dedicated multiprocess context for workers.
# Both spawn and fork work
# spawn, fork, and forkserver all work. forkserver is opt-in for fast
# startup when paired with the CLI's async prewarm (see
# vllm/entrypoints/cli/main.py) — the forkserver process is preloaded
# with vllm.v1.engine.async_llm and a subsequent EngineCore Process.start()
# forks from that warm sibling instead of paying spawn cost.
"VLLM_WORKER_MULTIPROC_METHOD": env_with_choices(
"VLLM_WORKER_MULTIPROC_METHOD", "fork", ["spawn", "fork"]
"VLLM_WORKER_MULTIPROC_METHOD", "fork", ["spawn", "fork", "forkserver"]
),
# Path to the cache for storing downloaded assets
"VLLM_ASSETS_CACHE": lambda: os.path.expanduser(