Skip to content

Commit 1e7d5c0

Browse files
authored
[misc] soft drop beam search (#8763)
1 parent 2467b64 commit 1e7d5c0

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
@@ -8,6 +8,7 @@
88
import torch
99
from typing_extensions import Annotated
1010

11+
import vllm.envs as envs
1112
from vllm.logger import init_logger
1213

1314
logger = init_logger(__name__)
@@ -260,6 +261,10 @@ def __post_init__(self) -> None:
260261

261262
self._verify_args()
262263
if self.use_beam_search:
264+
if not envs.VLLM_ALLOW_DEPRECATED_BEAM_SEARCH:
265+
raise ValueError(
266+
"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
267+
)
263268
self._verify_beam_search()
264269
else:
265270
self._verify_non_beam_search()

0 commit comments

Comments
 (0)