Fix fp16 NaN flake in spec CI: bf16 eagle fixture; sanitize NaN logits in sampler (#27883)

This commit is contained in:
Liangsheng Yin
2026-06-11 01:16:12 -07:00
committed by GitHub
parent b8376aebd0
commit 493bb6ae0d
5 changed files with 80 additions and 3 deletions
+3 -1
View File
@@ -16,6 +16,7 @@ from sglang.srt.layers.utils.logprob import get_token_ids_logprobs, get_top_logp
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.async_probe import sanitize_nan_logits
from sglang.srt.utils.common import (
get_bool_env_var,
is_cuda,
@@ -83,9 +84,10 @@ class Sampler(nn.Module):
def _preprocess_logits(
self, logits: torch.Tensor, sampling_info: SamplingBatchInfo
) -> torch.Tensor:
"""Apply custom logit processors."""
"""Apply custom logit processors and sanitize non-finite logits."""
if sampling_info.has_custom_logit_processor:
apply_custom_logit_processor(logits, sampling_info)
sanitize_nan_logits(logits, "sampler: next_token_logits")
return logits
def forward(