From c3c86e9daa3e5e4e0a928b860d90e8ccd33197f2 Mon Sep 17 00:00:00 2001 From: Mengqing Cao Date: Tue, 21 Jan 2025 20:41:09 +0800 Subject: [PATCH] [Platform] improve platforms getattr 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..365af5826f661 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().keys(): return globals()[name] + else: + raise AttributeError( + f"No attribute named '{name}' exists in {__name__}.") __all__ = [