From 8f6fc8daa19cf673aa50f24f9d7ca8378d5fa4d6 Mon Sep 17 00:00:00 2001 From: Kohya S Date: Mon, 17 Apr 2023 21:58:55 +0900 Subject: [PATCH] add ja comment, restore arg for backward compat --- finetune/make_captions.py | 2 +- finetune/make_captions_by_git.py | 2 +- finetune/tag_images_by_wd14_tagger.py | 20 +++++++++++++------- tools/convert_diffusers20_original_sd.py | 2 +- 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/finetune/make_captions.py b/finetune/make_captions.py index 1c8df2f4..3c78fb48 100644 --- a/finetune/make_captions.py +++ b/finetune/make_captions.py @@ -154,7 +154,7 @@ def setup_parser() -> argparse.ArgumentParser: parser.add_argument("--min_length", type=int, default=5, help="min length of caption / captionの最小長") parser.add_argument('--seed', default=42, type=int, help='seed for reproducibility / 再現性を確保するための乱数seed') parser.add_argument("--debug", action="store_true", help="debug mode") - parser.add_argument("--recursive", action="store_true", help="search for images in subfolders recursively") + parser.add_argument("--recursive", action="store_true", help="search for images in subfolders recursively / サブフォルダを再帰的に検索する") return parser diff --git a/finetune/make_captions_by_git.py b/finetune/make_captions_by_git.py index 58fa4ccb..41af23dc 100644 --- a/finetune/make_captions_by_git.py +++ b/finetune/make_captions_by_git.py @@ -142,7 +142,7 @@ def setup_parser() -> argparse.ArgumentParser: parser.add_argument("--remove_words", action="store_true", help="remove like `with the words xxx` from caption / `with the words xxx`のような部分をキャプションから削除する") parser.add_argument("--debug", action="store_true", help="debug mode") - parser.add_argument("--recursive", action="store_true", help="search for images in subfolders recursively") + parser.add_argument("--recursive", action="store_true", help="search for images in subfolders recursively / サブフォルダを再帰的に検索する") return parser diff --git a/finetune/tag_images_by_wd14_tagger.py b/finetune/tag_images_by_wd14_tagger.py index efcf3fc1..fb7ed7b4 100644 --- a/finetune/tag_images_by_wd14_tagger.py +++ b/finetune/tag_images_by_wd14_tagger.py @@ -143,9 +143,9 @@ def main(args): character_tag_text += ", " + tag_name combined_tags.append(tag_name) + # 先頭のカンマを取る if len(general_tag_text) > 0: general_tag_text = general_tag_text[2:] - if len(character_tag_text) > 0: character_tag_text = character_tag_text[2:] @@ -218,18 +218,24 @@ if __name__ == '__main__': parser.add_argument("--caption_extention", type=str, default=None, help="extension of caption file (for backward compatibility) / 出力されるキャプションファイルの拡張子(スペルミスしていたのを残してあります)") parser.add_argument("--caption_extension", type=str, default=".txt", help="extension of caption file / 出力されるキャプションファイルの拡張子") - parser.add_argument("--general_threshold", type=float, default=0.35, help="threshold of confidence to add a tag for general category") - parser.add_argument("--character_threshold", type=float, default=0.35, help="threshold of confidence to add a tag for character category") - parser.add_argument("--recursive", action="store_true", help="search for images in subfolders recursively") - parser.add_argument("--remove_underscore", action="store_true", help="replace underscores with spaces in the output tags") + parser.add_argument("--thresh", type=float, default=0.35, help="threshold of confidence to add a tag / タグを追加するか判定する閾値") + parser.add_argument("--general_threshold", type=float, default=None, help="threshold of confidence to add a tag for general category, same as --thresh if omitted / generalカテゴリのタグを追加するための確信度の閾値、省略時は --thresh と同じ") + parser.add_argument("--character_threshold", type=float, default=None, help="threshold of confidence to add a tag for character category, same as --thres if omitted / characterカテゴリのタグを追加するための確信度の閾値、省略時は --thresh と同じ") + parser.add_argument("--recursive", action="store_true", help="search for images in subfolders recursively / サブフォルダを再帰的に検索する") + parser.add_argument("--remove_underscore", action="store_true", help="replace underscores with spaces in the output tags / 出力されるタグのアンダースコアをスペースに置き換える") parser.add_argument("--debug", action="store_true", help="debug mode") - parser.add_argument("--undesired_tags", type=str, default="", help="comma-separated list of undesired tags to remove from the output") - parser.add_argument('--frequency_tags', action='store_true', help='Show frequency of tags for images') + parser.add_argument("--undesired_tags", type=str, default="", help="comma-separated list of undesired tags to remove from the output / 出力から除外したいタグのカンマ区切りのリスト") + parser.add_argument('--frequency_tags', action='store_true', help='Show frequency of tags for images / 画像ごとのタグの出現頻度を表示する') args = parser.parse_args() # スペルミスしていたオプションを復元する if args.caption_extention is not None: args.caption_extension = args.caption_extention + + if args.general_threshold is None: + args.general_threshold = args.thresh + if args.character_threshold is None: + args.character_threshold = args.thresh main(args) diff --git a/tools/convert_diffusers20_original_sd.py b/tools/convert_diffusers20_original_sd.py index c33ca202..51d5f362 100644 --- a/tools/convert_diffusers20_original_sd.py +++ b/tools/convert_diffusers20_original_sd.py @@ -73,7 +73,7 @@ def setup_parser() -> argparse.ArgumentParser: parser.add_argument("--float", action='store_true', help='save as float (checkpoint only) / float(float32)形式で保存する(checkpointのみ対応)') parser.add_argument("--save_precision_as", type=str, default="no", choices=["fp16", "bf16", "float"], - help="save precision") + help="save precision, do not specify with --fp16/--bf16/--float / 保存する精度、--fp16/--bf16/--floatと併用しないでください") parser.add_argument("--epoch", type=int, default=0, help='epoch to write to checkpoint / checkpointに記録するepoch数の値') parser.add_argument("--global_step", type=int, default=0, help='global_step to write to checkpoint / checkpointに記録するglobal_stepの値')