diff --git a/tests/ut/compilation/test_acl_graph.py b/tests/ut/compilation/test_acl_graph.py index afee5ef5..7440fc41 100644 --- a/tests/ut/compilation/test_acl_graph.py +++ b/tests/ut/compilation/test_acl_graph.py @@ -723,7 +723,7 @@ class TestACLGraphWrapper(TestBase): with self.assertRaises(AttributeError) as context: _ = wrapper.non_existent_attr - self.assertIn("Attribute non_existent_attr not exists", + self.assertIn("Attribute non_existent_attr not found", str(context.exception)) def test_unwrap_method(self): diff --git a/vllm_ascend/compilation/acl_graph.py b/vllm_ascend/compilation/acl_graph.py index e22d1b5a..1ceb3434 100644 --- a/vllm_ascend/compilation/acl_graph.py +++ b/vllm_ascend/compilation/acl_graph.py @@ -74,6 +74,7 @@ class ACLGraphWrapper: self.first_run_finished = False self.is_debugging_mode = envs.VLLM_LOGGING_LEVEL == "DEBUG" + self._runnable_str = str(runnable) if self.is_debugging_mode else None # assert runtime_mode is not NONE(no aclgraph), otherwise, we don't # need to initialize a ACLGraphWrapper. @@ -91,7 +92,11 @@ class ACLGraphWrapper: # allow accessing the attributes of the runnable. if hasattr(self.runnable, key): return getattr(self.runnable, key) - raise AttributeError(f"Attribute {key} not exists in the runnable of aclgraph wrapper: {self.runnable}") + if self.is_debugging_mode: + raise AttributeError( + f"Attribute {key} not exists in the runnable of aclgraph wrapper: {self._runnable_str}" + ) + raise AttributeError(f"Attribute {key} not found. Set VLLM_LOGGING_LEVEL=DEBUG for more details.") def unwrap(self) -> Callable: # in case we need to access the original runnable.