From: Christian Heller Date: Mon, 19 Aug 2024 04:46:57 +0000 (+0200) Subject: Minor params layout improvement. X-Git-Url: https://plomlompom.com/repos/%7B%7Bdb.prefix%7D%7D/static/%7B%7B%20web_path%20%7D%7D/day?a=commitdiff_plain;h=05897dbce82bcca20483bc7de1548f2cb7cb39a0;p=stable_plom Minor params layout improvement. --- diff --git a/stable.py b/stable.py index 75eddd2..be5d135 100755 --- a/stable.py +++ b/stable.py @@ -20,7 +20,7 @@ def parse_args(): parser.add_argument('-o', '--output') parser.add_argument('-p', '--prompt') parser.add_argument('-H', '--help', action='help') - parser.add_argument('-S', '--list-schedulers', action='store_true') + parser.add_argument('--list-schedulers', action='store_true') parser.add_argument('-C', '--copy-params') parser.add_argument('-P', '--model_path_prefix', default='', help='useful if -m is set from -C as mere filename') @@ -34,17 +34,16 @@ def parse_args(): help='default: 15') parser.add_argument('-q', '--quantity', default=1, type=int, help='default: 1') - parser.add_argument('-r', '--randomness_seed', default=1, type=int, + parser.add_argument('-s', '--seed', default=1, type=int, help='default: 1; if set 0, chosen randomnly') - parser.add_argument('-s', '--scheduler', default=DEFAULT_SCHEDULER, + parser.add_argument('-S', '--scheduler', default=DEFAULT_SCHEDULER, help=f'default: {DEFAULT_SCHEDULER}') parsed_args = parser.parse_args() if parsed_args.copy_params: for section in parsed_args.copy_params.split('; '): key, val = section.split(': ', maxsplit=1) key = key.lower() - key = 'randomness_seed' if key == 'seed' else key - if key in {'randomness_seed', 'height', 'width', 'n_steps'}: + if key in {'seed', 'height', 'width', 'n_steps'}: val = int(val) elif key in {'guidance'}: val = float(val) @@ -52,10 +51,10 @@ def parse_args(): prefix = f'{argv[0]}: error: ' if parsed_args.list_schedulers: required = {'model': 'm'} - prefix += 'for -S/--list-schedulers ' + prefix += 'for --list-schedulers ' else: required = {'output': 'o', 'prompt': 'p', 'model': 'm'} - prefix += 'unless calling with -H/--help or -S/--list-schedulers, ' + prefix += 'unless calling with -H/--help or --list-schedulers, ' prefix += 'requiring ' suffixes = [] for k, v in required.items(): @@ -87,7 +86,7 @@ for n in range(args.quantity): raise Exception(f'Would overwrite file: {path}') maker = ImageMaker(model_path) -start_seed = args.randomness_seed +start_seed = args.seed start_seed = start_seed if start_seed != 0 else randint(-(2**31-1), 2**31) for n in range(args.quantity): nth_seed = start_seed + n