From 741204daf897cfbccef8f93c21fe06b5833c597a Mon Sep 17 00:00:00 2001 From: comaniac Date: Fri, 9 Feb 2024 01:22:24 +0000 Subject: [PATCH] Fix BaseCache metric --- python/sglang/srt/constrained/base_cache.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/sglang/srt/constrained/base_cache.py b/python/sglang/srt/constrained/base_cache.py index fb04311d2635..19139d97a666 100644 --- a/python/sglang/srt/constrained/base_cache.py +++ b/python/sglang/srt/constrained/base_cache.py @@ -24,7 +24,6 @@ def _init_with_timer(key): self.metrics["avg_init_time"] = (init_time / new_total) + ( curr_total / new_total ) * self.metrics["avg_init_time"] - self.metrics["total"] += 1 return val if key in self.cache: @@ -35,6 +34,7 @@ def _init_with_timer(key): val = _init_with_timer(key) if self.enable: + self.metrics["total"] += 1 self.cache[key] = val return val