Add API docs link if the CLI arg is a config class (#37432)
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
This commit is contained in:
@@ -108,6 +108,7 @@ from vllm.utils.network_utils import get_ip
|
||||
from vllm.utils.torch_utils import resolve_kv_cache_dtype_string
|
||||
from vllm.v1.attention.backends.registry import AttentionBackendEnum
|
||||
from vllm.v1.sample.logits_processor import LogitsProcessor
|
||||
from vllm.version import __version__ as VLLM_VERSION
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from vllm.model_executor.layers.quantization import QuantizationMethods
|
||||
@@ -243,6 +244,14 @@ NEEDS_HELP = (
|
||||
)
|
||||
|
||||
|
||||
def _maybe_add_docs_url(cls: Any) -> str:
|
||||
"""Generate API docs URL for a vllm config class."""
|
||||
if not cls.__module__.startswith("vllm.config"):
|
||||
return ""
|
||||
version = f"v{VLLM_VERSION}" if "dev" not in VLLM_VERSION else "latest"
|
||||
return f"\n\nAPI docs: https://docs.vllm.ai/en/{version}/api/vllm/config/#vllm.config.{cls.__name__}"
|
||||
|
||||
|
||||
@functools.lru_cache(maxsize=30)
|
||||
def _compute_kwargs(cls: ConfigType) -> dict[str, dict[str, Any]]:
|
||||
# Save time only getting attr docs if we're generating help text
|
||||
@@ -293,6 +302,7 @@ def _compute_kwargs(cls: ConfigType) -> dict[str, dict[str, Any]]:
|
||||
raise argparse.ArgumentTypeError(repr(e)) from e
|
||||
|
||||
kwargs[name]["type"] = parse_dataclass
|
||||
kwargs[name]["help"] += _maybe_add_docs_url(dataclass_cls)
|
||||
kwargs[name]["help"] += f"\n\n{json_tip}"
|
||||
elif contains_type(type_hints, bool):
|
||||
# Creates --no-<name> and --<name> flags
|
||||
|
||||
Reference in New Issue
Block a user