mirror of
https://github.com/vllm-project/vllm.git
synced 2025-12-06 06:53:12 +08:00
[Frontend] Remove deprecated -O.xx flag (#29991)
Signed-off-by: Yanan Cao <gmagogsfm@gmail.com>
This commit is contained in:
@@ -86,7 +86,7 @@ LLM(model, enforce_eager=True)
|
||||
```
|
||||
|
||||
To turn off just torch.compile, pass `mode = NONE` to the compilation config.
|
||||
(`-cc` is short for `--compilation_config`; `-O.*` dotted syntax is deprecated):
|
||||
(`-cc` is short for `--compilation_config`):
|
||||
|
||||
```sh
|
||||
# Online
|
||||
|
||||
@@ -460,23 +460,20 @@ def test_flat_product():
|
||||
]
|
||||
|
||||
|
||||
def test_o_legacy_syntax_deprecation(caplog_vllm):
|
||||
"""Test that -O.* dotted syntax emits warnings and converts correctly to -cc syntax."""
|
||||
def test_o_dotted_syntax_error():
|
||||
"""Test that -O.* dotted syntax raises a clear error message."""
|
||||
parser = FlexibleArgumentParser()
|
||||
parser.add_argument("-cc", "--compilation-config", type=json.loads)
|
||||
|
||||
# Test that -O.backend gets converted correctly AND emits warning
|
||||
args = parser.parse_args(["-O.backend=eager"])
|
||||
assert args.compilation_config == {"backend": "eager"}
|
||||
# Test that -O.* syntax raises a clear ValueError
|
||||
with pytest.raises(ValueError, match=r"The -O\.\* syntax is no longer supported"):
|
||||
parser.parse_args(["-O.backend=eager"])
|
||||
|
||||
# Check that deprecation warning was logged
|
||||
assert len(caplog_vllm.records) >= 1
|
||||
assert (
|
||||
"The -O.* dotted syntax for --compilation-config is deprecated"
|
||||
in caplog_vllm.text
|
||||
)
|
||||
with pytest.raises(ValueError, match=r"Please use -cc\.\* instead"):
|
||||
parser.parse_args(["-O.mode=2"])
|
||||
|
||||
# Test that -O.mode gets converted correctly
|
||||
# Note: warning_once won't emit again in same session
|
||||
args = parser.parse_args(["-O.mode=2"])
|
||||
assert args.compilation_config == {"mode": 2}
|
||||
with pytest.raises(
|
||||
ValueError,
|
||||
match=r"replace '-O\.cudagraph_mode=NONE' with '-cc\.cudagraph_mode=NONE'",
|
||||
):
|
||||
parser.parse_args(["-O.cudagraph_mode=NONE"])
|
||||
|
||||
@@ -244,9 +244,15 @@ class FlexibleArgumentParser(ArgumentParser):
|
||||
else:
|
||||
key = pattern.sub(repl, arg, count=1)
|
||||
processed_args.append(key)
|
||||
elif arg.startswith("-O") and arg != "-O" and arg[2] != ".":
|
||||
elif arg.startswith("-O."):
|
||||
# Provide clear error for deprecated -O.* syntax
|
||||
raise ValueError(
|
||||
f"The -O.* syntax is no longer supported. "
|
||||
f"Please use -cc.* instead. "
|
||||
f"For example, replace '{arg}' with '{arg.replace('-O', '-cc', 1)}'"
|
||||
)
|
||||
elif arg.startswith("-O") and arg != "-O":
|
||||
# allow -O flag to be used without space, e.g. -O3 or -Odecode
|
||||
# -O.<...> handled later
|
||||
# also handle -O=<optimization_level> here
|
||||
optimization_level = arg[3:] if arg[2] == "=" else arg[2:]
|
||||
processed_args += ["--optimization-level", optimization_level]
|
||||
@@ -257,17 +263,6 @@ class FlexibleArgumentParser(ArgumentParser):
|
||||
):
|
||||
# Convert -O <n> to --optimization-level <n>
|
||||
processed_args.append("--optimization-level")
|
||||
elif arg.startswith("-O."):
|
||||
# Handle -O.* dotted syntax - ALL dotted syntax is deprecated
|
||||
logger.warning_once(
|
||||
"The -O.* dotted syntax for --compilation-config is "
|
||||
"deprecated and will be removed in v0.13.0 or v1.0.0"
|
||||
", whichever is earlier. Please use -cc.* instead. "
|
||||
"Example: -cc.backend=eager instead of "
|
||||
"-O.backend=eager."
|
||||
)
|
||||
converted_arg = arg.replace("-O", "-cc", 1)
|
||||
processed_args.append(converted_arg)
|
||||
else:
|
||||
processed_args.append(arg)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user