Skip to content

Commit

Permalink
Merge pull request #898 from shirayu/update_repare_buckets_latents
Browse files Browse the repository at this point in the history
Fix a typo and add assertions in making buckets
  • Loading branch information
kohya-ss authored Oct 29, 2023
2 parents 1cefb2a + 837a4dd commit fb97a7a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion finetune/prepare_buckets_latents.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
7 changes: 7 additions & 0 deletions library/train_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,13 @@ def __init__(self, image_key: str, num_repeats: int, caption: str, is_reg: bool,

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
Expand Down

0 comments on commit fb97a7a

Please sign in to comment.