From b6a4c939bc897e9c1b59702fd6cc08071e227133 Mon Sep 17 00:00:00 2001 From: Mengqing Cao Date: Tue, 21 Jan 2025 22:42:41 +0800 Subject: [PATCH] [Platform] improve platforms getattr (#12264) Signed-off-by: Mengqing Cao --- vllm/platforms/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/vllm/platforms/__init__.py b/vllm/platforms/__init__.py index 6033a806d2023..d20d35199bf5c 100644 --- a/vllm/platforms/__init__.py +++ b/vllm/platforms/__init__.py @@ -217,8 +217,11 @@ def __getattr__(name: str): global _init_trace _init_trace = "".join(traceback.format_stack()) return _current_platform - else: + elif name in globals(): return globals()[name] + else: + raise AttributeError( + f"No attribute named '{name}' exists in {__name__}.") __all__ = [