diff --git a/vllm/entrypoints/llm.py b/vllm/entrypoints/llm.py index 830f54c6a8afa..fadf297e9f6aa 100644 --- a/vllm/entrypoints/llm.py +++ b/vllm/entrypoints/llm.py @@ -233,7 +233,8 @@ def __init__( self.request_counter = Counter() def __del__(self): - if self.llm_engine and hasattr(self.llm_engine, "shutdown"): + if hasattr(self, 'llm_engine') and self.llm_engine and hasattr( + self.llm_engine, "shutdown"): self.llm_engine.shutdown() @staticmethod