Skip to content

Commit 5e0a5be

Browse files
committed
IP
1 parent 80dd037 commit 5e0a5be

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

src/model.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -359,10 +359,8 @@ def _setup_metrics(self):
359359
"version": self.args["model_version"],
360360
}
361361
# Add vLLM custom metrics
362-
engine_config = self._llm_engine.engine.model_config
363-
self._vllm_metrics = VllmStatLogger(
364-
labels, engine_config.max_model_len, self.logger
365-
)
362+
vllm_config = self._llm_engine.engine.vllm_config
363+
self._vllm_metrics = VllmStatLogger(labels, vllm_config, self.logger)
366364
self._llm_engine.add_logger("triton", self._vllm_metrics)
367365
except pb_utils.TritonModelException as e:
368366
if "metrics not supported" in str(e):

src/utils/metrics.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
from typing import Dict, List, Union
3030

3131
import triton_python_backend_utils as pb_utils
32+
from vllm.config import VllmConfig
3233
from vllm.engine.metrics import StatLoggerBase as VllmStatLoggerBase
3334
from vllm.engine.metrics import Stats as VllmStats
3435
from vllm.engine.metrics import SupportsMetricsInfo, build_1_2_5_buckets
@@ -163,11 +164,13 @@ def __init__(self, labels: List[str], max_model_len: int):
163164
class VllmStatLogger(VllmStatLoggerBase):
164165
"""StatLogger is used as an adapter between vLLM stats collector and Triton metrics provider."""
165166

166-
def __init__(self, labels: Dict, max_model_len: int, log_logger) -> None:
167+
def __init__(self, labels: Dict, vllm_config: VllmConfig, log_logger) -> None:
167168
# Tracked stats over current local logging interval.
168169
# local_interval not used here. It's for vLLM logs to stdout.
169-
super().__init__(local_interval=0)
170-
self.metrics = TritonMetrics(labels, max_model_len)
170+
super().__init__(local_interval=0, vllm_config=vllm_config)
171+
self.metrics = TritonMetrics(
172+
labels=labels, max_model_len=vllm_config.model_config.max_model_len
173+
)
171174
self.log_logger = log_logger
172175

173176
# Starting the metrics thread. It allows vLLM to keep making progress

0 commit comments

Comments
 (0)