get the base argument parser for inference scripts
()
| 5 | DEFAULT_NEGATIVE_PROMPT = 'extra digit, fewer digits, cropped, worst quality, low quality' |
| 6 | |
| 7 | def get_base_argument_parser() -> argparse.ArgumentParser: |
| 8 | """get the base argument parser for inference scripts""" |
| 9 | parser = argparse.ArgumentParser() |
| 10 | parser.add_argument( |
| 11 | '--outdir', |
| 12 | type=str, |
| 13 | help='dir to write results to', |
| 14 | default=None, |
| 15 | ) |
| 16 | |
| 17 | parser.add_argument( |
| 18 | '--prompt', |
| 19 | type=str, |
| 20 | default='', |
| 21 | help='positive prompt', |
| 22 | ) |
| 23 | |
| 24 | parser.add_argument( |
| 25 | '--neg_prompt', |
| 26 | type=str, |
| 27 | default=DEFAULT_NEGATIVE_PROMPT, |
| 28 | help='negative prompt', |
| 29 | ) |
| 30 | |
| 31 | parser.add_argument( |
| 32 | '--cond_path', |
| 33 | type=str, |
| 34 | default=None, |
| 35 | help='condition image path', |
| 36 | ) |
| 37 | |
| 38 | parser.add_argument( |
| 39 | '--cond_inp_type', |
| 40 | type=str, |
| 41 | default='image', |
| 42 | help='the type of the input condition image, take depth T2I as example, the input can be raw image, ' |
| 43 | 'which depth will be calculated, or the input can be a directly a depth map image', |
| 44 | ) |
| 45 | |
| 46 | parser.add_argument( |
| 47 | '--sampler', |
| 48 | type=str, |
| 49 | default='ddim', |
| 50 | choices=['ddim', 'plms'], |
| 51 | help='sampling algorithm, currently, only ddim and plms are supported, more are on the way', |
| 52 | ) |
| 53 | |
| 54 | parser.add_argument( |
| 55 | '--steps', |
| 56 | type=int, |
| 57 | default=50, |
| 58 | help='number of sampling steps', |
| 59 | ) |
| 60 | |
| 61 | parser.add_argument( |
| 62 | '--max_resolution', |
| 63 | type=float, |
| 64 | default=1024 * 1024, |