From b2626bc7a9d6ff68a802a161bab8b2eb13973c85 Mon Sep 17 00:00:00 2001 From: Yuta Hayashibe Date: Thu, 26 Oct 2023 00:51:17 +0900 Subject: [PATCH 1/2] Fix a typo --- finetune/prepare_buckets_latents.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/finetune/prepare_buckets_latents.py b/finetune/prepare_buckets_latents.py index af08c537..1bccb1d3 100644 --- a/finetune/prepare_buckets_latents.py +++ b/finetune/prepare_buckets_latents.py @@ -215,7 +215,7 @@ def setup_parser() -> argparse.ArgumentParser: help="max resolution in fine tuning (width,height) / fine tuning時の最大画像サイズ 「幅,高さ」(使用メモリ量に関係します)", ) parser.add_argument("--min_bucket_reso", type=int, default=256, help="minimum resolution for buckets / bucketの最小解像度") - parser.add_argument("--max_bucket_reso", type=int, default=1024, help="maximum resolution for buckets / bucketの最小解像度") + parser.add_argument("--max_bucket_reso", type=int, default=1024, help="maximum resolution for buckets / bucketの最大解像度") parser.add_argument( "--bucket_reso_steps", type=int, From 837a4dddb8a484a249c5d41478600ff5cb8e5841 Mon Sep 17 00:00:00 2001 From: Yuta Hayashibe Date: Thu, 26 Oct 2023 13:34:36 +0900 Subject: [PATCH 2/2] Added assertions --- library/train_util.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/library/train_util.py b/library/train_util.py index 51610e70..a38e7978 100644 --- a/library/train_util.py +++ b/library/train_util.py @@ -148,6 +148,13 @@ class ImageInfo: class BucketManager: def __init__(self, no_upscale, max_reso, min_size, max_size, reso_steps) -> None: + if max_size is not None: + if max_reso is not None: + assert max_size >= max_reso[0], "the max_size should be larger than the width of max_reso" + assert max_size >= max_reso[1], "the max_size should be larger than the height of max_reso" + if min_size is not None: + assert max_size >= min_size, "the max_size should be larger than the min_size" + self.no_upscale = no_upscale if max_reso is None: self.max_reso = None