[Spec] Async-assert probes across EAGLE/MTP; zero tgt_cache_loc (#26335)

This commit is contained in:
Liangsheng Yin
2026-05-26 11:34:03 -07:00
committed by GitHub
parent 6c8128650e
commit ec6f8d61f7
23 changed files with 171 additions and 94 deletions
+1 -15
View File
@@ -17,7 +17,6 @@ from sglang.srt.sampling.sampling_batch_info import SamplingBatchInfo
from sglang.srt.sampling.sampling_params import TOP_K_ALL
from sglang.srt.server_args import get_global_server_args
from sglang.srt.utils.common import (
crash_on_warnings,
get_bool_env_var,
is_cuda,
is_musa,
@@ -57,7 +56,6 @@ _BUILT_IN_SAMPLING_BACKENDS = {"flashinfer", "pytorch", "ascend"}
class Sampler(nn.Module):
def __init__(self):
super().__init__()
self.use_nan_detection = get_global_server_args().enable_nan_detection
self.tp_sync_group = get_tp_group().device_group
if is_dp_attention_enabled():
self.tp_sync_group = get_attention_tp_group().device_group
@@ -74,20 +72,9 @@ class Sampler(nn.Module):
def _preprocess_logits(
self, logits: torch.Tensor, sampling_info: SamplingBatchInfo
) -> torch.Tensor:
"""Apply custom logit processors and handle NaN detection."""
# Apply the custom logit processors if registered in the sampling info
"""Apply custom logit processors."""
if sampling_info.has_custom_logit_processor:
apply_custom_logit_processor(logits, sampling_info)
# Detect and handle NaN values in logits
if self.use_nan_detection and torch.any(torch.isnan(logits)):
logger.warning("Detected errors during sampling! NaN in the logits.")
logits = torch.where(
torch.isnan(logits), torch.full_like(logits, -1e5), logits
)
if crash_on_warnings():
raise ValueError("Detected errors during sampling! NaN in the logits.")
return logits
def forward(
@@ -238,7 +225,6 @@ class Sampler(nn.Module):
sampling_info.top_ks,
sampling_info.top_ps,
filter_apply_order="joint",
check_nan=self.use_nan_detection,
)
elif backend == "pytorch":
# A slower fallback implementation with torch native operations.