Make --help output more readable

This commit is contained in:
oobabooga 2023-02-02 23:36:28 -03:00
parent 638495b633
commit 3af3ffeb90

View File

@ -23,7 +23,7 @@ from modules.stopping_criteria import _SentinelTokenStoppingCriteria
transformers.logging.set_verbosity_error() transformers.logging.set_verbosity_error()
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser(formatter_class=lambda prog: argparse.HelpFormatter(prog,max_help_position=54))
parser.add_argument('--model', type=str, help='Name of the model to load by default.') parser.add_argument('--model', type=str, help='Name of the model to load by default.')
parser.add_argument('--notebook', action='store_true', help='Launch the web UI in notebook mode, where the output is written to the same text box as the input.') parser.add_argument('--notebook', action='store_true', help='Launch the web UI in notebook mode, where the output is written to the same text box as the input.')
parser.add_argument('--chat', action='store_true', help='Launch the web UI in chat mode.') parser.add_argument('--chat', action='store_true', help='Launch the web UI in chat mode.')
@ -136,8 +136,7 @@ def load_model(model_name):
if args.disk: if args.disk:
settings.append(f"offload_folder='{args.disk_cache_dir or 'cache'}'") settings.append(f"offload_folder='{args.disk_cache_dir or 'cache'}'")
settings = ', '.join(set(settings)) command = f"{command}(Path(f'models/{model_name}'), {','.join(set(settings))})"
command = f"{command}(Path(f'models/{model_name}'), {settings})"
model = eval(command) model = eval(command)
# Loading the tokenizer # Loading the tokenizer