[Misc] vllm CLI flags should be ordered for better user readability (#10017)
Signed-off-by: chaunceyjiang <chaunceyjiang@gmail.com>
This commit is contained in:
parent
7a83b1aec0
commit
93dee88f6b
@ -1148,9 +1148,23 @@ class StoreBoolean(argparse.Action):
|
||||
"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:]
|
||||
|
||||
Loading…
Reference in New Issue
Block a user