@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / 93dee88f6b
Fork 0

A high-throughput and memory-efficient inference and serving engine for LLMs

Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git

Synced Nov 16, 08:15 UTC

[Misc] vllm CLI flags should be ordered for better user readability (#10017)

Signed-off-by: chaunceyjiang <chaunceyjiang@gmail.com>

Chauncey committed Nov 5, 2024 at 18:59 UTC 93dee88f6b0ff28c2e8b79d638b4e56d58128927
1 file changed +14
vllm/utils.py
+14
@@ -1148,9 +1148,23 @@ class StoreBoolean(argparse.Action):
1148 "Expected 'true' or 'false'.")
1149
1150
1151 +class SortedHelpFormatter(argparse.HelpFormatter):
1152 + """SortedHelpFormatter that sorts arguments by their option strings."""
1153 +
1154 + def add_arguments(self, actions):
1155 + actions = sorted(actions, key=lambda x: x.option_strings)
1156 + super(SortedHelpFormatter, self).add_arguments(actions)
1157 +
1158 +
1159 class FlexibleArgumentParser(argparse.ArgumentParser):
1160 """ArgumentParser that allows both underscore and dash in names."""
1161
1162 + def __init__(self, *args, **kwargs):
1163 + # Set the default 'formatter_class' to SortedHelpFormatter
1164 + if 'formatter_class' not in kwargs:
1165 + kwargs['formatter_class'] = SortedHelpFormatter
1166 + super().__init__(*args, **kwargs)
1167 +
1168 def parse_args(self, args=None, namespace=None):
1169 if args is None:
1170 args = sys.argv[1:]