mirror of
https://git.datalinker.icu/vllm-project/vllm.git
synced 2025-12-14 00:16:00 +08:00
[Misc] Copy HF_TOKEN env var to Ray workers (#21406)
Signed-off-by: Rui Qiao <ruisearch42@gmail.com>
This commit is contained in:
parent
4594fc3b28
commit
35bc8bd5fb
@ -58,6 +58,9 @@ class RayDistributedExecutor(DistributedExecutorBase):
|
|||||||
"VLLM_HOST_IP", "VLLM_HOST_PORT", "LOCAL_RANK", "CUDA_VISIBLE_DEVICES"
|
"VLLM_HOST_IP", "VLLM_HOST_PORT", "LOCAL_RANK", "CUDA_VISIBLE_DEVICES"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# These non-vLLM env vars are copied from the driver to workers
|
||||||
|
ADDITIONAL_ENV_VARS = {"HF_TOKEN", "HUGGING_FACE_HUB_TOKEN"}
|
||||||
|
|
||||||
uses_ray: bool = True
|
uses_ray: bool = True
|
||||||
|
|
||||||
def _init_executor(self) -> None:
|
def _init_executor(self) -> None:
|
||||||
@ -326,7 +329,8 @@ class RayDistributedExecutor(DistributedExecutorBase):
|
|||||||
# Environment variables to copy from driver to workers
|
# Environment variables to copy from driver to workers
|
||||||
env_vars_to_copy = get_env_vars_to_copy(
|
env_vars_to_copy = get_env_vars_to_copy(
|
||||||
exclude_vars=self.WORKER_SPECIFIC_ENV_VARS,
|
exclude_vars=self.WORKER_SPECIFIC_ENV_VARS,
|
||||||
additional_vars=set(current_platform.additional_env_vars),
|
additional_vars=set(current_platform.additional_env_vars).union(
|
||||||
|
self.ADDITIONAL_ENV_VARS),
|
||||||
destination="workers")
|
destination="workers")
|
||||||
|
|
||||||
# Copy existing env vars to each worker's args
|
# Copy existing env vars to each worker's args
|
||||||
|
|||||||
@ -43,6 +43,8 @@ def get_env_vars_to_copy(exclude_vars: Optional[set[str]] = None,
|
|||||||
exclude_vars: A set of vllm defined environment variables to exclude
|
exclude_vars: A set of vllm defined environment variables to exclude
|
||||||
from copying.
|
from copying.
|
||||||
additional_vars: A set of additional environment variables to copy.
|
additional_vars: A set of additional environment variables to copy.
|
||||||
|
If a variable is in both exclude_vars and additional_vars, it will
|
||||||
|
be excluded.
|
||||||
destination: The destination of the environment variables.
|
destination: The destination of the environment variables.
|
||||||
Returns:
|
Returns:
|
||||||
A set of environment variables to copy.
|
A set of environment variables to copy.
|
||||||
@ -52,10 +54,9 @@ def get_env_vars_to_copy(exclude_vars: Optional[set[str]] = None,
|
|||||||
|
|
||||||
env_vars_to_copy = {
|
env_vars_to_copy = {
|
||||||
v
|
v
|
||||||
for v in envs.environment_variables
|
for v in set(envs.environment_variables).union(additional_vars)
|
||||||
if v not in exclude_vars and v not in RAY_NON_CARRY_OVER_ENV_VARS
|
if v not in exclude_vars and v not in RAY_NON_CARRY_OVER_ENV_VARS
|
||||||
}
|
}
|
||||||
env_vars_to_copy.update(additional_vars)
|
|
||||||
|
|
||||||
to_destination = " to " + destination if destination is not None else ""
|
to_destination = " to " + destination if destination is not None else ""
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user