提交vllm0.11.0开发分支
This commit is contained in:
@@ -4,28 +4,26 @@ import os
|
||||
from typing import TYPE_CHECKING, Any, Callable, Optional
|
||||
|
||||
if TYPE_CHECKING:
|
||||
VLLM_MULTI_LOGPATH: str = ("./log",)
|
||||
ENABLE_VLLM_MULTI_LOG: bool = (False,)
|
||||
ENABLE_VLLM_INFER_HOOK: bool = (False,)
|
||||
ENABLE_VLLM_OPS_HOOK: bool = (False,)
|
||||
ENABLE_VLLM_MODULE_HOOK: bool = False
|
||||
|
||||
VLLM_MULTI_LOGPATH : str = "./log",
|
||||
ENABLE_VLLM_MULTI_LOG : bool = False,
|
||||
ENABLE_VLLM_INFER_HOOK : bool = False,
|
||||
ENABLE_VLLM_OPS_HOOK : bool = False,
|
||||
ENABLE_VLLM_MODULE_HOOK : bool = False
|
||||
|
||||
def maybe_convert_int(value: Optional[str]) -> Optional[int]:
|
||||
"""
|
||||
If the value is None, return None; otherwise, convert the string to an integer and return it.
|
||||
|
||||
如果值是None,则返回None;否则将字符串转换为整数并返回。
|
||||
|
||||
Args:
|
||||
value (Optional[str], optional): The optional string to convert. Defaults to None.
|
||||
|
||||
value (Optional[str], optional): 要转换的可选字符串. Defaults to None.
|
||||
|
||||
Returns:
|
||||
Optional[int]: If the value is None, return None; otherwise, convert the string to an integer and return it.
|
||||
Optional[int]: 如果值是None,则返回None;否则将字符串转换为整数并返回.
|
||||
"""
|
||||
if value is None:
|
||||
return None
|
||||
return int(value)
|
||||
|
||||
|
||||
# The begin-* and end* here are used by the documentation generator
|
||||
# to extract the used env vars.
|
||||
|
||||
@@ -33,56 +31,59 @@ def maybe_convert_int(value: Optional[str]) -> Optional[int]:
|
||||
|
||||
xvllm_environment_variables: dict[str, Callable[[], Any]] = {
|
||||
# path to the logs of redirect-output, abstrac of related are ok
|
||||
"VLLM_MULTI_LOGPATH": lambda: os.environ.get("VLLM_MULTI_LOGPATH", "./logs"),
|
||||
# turn on / off multi-log of multi nodes & multi cards
|
||||
"ENABLE_VLLM_MULTI_LOG": lambda: (
|
||||
os.environ.get("ENABLE_VLLM_MULTI_LOG", "False").lower() in ("true", "1")
|
||||
),
|
||||
# turn on / off XVLLM infer stage log ability
|
||||
"ENABLE_VLLM_INFER_HOOK": lambda: (
|
||||
os.environ.get("ENABLE_VLLM_INFER_HOOK", "False").lower() in ("true", "1")
|
||||
),
|
||||
# turn on / off XVLLM infer_ops log ability
|
||||
"ENABLE_VLLM_OPS_HOOK": lambda: (
|
||||
os.environ.get("ENABLE_VLLM_OPS_HOOK", "False").lower() in ("true", "1")
|
||||
),
|
||||
"ENABLE_VLLM_MODULE_HOOK": lambda: (
|
||||
os.environ.get("ENABLE_VLLM_MODULE_HOOK", "False").lower() in ("true", "1")
|
||||
),
|
||||
"VLLM_MULTI_LOGPATH":
|
||||
lambda: os.environ.get("VLLM_MULTI_LOGPATH", "./logs"),
|
||||
|
||||
# turn on / off multi-log of multi nodes & multi cards
|
||||
"ENABLE_VLLM_MULTI_LOG":
|
||||
lambda: (os.environ.get("ENABLE_VLLM_MULTI_LOG", "False").lower() in
|
||||
("true", "1")),
|
||||
|
||||
# turn on / off XVLLM infer stage log ability
|
||||
"ENABLE_VLLM_INFER_HOOK":
|
||||
lambda: (os.environ.get("ENABLE_VLLM_INFER_HOOK", "False").lower() in
|
||||
("true", "1")),
|
||||
|
||||
# turn on / off XVLLM infer_ops log ability
|
||||
"ENABLE_VLLM_OPS_HOOK":
|
||||
lambda: (os.environ.get("ENABLE_VLLM_OPS_HOOK", "False").lower() in
|
||||
("true", "1")),
|
||||
|
||||
"ENABLE_VLLM_MODULE_HOOK":
|
||||
lambda: (os.environ.get("ENABLE_VLLM_MODULE_HOOK", "False").lower() in
|
||||
("true", "1")),
|
||||
|
||||
# fuse sorted op with fused_moe kernel
|
||||
"ENABLE_VLLM_MOE_FC_SORTED": lambda: (
|
||||
os.environ.get("ENABLE_VLLM_MOE_FC_SORTED", "False").lower() in ("true", "1")
|
||||
),
|
||||
"ENABLE_VLLM_MOE_FC_SORTED":
|
||||
lambda: (os.environ.get("ENABLE_VLLM_MOE_FC_SORTED", "False").lower() in
|
||||
("true", "1")),
|
||||
|
||||
# enable custom dpsk scaling rope
|
||||
"ENABLE_CUSTOM_DPSK_SCALING_ROPE": lambda: (
|
||||
os.environ.get("ENABLE_CUSTOM_DPSK_SCALING_ROPE", "False").lower()
|
||||
in ("true", "1")
|
||||
),
|
||||
"ENABLE_CUSTOM_DPSK_SCALING_ROPE":
|
||||
lambda: (os.environ.get("ENABLE_CUSTOM_DPSK_SCALING_ROPE", "False").lower() in
|
||||
("true", "1")),
|
||||
|
||||
# fuse qkv split & qk norm & qk rope
|
||||
# only works for qwen3 dense and qwen3 moe models
|
||||
"ENABLE_VLLM_FUSED_QKV_SPLIT_NORM_ROPE": lambda: (
|
||||
os.environ.get("ENABLE_VLLM_FUSED_QKV_SPLIT_NORM_ROPE", "False").lower()
|
||||
in ("true", "1")
|
||||
),
|
||||
"ENABLE_VLLM_FUSED_QKV_SPLIT_NORM_ROPE":
|
||||
lambda: (os.environ.get("ENABLE_VLLM_FUSED_QKV_SPLIT_NORM_ROPE", "False").lower() in
|
||||
("true", "1")),
|
||||
}
|
||||
|
||||
# end-env-vars-definition
|
||||
|
||||
|
||||
def __getattr__(name: str):
|
||||
"""
|
||||
This function is called when an attribute that doesn't exist is accessed.
|
||||
If the attribute is one of the xvllm_environment_variables, return the corresponding value.
|
||||
Otherwise, raise an AttributeError.
|
||||
|
||||
当调用不存在的属性时,该函数被调用。如果属性是xvllm_environment_variables中的一个,则返回相应的值。否则引发AttributeError异常。
|
||||
|
||||
Args:
|
||||
name (str): The name of the attribute to retrieve.
|
||||
|
||||
name (str): 要获取的属性名称。
|
||||
|
||||
Raises:
|
||||
AttributeError (Exception): If the attribute is not one of xvllm_environment_variables, this exception is raised.
|
||||
|
||||
AttributeError (Exception): 如果属性不是xvllm_environment_variables中的一个,则会引发此异常。
|
||||
|
||||
Returns:
|
||||
Any, optional: If the attribute is one of xvllm_environment_variables, the corresponding value is returned; otherwise, None is returned.
|
||||
Any, optional: 如果属性是xvllm_environment_variables中的一个,则返回相应的值;否则返回None。
|
||||
"""
|
||||
# lazy evaluation of environment variables
|
||||
if name in xvllm_environment_variables:
|
||||
@@ -92,14 +93,13 @@ def __getattr__(name: str):
|
||||
|
||||
def __dir__():
|
||||
"""
|
||||
Returns a list of all visible variable names.
|
||||
|
||||
返回一个包含所有可见的变量名称的列表。
|
||||
|
||||
返回值(list):一个包含所有可见的变量名称的列表,这些变量是通过`xvllm_environment_variables`字典定义的。
|
||||
|
||||
Returns:
|
||||
list: A list of all visible variable names, which are defined through the `xvllm_environment_variables` dictionary.
|
||||
|
||||
Returns:
|
||||
List[str]: A list of all visible variable names.
|
||||
These variables are defined through the `xvllm_environment_variables` dictionary.
|
||||
List[str]: 一个包含所有可见的变量名称的列表。
|
||||
这些变量是通过`xvllm_environment_variables`字典定义的。
|
||||
"""
|
||||
return list(xvllm_environment_variables.keys())
|
||||
|
||||
|
||||
Reference in New Issue
Block a user