@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / 652c83b697
Fork 0

A high-throughput and memory-efficient inference and serving engine for LLMs

Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git

Synced Nov 16, 17:00 UTC

[Misc] Raise a more informative exception in add/remove_logger (#7750)

Antoni Baum committed Sep 3, 2024 at 12:28 UTC 652c83b697ac64923fac9b253a3e09a2b653eb46
1 file changed +8
vllm/engine/llm_engine.py
+8
@@ -1671,11 +1671,19 @@ class LLMEngine:
1671 return None
1672
1673 def add_logger(self, logger_name: str, logger: StatLoggerBase) -> None:
1674 + if not self.log_stats:
1675 + raise RuntimeError(
1676 + "Stat logging is disabled. Set `disable_log_stats=False` "
1677 + "argument to enable.")
1678 if logger_name in self.stat_loggers:
1679 raise KeyError(f"Logger with name {logger_name} already exists.")
1680 self.stat_loggers[logger_name] = logger
1681
1682 def remove_logger(self, logger_name: str) -> None:
1683 + if not self.log_stats:
1684 + raise RuntimeError(
1685 + "Stat logging is disabled. Set `disable_log_stats=False` "
1686 + "argument to enable.")
1687 if logger_name not in self.stat_loggers:
1688 raise KeyError(f"Logger with name {logger_name} does not exist.")
1689 del self.stat_loggers[logger_name]