Extract parser setup to helper function

- Allows users who `import` the scripts to examine the parser programmatically
This commit is contained in:
Robert Smieja
2023-03-20 00:06:47 -04:00
parent 432353185c
commit eb66e5ebac
23 changed files with 161 additions and 24 deletions

View File

@@ -526,7 +526,7 @@ def load_weights(file):
return emb
if __name__ == "__main__":
def setup_parser() -> argparse.ArgumentParser:
parser = argparse.ArgumentParser()
train_util.add_sd_models_arguments(parser)
@@ -565,6 +565,12 @@ if __name__ == "__main__":
help="ignore caption and use default templates for stype / キャプションは使わずデフォルトのスタイル用テンプレートで学習する",
)
return parser
if __name__ == "__main__":
parser = setup_parser()
args = parser.parse_args()
args = train_util.read_config_from_file(args, parser)