Skip to content

Commit 26f9cf0

Browse files
committed
+ extremely_dangerous
Signed-off-by: wang.yuqi <noooop@126.com>
1 parent 66f6fbd commit 26f9cf0

File tree

2 files changed

+23
-6
lines changed

2 files changed

+23
-6
lines changed

vllm/config.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3631,13 +3631,20 @@ def _get_and_verify_max_len(
36313631
f"{model_max_length} in model's config.json). This may lead "
36323632
"to incorrect model outputs or CUDA errors.")
36333633
if envs.VLLM_ALLOW_LONG_MAX_MODEL_LEN:
3634-
logger.warning(
3635-
"%s Make sure the value is correct and within the "
3636-
"model context size.", msg)
3634+
logger.extremely_dangerous(
3635+
"Using VLLM_ALLOW_LONG_MAX_MODEL_LEN may lead"
3636+
" to the following exceptions:\n"
3637+
"- If the model uses rope position encoding, "
3638+
"positions exceeding derived_max_model_len "
3639+
"lead to nan.\n"
3640+
"- If the model uses absolute position encoding, "
3641+
"positions exceeding derived_max_model_len "
3642+
"will cause a CUDA array out-of-bounds error.\n"
3643+
"For testing purposes only, do not implement "
3644+
"any functionality relying "
3645+
"on VLLM_ALLOW_LONG_MAX_MODEL_LEN.")
36373646
else:
3638-
raise ValueError(
3639-
f"{msg} To allow overriding this maximum, set "
3640-
"the env var VLLM_ALLOW_LONG_MAX_MODEL_LEN=1")
3647+
raise ValueError(msg)
36413648
return int(max_model_len)
36423649

36433650

vllm/logger.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,12 @@ def _print_warning_once(logger: Logger, msg: str, *args: Hashable) -> None:
7171
logger.warning(msg, *args, stacklevel=2)
7272

7373

74+
def _extremely_dangerous(logger: Logger, msg: str, *args: Hashable) -> None:
75+
template = (f"\n===== EXTREMELY DANGEROUS =====\n"
76+
f"{msg}\n===============================\n")
77+
logger.warning(template, *args, stacklevel=2)
78+
79+
7480
class _VllmLogger(Logger):
7581
"""
7682
Note:
@@ -101,6 +107,9 @@ def warning_once(self, msg: str, *args: Hashable) -> None:
101107
"""
102108
_print_warning_once(self, msg, *args)
103109

110+
def extremely_dangerous(self, param, *args):
111+
_extremely_dangerous(param, *args)
112+
104113

105114
def _configure_vllm_root_logger() -> None:
106115
logging_config = dict[str, Any]()
@@ -148,6 +157,7 @@ def init_logger(name: str) -> _VllmLogger:
148157
"debug_once": _print_debug_once,
149158
"info_once": _print_info_once,
150159
"warning_once": _print_warning_once,
160+
"extremely_dangerous": _extremely_dangerous
151161
}
152162

153163
for method_name, method in methods_to_patch.items():

0 commit comments

Comments
 (0)