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 16, 00:45 UTC
[V1] Bugfix: Validate Model Input Length (#12600)
SUMMARY: * avoid crashing the engine when we get an input longer than max_model_len FIX #12567(*link existing issues this PR will resolve*)
Robert Shaw committed
Jan 31, 2025 at 21:32 UTC
b1340f9d55cd36a92aff713213e95f354a1bd1b4
1 file changed
+5
vllm/v1/engine/processor.py
+5
@@ -206,6 +206,11 @@ class Processor:
206
if prompt_ids is None or len(prompt_ids) == 0:
207
raise ValueError("Prompt cannot be empty")
208
209
+ if len(prompt_ids) >= self.model_config.max_model_len:
210
+ raise ValueError(
211
+ f"Prompt length of {len(prompt_ids)} is longer than the "
212
+ f"maximum model length of {self.model_config.max_model_len}.")
213
+
214
if self.model_config.is_multimodal_model:
215
max_prompt_len = self.model_config.max_model_len
216