From 2fa0a11d2af11cadef76d192b33821d24180d47f Mon Sep 17 00:00:00 2001 From: Woosuk Kwon Date: Sat, 13 Jul 2024 11:52:22 -0700 Subject: [PATCH] [Misc] Add deprecation warning for beam search (#6402) --- vllm/envs.py | 5 +++++ vllm/sampling_params.py | 12 ++++++++++++ 2 files changed, 17 insertions(+) diff --git a/vllm/envs.py b/vllm/envs.py index c624510c7ea1a..5b4a2010d12e6 100644 --- a/vllm/envs.py +++ b/vllm/envs.py @@ -41,6 +41,7 @@ NVCC_THREADS: Optional[str] = None VLLM_USE_PRECOMPILED: bool = False VLLM_INSTALL_PUNICA_KERNELS: bool = False + VLLM_NO_DEPRECATION_WARNING: bool = False CMAKE_BUILD_TYPE: Optional[str] = None VERBOSE: bool = False @@ -251,6 +252,10 @@ lambda: os.getenv("VLLM_XLA_CACHE_PATH", "~/.vllm/xla_cache/"), "VLLM_FUSED_MOE_CHUNK_SIZE": lambda: int(os.getenv("VLLM_FUSED_MOE_CHUNK_SIZE", "65536")), + + # If set, vllm will skip the deprecation warnings. + "VLLM_NO_DEPRECATION_WARNING": + lambda: bool(int(os.getenv("VLLM_NO_DEPRECATION_WARNING", "0"))), } # end-env-vars-definition diff --git a/vllm/sampling_params.py b/vllm/sampling_params.py index a2caae21a86e3..90f0944a7f3de 100644 --- a/vllm/sampling_params.py +++ b/vllm/sampling_params.py @@ -8,6 +8,11 @@ from pydantic import Field from typing_extensions import Annotated +import vllm.envs as envs +from vllm.logger import init_logger + +logger = init_logger(__name__) + _SAMPLING_EPS = 1e-5 @@ -184,6 +189,13 @@ def __init__( self._verify_args() if self.use_beam_search: + if not envs.VLLM_NO_DEPRECATION_WARNING: + logger.warning( + "[IMPORTANT] We plan to discontinue the support for beam " + "search in the next major release. Please refer to " + "https://github.com/vllm-project/vllm/issues/6226 for " + "more information. Set VLLM_NO_DEPRECATION_WARNING=1 to " + "suppress this warning.") self._verify_beam_search() else: self._verify_non_beam_search()