[MyPy][3/N] Fix MyPy errors in test groups (part 3) (#55939)
Signed-off-by: Taimys <ffy2281693949@gmail.com> Signed-off-by: Luyi Xiao <81631911+luyixiao95@users.noreply.github.com> Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com> Co-authored-by: Codex <noreply@openai.com> Co-authored-by: Luyi Xiao <81631911+luyixiao95@users.noreply.github.com> Co-authored-by: Taimys <ffy2281693949@gmail.com> Co-authored-by: Harry Mellor <19981378+hmellor@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Codex
Luyi Xiao
Taimys
Harry Mellor
Claude Opus 5.5
parent
c4fa6f36a7
commit
5225f1bacb
@@ -25,9 +25,9 @@ def make_manager(
|
||||
num_reqs, num_steps = confidences.shape
|
||||
manager = AdaptiveVerificationManager.__new__(AdaptiveVerificationManager)
|
||||
manager.num_speculative_steps = num_steps
|
||||
manager._stale_confidences = [SimpleNamespace(np=confidences)]
|
||||
manager._stale_confidences = [SimpleNamespace(np=confidences)] # type: ignore[list-item] # CPU-only confidence buffer.
|
||||
manager._stale_idx = 0
|
||||
manager.req_states = SimpleNamespace(
|
||||
manager.req_states = SimpleNamespace( # type: ignore[assignment] # CPU-only request fixture.
|
||||
req_id_to_index={"low": 0, "high": 1},
|
||||
num_computed_tokens_np=np.ones(num_reqs, dtype=np.int32),
|
||||
prefill_len=SimpleNamespace(np=np.ones(num_reqs, dtype=np.int32)),
|
||||
@@ -153,11 +153,11 @@ def test_manager_checks_target_varlen_cudagraph_bound(
|
||||
manager = maybe_create_adaptive_verification_manager(
|
||||
enable_adaptive_verification=True,
|
||||
attn_groups=groups,
|
||||
req_states=SimpleNamespace(num_speculative_steps=7),
|
||||
req_states=SimpleNamespace(num_speculative_steps=7), # type: ignore[arg-type]
|
||||
query_start_loc=object(),
|
||||
num_bonus_tokens=1,
|
||||
max_total_logits=1,
|
||||
vllm_config=None,
|
||||
vllm_config=None, # type: ignore[arg-type]
|
||||
target_layer_names={"target"},
|
||||
additional_attn_cg_support=additional,
|
||||
)
|
||||
@@ -176,6 +176,7 @@ def test_budget_stops_where_marginal_drafts_stop_paying_for_themselves():
|
||||
{"low": 3, "high": 3},
|
||||
{"low": [1, 2], "high": [3, 4]},
|
||||
)
|
||||
assert manager._batch_budget is not None
|
||||
valid_drafts, num_non_draft_tokens, draft_budget = manager._batch_budget
|
||||
|
||||
assert draft_budget == 1
|
||||
@@ -183,14 +184,18 @@ def test_budget_stops_where_marginal_drafts_stop_paying_for_themselves():
|
||||
assert num_non_draft_tokens == {"low": 1, "high": 1}
|
||||
|
||||
|
||||
def test_profiled_batches_seed_cost_curves_via_consumer():
|
||||
def test_profiled_batches_seed_cost_curves_via_consumer(monkeypatch):
|
||||
manager = AdaptiveVerificationManager.__new__(AdaptiveVerificationManager)
|
||||
manager.req_states = SimpleNamespace(max_num_batched_tokens=4096, max_num_reqs=64)
|
||||
manager.req_states = SimpleNamespace( # type: ignore[assignment] # CPU-only request fixture.
|
||||
max_num_batched_tokens=4096, max_num_reqs=64
|
||||
)
|
||||
manager.num_speculative_steps = 7
|
||||
manager.num_bonus_tokens = 1
|
||||
curves: dict[str, list[tuple[int, float]]] = {}
|
||||
manager.set_cost_curves = lambda draft, verify: curves.update(
|
||||
draft=draft, verify=verify
|
||||
monkeypatch.setattr(
|
||||
manager,
|
||||
"set_cost_curves",
|
||||
lambda draft, verify: curves.update(draft=draft, verify=verify),
|
||||
)
|
||||
|
||||
timings = [
|
||||
@@ -258,6 +263,7 @@ def test_budget_caps_at_one_rejection_sampler_chunk():
|
||||
{"low": 3, "high": 3},
|
||||
{"low": [1, 2], "high": [3, 4]},
|
||||
)
|
||||
assert manager._batch_budget is not None
|
||||
_, _, draft_budget = manager._batch_budget
|
||||
assert draft_budget <= 1
|
||||
|
||||
@@ -285,6 +291,7 @@ def test_zero_budget_rebuilds_cpu_cu_num_logits():
|
||||
{"low": 3, "high": 3, "prefill": 40},
|
||||
{"low": [1, 2], "high": [3, 4]},
|
||||
)
|
||||
assert manager._batch_budget is not None
|
||||
_, _, draft_budget = manager._batch_budget
|
||||
assert draft_budget == 0
|
||||
|
||||
@@ -323,6 +330,7 @@ def test_zero_budget_keeps_one_grammar_row_per_scheduled_draft():
|
||||
manager.get_num_tokens(
|
||||
{"low": 3, "high": 3, "prefill": 40}, scheduled_spec_decode_tokens
|
||||
)
|
||||
assert manager._batch_budget is not None
|
||||
assert manager._batch_budget[2] == 0
|
||||
|
||||
req_ids = ["low", "high", "prefill"]
|
||||
|
||||
Reference in New Issue
Block a user