[Guards] The draft guard reports the draft model's own architecture
Co-Authored-By: Hinata <hinata@idihore.id> Signed-off-by: MOVZX <movzx@yahoo.com>
This commit is contained in:
+17
-3
@@ -100,9 +100,23 @@ def _name(value) -> str:
|
||||
return getattr(value, "name", str(value))
|
||||
|
||||
|
||||
def _profile(vllm_config) -> tuple[list[str], object, object, list[str] | None]:
|
||||
"""Resolved (architectures, mode, cudagraph mode, splitting ops)."""
|
||||
def _profile(
|
||||
vllm_config, role: str = "target"
|
||||
) -> tuple[list[str], object, object, list[str] | None]:
|
||||
"""Resolved (architectures, mode, cudagraph mode, splitting ops).
|
||||
|
||||
For ``role="draft"`` the architectures are the DRAFT model's
|
||||
(``speculative_config.draft_model_config``): the drafter is constructed
|
||||
with the target's VllmConfig, whose model_config names the target. The reference host
|
||||
logged the target architecture on the draft line before this fix.
|
||||
The graph profile is the engine's single CompilationConfig for both roles.
|
||||
"""
|
||||
model_config = getattr(vllm_config, "model_config", None)
|
||||
if role == "draft":
|
||||
spec = getattr(vllm_config, "speculative_config", None)
|
||||
draft_config = getattr(spec, "draft_model_config", None)
|
||||
if draft_config is not None:
|
||||
model_config = draft_config
|
||||
if model_config is None:
|
||||
raise RuntimeError("e2-guard: vllm_config has no model_config to check")
|
||||
compilation_config = getattr(vllm_config, "compilation_config", None)
|
||||
@@ -137,7 +151,7 @@ def assert_graph_profile_is_executable(vllm_config, *, role: str = "target") ->
|
||||
``Qwen4ExpMTP`` builds ``Qwen4ExpMultiTokenPredictor`` rather than
|
||||
``Qwen4ExpForCausalLM``, from a config rebuilt in ``mtp.py``.
|
||||
"""
|
||||
architectures, mode, cudagraph_mode, splitting_ops = _profile(vllm_config)
|
||||
architectures, mode, cudagraph_mode, splitting_ops = _profile(vllm_config, role)
|
||||
detail = (
|
||||
f"architectures={architectures} breakable={os.environ.get(BREAKABLE_ENV)} "
|
||||
f"compilation_mode={_name(mode)} cudagraph_mode={_name(cudagraph_mode)}"
|
||||
|
||||
Reference in New Issue
Block a user