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 10, 14:00 UTC
[Misc] Improve error messages for unsupported types and parameters (#30593)
Signed-off-by: BlankR <hjyblanche@gmail.com> Co-authored-by: Wentao Ye <44945378+yewentao256@users.noreply.github.com>
BlankR committed
Jan 7, 2026 at 01:00 UTC
0790f07695c72fe203e95f6d8c8ff15c8003e754
11 files changed
+40
-16
benchmarks/cutlass_benchmarks/sparse_benchmarks.py
+3
-1
@@ -343,7 +343,9 @@ def bench(
343
return bench_int8(dtype, m, k, n, label, sub_label)
344
if dtype == torch.float8_e4m3fn:
345
return bench_fp8(dtype, m, k, n, label, sub_label)
346
- raise ValueError("unsupported type")
346
+ raise ValueError(
347
+ f"Unsupported dtype {dtype}: should be one of torch.int8, torch.float8_e4m3fn."
348
+ )
349
350
351
# runner
vllm/attention/ops/chunked_prefill_paged_decode.py
+4
-1
@@ -292,7 +292,10 @@ def chunked_prefill_paged_decode(
292
elif kv_cache_dtype == "fp8_e5m2":
293
target_dtype = torch.float8_e5m2
294
else:
295
- raise ValueError("Unsupported FP8 dtype:", kv_cache_dtype)
295
+ raise ValueError(
296
+ f"Unsupported FP8 kv_cache_dtype {kv_cache_dtype}: "
297
+ f"should be one of 'fp8', 'fp8_e4m3', 'fp8_e5m2'."
298
+ )
299
300
key_cache = key_cache.view(target_dtype)
301
value_cache = value_cache.view(target_dtype)
vllm/config/lora.py
+1
-1
@@ -90,7 +90,7 @@ class LoRAConfig:
90
elif self.max_cpu_loras < self.max_loras:
91
raise ValueError(
92
f"max_cpu_loras ({self.max_cpu_loras}) must be >= "
93
- f"max_loras ({self.max_loras})"
93
+ f"max_loras ({self.max_loras})."
94
)
95
96
return self
vllm/distributed/device_communicators/pynccl_wrapper.py
+4
-1
@@ -92,7 +92,10 @@ class ncclDataTypeEnum:
92
return cls.ncclFloat64
93
if dtype == torch.bfloat16:
94
return cls.ncclBfloat16
95
- raise ValueError(f"Unsupported dtype: {dtype}")
95
+ raise ValueError(
96
+ f"Unsupported dtype {dtype}: should be one of "
97
+ f"int8, uint8, int32, int64, float16, float32, float64, bfloat16."
98
+ )
99
100
101
ncclRedOp_t = ctypes.c_int
vllm/distributed/kv_transfer/kv_connector/v1/lmcache_integration/vllm_v1_adapter.py
+4
-1
@@ -233,7 +233,10 @@ class RequestTracker:
233
elif isinstance(new_block_ids, list):
234
pass
235
else:
236
- raise ValueError(f"Unsupported new_block_ids type {type(new_block_ids)}")
236
+ raise ValueError(
237
+ f"Unsupported new_block_ids type {type(new_block_ids)}: "
238
+ f"should be None[list[int], ...], tuple or list[int]."
239
+ )
240
self.allocated_block_ids.extend(new_block_ids)
241
242
# When a request is scheduled again, and the number of new tokens
vllm/model_executor/layers/quantization/auto_round.py
+6
-6
@@ -56,22 +56,22 @@ class AutoRoundConfig(QuantizationConfig):
56
if weight_bits not in self.SUPPORTED_BITS:
57
raise ValueError(
58
f"Unsupported weight_bits: {weight_bits}, "
59
- f"currently only support {self.SUPPORTED_BITS}"
59
+ f"currently only support {self.SUPPORTED_BITS}."
60
)
61
if data_type not in self.SUPPORTED_DTYPES:
62
raise ValueError(
63
- f"Unsupported data_type: {data_type},"
64
- f" currently only support {self.SUPPORTED_DTYPES}"
63
+ f"Unsupported data_type: {data_type}, "
64
+ f"currently only support {self.SUPPORTED_DTYPES}."
65
)
66
if packing_format not in self.SUPPORTED_FORMATS:
67
raise ValueError(
68
f"Unsupported packing_format: {packing_format}, "
69
- f"currently only support {self.SUPPORTED_FORMATS}"
69
+ f"currently only support {self.SUPPORTED_FORMATS}."
70
)
71
if backend not in self.SUPPORTED_BACKENDS:
72
raise ValueError(
73
- f"Unsupported backend: {backend}, "
74
- f"currently only support {self.SUPPORTED_BACKENDS}"
73
+ f"Unsupported backend: {backend}, "
74
+ f"currently only support {self.SUPPORTED_BACKENDS}."
75
)
76
77
self.weight_bits = weight_bits
vllm/model_executor/layers/quantization/compressed_tensors/schemes/compressed_tensors_w8a8_fp8.py
+4
-1
@@ -158,7 +158,10 @@ class CompressedTensorsW8A8Fp8(CompressedTensorsScheme):
158
input_scale = None
159
160
else:
161
- raise ValueError(f"Unknown quantization strategy {self.strategy}")
161
+ raise ValueError(
162
+ f"Unknown quantization strategy {self.strategy}: "
163
+ f"should be one of {list(QuantizationStrategy)}"
164
+ )
165
166
# required by torch.compile to be torch.nn.Parameter
167
layer.weight = Parameter(weight.data, requires_grad=False)
vllm/model_executor/layers/quantization/mxfp4.py
+4
-1
@@ -783,7 +783,10 @@ class Mxfp4MoEMethod(FusedMoEMethodBase):
783
layer.w13_weight = w13_weight
784
layer.w2_weight = w2_weight
785
else:
786
- raise ValueError(f"Unsupported backend: {self.mxfp4_backend}")
786
+ raise ValueError(
787
+ f"Unsupported mxfp4_backend: {self.mxfp4_backend}: "
788
+ f"should be one of: {list(Mxfp4Backend)}."
789
+ )
790
791
def get_fused_moe_quant_config(
792
self, layer: torch.nn.Module
vllm/model_executor/models/ernie45_vl.py
+5
-1
@@ -599,7 +599,11 @@ def smart_resize(
599
w_bar = ceil_by_factor(width * beta, factor)
600
601
if min_pixels > h_bar * w_bar or h_bar * w_bar > max_pixels:
602
- raise ValueError(f"encounter invalid h_bar: {h_bar}, w_bar: {w_bar}")
602
+ raise ValueError(
603
+ f"Invalid h_bar={h_bar}, w_bar={w_bar}: "
604
+ f"h_bar * w_bar must be >= min_pixels ({min_pixels}) "
605
+ f"and <= max_pixels ({max_pixels})."
606
+ )
607
608
return h_bar, w_bar
609
vllm/model_executor/models/granite_speech.py
+3
-1
@@ -348,7 +348,9 @@ class GraniteSpeechConformerAttention(nn.Module):
348
349
if self.context_size <= 0 or self.context_size > self.max_pos_emb:
350
raise ValueError(
351
- "Context size is either less than 0 or exceeds the max_pos_emb"
351
+ f"Context size should be > 0 and "
352
+ f"<= max_pos_emb ({self.max_pos_emb}), "
353
+ f"got {self.context_size}."
354
)
355
356
def forward(
vllm/model_executor/models/minimax_text_01.py
+2
-1
@@ -332,7 +332,8 @@ class MiniMaxText01DecoderLayer(nn.Module):
332
)
333
else:
334
raise ValueError(
335
- f"Unsupported attention type: {self.config.attention_type}"
335
+ f"Unsupported attention_type {self.config.attention_type}: "
336
+ f"should be 0 (linear) or 1 (full)."
337
)
338
339
if expert_num == 1: