A high-throughput and memory-efficient inference and serving engine for LLMs
Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git
Synced Nov 14, 23:45 UTC
[Logs] Change flashinfer sampler logs to once (#21759)
Signed-off-by: mgoin <mgoin64@gmail.com>
Michael Goin committed
Jul 28, 2025 at 09:59 UTC
34a20c49b3f81f64133428b3a0d62309db1256f9
1 file changed
+8
-7
vllm/v1/sample/ops/topk_topp_sampler.py
+8
-7
@@ -33,7 +33,7 @@ class TopKTopPSampler(nn.Module):
33
if is_flashinfer_available:
34
flashinfer_version = flashinfer.__version__
35
if flashinfer_version < "0.2.3":
36
- logger.warning(
36
+ logger.warning_once(
37
"FlashInfer version >= 0.2.3 required. "
38
"Falling back to default sampling implementation.")
39
self.forward = self.forward_native
@@ -46,17 +46,18 @@ class TopKTopPSampler(nn.Module):
46
# None means False, while in V1, None means True. This is
47
# why we use the condition
48
# `envs.VLLM_USE_FLASHINFER_SAMPLER is not False` here.
49
- logger.info("Using FlashInfer for top-p & top-k sampling.")
49
+ logger.info_once(
50
+ "Using FlashInfer for top-p & top-k sampling.")
51
self.forward = self.forward_cuda
52
else:
52
- logger.warning(
53
+ logger.warning_once(
54
"FlashInfer is available, but it is not enabled. "
55
"Falling back to the PyTorch-native implementation of "
56
"top-p & top-k sampling. For the best performance, "
57
"please set VLLM_USE_FLASHINFER_SAMPLER=1.")
58
self.forward = self.forward_native
59
else:
59
- logger.warning(
60
+ logger.warning_once(
61
"FlashInfer is not available. Falling back to the PyTorch-"
62
"native implementation of top-p & top-k sampling. For the "
63
"best performance, please install FlashInfer.")
@@ -97,9 +98,9 @@ class TopKTopPSampler(nn.Module):
98
probs = logits.softmax(dim=-1, dtype=torch.float32)
99
return random_sample(probs, generators)
100
if generators:
100
- logger.warning("FlashInfer 0.2.3+ does not support "
101
- "per-request generators. Falling back to "
102
- "PyTorch-native implementation.")
101
+ logger.warning_once("FlashInfer 0.2.3+ does not support "
102
+ "per-request generators. Falling back to "
103
+ "PyTorch-native implementation.")
104
return self.forward_native(logits, generators, k, p)
105
# flashinfer sampling functions expect contiguous logits.
106
# In flex_attn/triton_attn fp32 inference, logits can be non-contiguous