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
f0bbfaf9
Unverified
Commit
f0bbfaf9
authored
Jul 19, 2024
by
Thomas Parnell
Committed by
GitHub
Jul 19, 2024
Browse files
[Bugfix] [SpecDecode] AsyncMetricsCollector: update time since last collection (#6578)
parent
30efe415
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
0 deletions
+47
-0
tests/spec_decode/test_metrics.py
tests/spec_decode/test_metrics.py
+43
-0
vllm/spec_decode/metrics.py
vllm/spec_decode/metrics.py
+4
-0
No files found.
tests/spec_decode/test_metrics.py
View file @
f0bbfaf9
...
...
@@ -105,6 +105,49 @@ def test_noop_until_time():
assert
metrics
is
not
None
def
test_timer_is_reset
():
"""Verify that the internal timer inside AsyncMetricsCollector
is reset after collection.
"""
spec_decode_sampler
=
MagicMock
()
spec_decode_sampler
.
num_accepted_tokens
=
torch
.
tensor
(
0
,
dtype
=
torch
.
long
,
device
=
'cuda'
)
spec_decode_sampler
.
num_emitted_tokens
=
torch
.
tensor
(
0
,
dtype
=
torch
.
long
,
device
=
'cuda'
)
spec_decode_sampler
.
num_draft_tokens
=
0
collect_interval_s
=
5.0
timer
=
MagicMock
()
timer
.
side_effect
=
[
0.0
,
collect_interval_s
+
0.1
,
collect_interval_s
+
0.1
,
collect_interval_s
+
0.2
,
collect_interval_s
+
0.2
,
2
*
collect_interval_s
+
0.1
,
2
*
collect_interval_s
+
0.1
,
]
collector
=
AsyncMetricsCollector
(
spec_decode_sampler
=
spec_decode_sampler
,
timer
=
timer
,
collect_interval_s
=
collect_interval_s
)
collector
.
init_gpu_tensors
(
rank
=
0
)
_
=
collector
.
maybe_collect_rejsample_metrics
(
k
=
5
)
metrics
=
collector
.
maybe_collect_rejsample_metrics
(
k
=
5
)
assert
metrics
is
not
None
_
=
collector
.
maybe_collect_rejsample_metrics
(
k
=
5
)
metrics
=
collector
.
maybe_collect_rejsample_metrics
(
k
=
5
)
assert
metrics
is
None
_
=
collector
.
maybe_collect_rejsample_metrics
(
k
=
5
)
metrics
=
collector
.
maybe_collect_rejsample_metrics
(
k
=
5
)
assert
metrics
is
not
None
@
pytest
.
mark
.
parametrize
(
"has_data"
,
[
True
,
False
])
def
test_initial_metrics_has_correct_values
(
has_data
:
bool
):
"""Test correctness of metrics data.
...
...
vllm/spec_decode/metrics.py
View file @
f0bbfaf9
...
...
@@ -145,6 +145,10 @@ class AsyncMetricsCollector:
"""
ready_event
.
synchronize
()
# update time of last collection
self
.
_last_metrics_collect_time
=
self
.
_timer
()
accepted_tokens
=
self
.
_aggregate_num_accepted_tokens
.
item
()
emitted_tokens
=
self
.
_aggregate_num_emitted_tokens
.
item
()
draft_tokens
=
self
.
_aggregate_num_draft_tokens
...
...
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