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