@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / 6dbe5b5c93
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, 08:30 UTC

Remove checks for `None` for fields which should never be `None` (#17985)

Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>

Harry Mellor committed May 28, 2025 at 22:32 UTC 6dbe5b5c934268387fb03485a5625b1793049d8c
1 file changed +10 -14
vllm/config.py
+10 -14
@@ -4282,25 +4282,22 @@ class VllmConfig:
4282 self.model_config.verify_dual_chunk_attention_config(
4283 self.load_config)
4284
4285 - if self.cache_config is not None:
4286 - self.cache_config.verify_with_parallel_config(self.parallel_config)
4285 + self.cache_config.verify_with_parallel_config(self.parallel_config)
4286
4288 - if self.lora_config:
4287 + if self.lora_config is not None:
4288 self.lora_config.verify_with_cache_config(self.cache_config)
4289 self.lora_config.verify_with_model_config(self.model_config)
4290 self.lora_config.verify_lora_support()
4292 - if self.prompt_adapter_config:
4291 + if self.prompt_adapter_config is not None:
4292 self.prompt_adapter_config.verify_with_model_config(
4293 self.model_config)
4294
4296 - if self.quant_config is None and \
4297 - self.model_config is not None and self.load_config is not None:
4295 + if self.quant_config is None and self.model_config is not None:
4296 self.quant_config = VllmConfig._get_quantization_config(
4297 self.model_config, self.load_config)
4298
4299 from vllm.platforms import current_platform
4302 - if self.scheduler_config is not None and \
4303 - self.model_config is not None and \
4300 + if self.model_config is not None and \
4301 self.scheduler_config.chunked_prefill_enabled and \
4302 self.model_config.dtype == torch.float32 and \
4303 current_platform.get_device_capability() == (7, 5):
@@ -4335,8 +4332,7 @@ class VllmConfig:
4332
4333 self._set_cudagraph_sizes()
4334
4338 - if self.cache_config is not None and \
4339 - self.cache_config.cpu_offload_gb > 0 and \
4335 + if self.cache_config.cpu_offload_gb > 0 and \
4336 self.compilation_config.level != CompilationLevel.NO_COMPILATION \
4337 and not envs.VLLM_USE_V1:
4338 logger.warning(
@@ -4358,16 +4354,16 @@ class VllmConfig:
4354 "full_cuda_graph is not supported with "
4355 "cascade attention. Disabling cascade attention.")
4356 self.model_config.disable_cascade_attn = True
4361 - if self.cache_config is not None:
4362 - self.cache_config.enable_prefix_caching = False
4357 + self.cache_config.enable_prefix_caching = False
4358
4364 - if (self.kv_events_config
4359 + if (self.kv_events_config is not None
4360 and self.kv_events_config.enable_kv_cache_events
4361 and not self.cache_config.enable_prefix_caching):
4362 logger.warning(
4363 "KV cache events are on, but prefix caching is not enabled."
4364 "Use --enable-prefix-caching to enable.")
4370 - if (self.kv_events_config and self.kv_events_config.publisher != "null"
4365 + if (self.kv_events_config is not None
4366 + and self.kv_events_config.publisher != "null"
4367 and not self.kv_events_config.enable_kv_cache_events):
4368 logger.warning("KV cache events are disabled,"
4369 "but the scheduler is configured to publish them."