Skip to content

Commit 672c665

Browse files
youkaichaoAlvant
authored andcommitted
[misc] soft drop beam search (vllm-project#8763)
Signed-off-by: Alvant <[email protected]>
1 parent be49451 commit 672c665

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

vllm/envs.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
VLLM_TORCH_PROFILER_DIR: Optional[str] = None
6363
VLLM_USE_TRITON_AWQ: bool = False
6464
VLLM_ALLOW_RUNTIME_LORA_UPDATING: bool = False
65+
VLLM_ALLOW_DEPRECATED_BEAM_SEARCH: bool = False
6566

6667

6768
def get_default_cache_root():
@@ -195,6 +196,10 @@ def get_default_config_root():
195196
lambda: (os.environ.get("VLLM_USE_TRITON_FLASH_ATTN", "True").lower() in
196197
("true", "1")),
197198

199+
# If set, allowing the use of deprecated beam search implementation
200+
"VLLM_ALLOW_DEPRECATED_BEAM_SEARCH":
201+
lambda: os.environ.get("VLLM_ALLOW_DEPRECATED_BEAM_SEARCH", "0") == "1",
202+
198203
# Internal flag to enable Dynamo graph capture
199204
"VLLM_TEST_DYNAMO_GRAPH_CAPTURE":
200205
lambda: int(os.environ.get("VLLM_TEST_DYNAMO_GRAPH_CAPTURE", "0")),

vllm/sampling_params.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from pydantic import Field
1010
from typing_extensions import Annotated
1111

12+
import vllm.envs as envs
1213
from vllm.logger import init_logger
1314
from vllm.logits_process import LogitsProcessor, NoBadWordsLogitsProcessor
1415

@@ -257,6 +258,10 @@ def __post_init__(self) -> None:
257258

258259
self._verify_args()
259260
if self.use_beam_search:
261+
if not envs.VLLM_ALLOW_DEPRECATED_BEAM_SEARCH:
262+
raise ValueError(
263+
"Using beam search as a sampling parameter is deprecated, and will be removed in the future release. Please use the `vllm.LLM.use_beam_search` method for dedicated beam search instead, or set the environment variable `VLLM_ALLOW_DEPRECATED_BEAM_SEARCH=1` to suppress this error. For more details, see https://github.com/vllm-project/vllm/issues/8306 ." # noqa
264+
)
260265
self._verify_beam_search()
261266
else:
262267
self._verify_non_beam_search()

0 commit comments

Comments
 (0)