Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenDAS
vllm_cscc
Commits
efa90846
Unverified
Commit
efa90846
authored
Nov 19, 2024
by
Russell Bryant
Committed by
GitHub
Nov 19, 2024
Browse files
[Core] Avoid metrics log noise when idle (#8868)
Signed-off-by:
Russell Bryant
<
rbryant@redhat.com
>
parent
803f37ea
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
7 deletions
+23
-7
vllm/engine/metrics.py
vllm/engine/metrics.py
+23
-7
No files found.
vllm/engine/metrics.py
View file @
efa90846
...
...
@@ -421,6 +421,11 @@ def get_throughput(tracked_stats: List[int], now: float,
class
LoggingStatLogger
(
StatLoggerBase
):
"""LoggingStatLogger is used in LLMEngine to log to Stdout."""
def
__init__
(
self
,
*
args
,
**
kwargs
)
->
None
:
super
().
__init__
(
*
args
,
**
kwargs
)
self
.
last_prompt_throughput
:
Optional
[
float
]
=
None
self
.
last_generation_throughput
:
Optional
[
float
]
=
None
def
log
(
self
,
stats
:
Stats
)
->
None
:
"""Called by LLMEngine.
Logs to Stdout every self.local_interval seconds."""
...
...
@@ -445,8 +450,14 @@ class LoggingStatLogger(StatLoggerBase):
now
=
stats
.
now
,
last_log
=
self
.
last_local_log
)
# Log to stdout.
logger
.
info
(
log_fn
=
logger
.
info
if
not
any
((
prompt_throughput
,
generation_throughput
,
self
.
last_prompt_throughput
,
self
.
last_generation_throughput
)):
# Avoid log noise on an idle production system
log_fn
=
logger
.
debug
log_fn
(
"Avg prompt throughput: %.1f tokens/s, "
"Avg generation throughput: %.1f tokens/s, "
"Running: %d reqs, Swapped: %d reqs, "
...
...
@@ -472,11 +483,16 @@ class LoggingStatLogger(StatLoggerBase):
self
.
_format_spec_decode_metrics_str
(
self
.
spec_decode_metrics
))
self
.
_reset
(
stats
,
prompt_throughput
,
generation_throughput
)
def
_reset
(
self
,
stats
,
prompt_throughput
,
generation_throughput
)
->
None
:
# Reset tracked stats for next interval.
self
.
num_prompt_tokens
=
[]
self
.
num_generation_tokens
=
[]
self
.
last_local_log
=
stats
.
now
self
.
spec_decode_metrics
=
None
self
.
last_prompt_throughput
=
prompt_throughput
self
.
last_generation_throughput
=
generation_throughput
def
_format_spec_decode_metrics_str
(
self
,
metrics
:
"SpecDecodeWorkerMetrics"
)
->
str
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment