Skip to content

Commit

Permalink
[Misc] vllm CLI flags should be ordered for better user readability
Browse files Browse the repository at this point in the history
FIX #10016

Signed-off-by: chaunceyjiang <[email protected]>
  • Loading branch information
chaunceyjiang committed Nov 5, 2024
1 parent bbc3619 commit dad6135
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions vllm/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1148,9 +1148,23 @@ def __call__(self, parser, namespace, values, option_string=None):
"Expected 'true' or 'false'.")


class SortedHelpFormatter(argparse.HelpFormatter):
"""SortedHelpFormatter that sorts arguments by their option strings."""

def add_arguments(self, actions):
actions = sorted(actions, key=lambda x: x.option_strings)
super(SortedHelpFormatter, self).add_arguments(actions)


class FlexibleArgumentParser(argparse.ArgumentParser):
"""ArgumentParser that allows both underscore and dash in names."""

def __init__(self, *args, **kwargs):
# Set the default 'formatter_class' to SortedHelpFormatter
if 'formatter_class' not in kwargs:
kwargs['formatter_class'] = SortedHelpFormatter
super().__init__(*args, **kwargs)

def parse_args(self, args=None, namespace=None):
if args is None:
args = sys.argv[1:]
Expand Down Expand Up @@ -1214,7 +1228,7 @@ def _pull_args_from_config(self, args: List[str]) -> List[str]:
index = args.index('--config')
if index == len(args) - 1:
raise ValueError("No config file specified! \
Please check your command-line arguments.")
Please check your command-line arguments." )

Check failure on line 1231 in vllm/utils.py

View workflow job for this annotation

GitHub Actions / ruff (3.8)

Ruff (E501)

vllm/utils.py:1231:81: E501 Line too long (143 > 80)

Check failure on line 1231 in vllm/utils.py

View workflow job for this annotation

GitHub Actions / ruff (3.9)

Ruff (E501)

vllm/utils.py:1231:81: E501 Line too long (143 > 80)

Check failure on line 1231 in vllm/utils.py

View workflow job for this annotation

GitHub Actions / ruff (3.10)

Ruff (E501)

vllm/utils.py:1231:81: E501 Line too long (143 > 80)

Check failure on line 1231 in vllm/utils.py

View workflow job for this annotation

GitHub Actions / ruff (3.11)

Ruff (E501)

vllm/utils.py:1231:81: E501 Line too long (143 > 80)

Check failure on line 1231 in vllm/utils.py

View workflow job for this annotation

GitHub Actions / ruff (3.12)

Ruff (E501)

vllm/utils.py:1231:81: E501 Line too long (143 > 80)

file_path = args[index + 1]

Expand Down Expand Up @@ -1258,7 +1272,7 @@ def _load_config_file(self, file_path: str) -> List[str]:
if extension not in ('yaml', 'yml'):
raise ValueError(
"Config file must be of a yaml/yml type.\
%s supplied", extension)
%s supplied" , extension)

Check failure on line 1275 in vllm/utils.py

View workflow job for this annotation

GitHub Actions / ruff (3.8)

Ruff (E501)

vllm/utils.py:1275:81: E501 Line too long (96 > 80)

Check failure on line 1275 in vllm/utils.py

View workflow job for this annotation

GitHub Actions / ruff (3.9)

Ruff (E501)

vllm/utils.py:1275:81: E501 Line too long (96 > 80)

Check failure on line 1275 in vllm/utils.py

View workflow job for this annotation

GitHub Actions / ruff (3.10)

Ruff (E501)

vllm/utils.py:1275:81: E501 Line too long (96 > 80)

Check failure on line 1275 in vllm/utils.py

View workflow job for this annotation

GitHub Actions / ruff (3.11)

Ruff (E501)

vllm/utils.py:1275:81: E501 Line too long (96 > 80)

Check failure on line 1275 in vllm/utils.py

View workflow job for this annotation

GitHub Actions / ruff (3.12)

Ruff (E501)

vllm/utils.py:1275:81: E501 Line too long (96 > 80)

# only expecting a flat dictionary of atomic types
processed_args: List[str] = []
Expand All @@ -1270,7 +1284,7 @@ def _load_config_file(self, file_path: str) -> List[str]:
except Exception as ex:
logger.error(
"Unable to read the config file at %s. \
Make sure path is correct", file_path)
Make sure path is correct" , file_path)

Check failure on line 1287 in vllm/utils.py

View workflow job for this annotation

GitHub Actions / ruff (3.8)

Ruff (E501)

vllm/utils.py:1287:81: E501 Line too long (96 > 80)

Check failure on line 1287 in vllm/utils.py

View workflow job for this annotation

GitHub Actions / ruff (3.9)

Ruff (E501)

vllm/utils.py:1287:81: E501 Line too long (96 > 80)

Check failure on line 1287 in vllm/utils.py

View workflow job for this annotation

GitHub Actions / ruff (3.10)

Ruff (E501)

vllm/utils.py:1287:81: E501 Line too long (96 > 80)

Check failure on line 1287 in vllm/utils.py

View workflow job for this annotation

GitHub Actions / ruff (3.11)

Ruff (E501)

vllm/utils.py:1287:81: E501 Line too long (96 > 80)

Check failure on line 1287 in vllm/utils.py

View workflow job for this annotation

GitHub Actions / ruff (3.12)

Ruff (E501)

vllm/utils.py:1287:81: E501 Line too long (96 > 80)
raise ex

store_boolean_arguments = [
Expand Down

0 comments on commit dad6135

Please sign in to comment.