Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions library/train_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -1060,6 +1060,21 @@ def make_buckets(self):
self.bucket_info["buckets"][i] = {"resolution": reso, "count": len(bucket)}
logger.info(f"bucket {i}: resolution {reso}, count: {len(bucket)}")

# Warn of any particularly small buckets compared to the current batch size
already_warned_underfilled_bucket = False
for i, bucket in enumerate(self.bucket_manager.buckets):
if len(bucket) < (self.batch_size / 2):

if not already_warned_underfilled_bucket:
logger.warning(f"These buckets have too few entries to even half fill the batch_size:")
already_warned_underfilled_bucket = True

img_filename = bucket[0]
display_filename_len = 55
if len(img_filename) > display_filename_len:
img_filename = f"...{img_filename[-(display_filename_len - 3):]}"
logger.warning(f" Bucket {self.bucket_manager.resos[i]} e.g. '{img_filename}'")

if len(img_ar_errors) == 0:
mean_img_ar_error = 0 # avoid NaN
else:
Expand Down