[Bugfix][SpecDecode] Scope MTP completeness checks outside bucketed updates (#49178)

Signed-off-by: aoshen02 <aoshen02@users.noreply.github.com>
Co-authored-by: aoshen02 <aoshen02@users.noreply.github.com>
This commit is contained in:
aoshen02
2026-07-21 18:56:39 -07:00
committed by GitHub
co-authored by aoshen02
parent 0500ca6a58
commit ba18929079
14 changed files with 131 additions and 37 deletions
@@ -0,0 +1,26 @@
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
"""Scoped controls for MTP checkpoint completeness validation."""
from collections.abc import Iterator
from contextlib import contextmanager
from contextvars import ContextVar
_mtp_completeness_check_enabled: ContextVar[bool] = ContextVar(
"mtp_completeness_check_enabled", default=True
)
def is_mtp_completeness_check_enabled() -> bool:
"""Return whether MTP completeness validation is enabled in this scope."""
return _mtp_completeness_check_enabled.get()
@contextmanager
def disable_mtp_completeness_check() -> Iterator[None]:
"""Temporarily disable MTP completeness validation for one weight load."""
token = _mtp_completeness_check_enabled.set(False)
try:
yield
finally:
_mtp_completeness_check_enabled.reset(token)