Skip to content

Commit 32c9d7f

Browse files
authored
Report usage for beam search (#6404)
1 parent ccb20db commit 32c9d7f

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

vllm/sampling_params.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,13 +189,18 @@ def __init__(
189189

190190
self._verify_args()
191191
if self.use_beam_search:
192+
# Lazy import to avoid circular imports.
193+
from vllm.usage.usage_lib import set_runtime_usage_data
194+
set_runtime_usage_data("use_beam_search", True)
195+
192196
if not envs.VLLM_NO_DEPRECATION_WARNING:
193197
logger.warning(
194198
"[IMPORTANT] We plan to discontinue the support for beam "
195199
"search in the next major release. Please refer to "
196200
"https://github.com/vllm-project/vllm/issues/6226 for "
197201
"more information. Set VLLM_NO_DEPRECATION_WARNING=1 to "
198202
"suppress this warning.")
203+
199204
self._verify_beam_search()
200205
else:
201206
self._verify_non_beam_search()

vllm/usage/usage_lib.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from enum import Enum
88
from pathlib import Path
99
from threading import Thread
10-
from typing import Any, Dict, Optional
10+
from typing import Any, Dict, Optional, Union
1111
from uuid import uuid4
1212

1313
import cpuinfo
@@ -25,6 +25,13 @@
2525
_USAGE_STATS_ENABLED = None
2626
_USAGE_STATS_SERVER = envs.VLLM_USAGE_STATS_SERVER
2727

28+
_GLOBAL_RUNTIME_DATA: Dict[str, Union[str, int, bool]] = {}
29+
30+
31+
def set_runtime_usage_data(key: str, value: Union[str, int, bool]) -> None:
32+
"""Set global usage data that will be sent with every usage heartbeat."""
33+
_GLOBAL_RUNTIME_DATA[key] = value
34+
2835

2936
def is_usage_stats_enabled():
3037
"""Determine whether or not we can send usage stats to the server.
@@ -187,7 +194,11 @@ def _report_continous_usage(self):
187194
"""
188195
while True:
189196
time.sleep(600)
190-
data = {"uuid": self.uuid, "log_time": _get_current_timestamp_ns()}
197+
data = {
198+
"uuid": self.uuid,
199+
"log_time": _get_current_timestamp_ns(),
200+
}
201+
data.update(_GLOBAL_RUNTIME_DATA)
191202

192203
self._write_to_file(data)
193204
self._send_to_server(data)

0 commit comments

Comments
 (0)