@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / dd2a94596a
Fork 0

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 15, 09:45 UTC

[Model] Allow the use of sliding window in Qwen2 (#17772)

Signed-off-by: inkcherry <mingzhi.liu@intel.com>

inkcherry committed May 15, 2025 at 13:29 UTC dd2a94596abe43eb0e556cde306fc80d442183c0
1 file changed +8 -8
vllm/model_executor/models/qwen2.py
+8 -8
@@ -291,14 +291,14 @@ class Qwen2Model(nn.Module):
291 # TODO (@robertgshaw2): see if this can be moved out
292 if (cache_config.sliding_window is not None
293 and hasattr(config, "max_window_layers")):
294 - raise ValueError("Sliding window for some but all layers is not "
295 - "supported. This model uses sliding window "
296 - "but `max_window_layers` = {} is less than "
297 - "`num_hidden_layers` = {}. Please open an issue "
298 - "to discuss this feature.".format(
299 - config.max_window_layers,
300 - config.num_hidden_layers,
301 - ))
294 + assert config.max_window_layers == config.num_hidden_layers, (
295 + "Sliding window for some but all layers is not supported. "
296 + "This model uses sliding window but `max_window_layers` = {} "
297 + "is less than `num_hidden_layers` = {}. Please open an issue "
298 + "to discuss this feature.".format(
299 + config.max_window_layers,
300 + config.num_hidden_layers,
301 + ))
302
303 self.config = config
304 self.quant_config = quant_config