mirror of
https://github.com/kohya-ss/sd-scripts.git
synced 2026-04-09 06:45:09 +00:00
fix cond image normlization, add independent LR for control
This commit is contained in:
@@ -31,6 +31,7 @@ import hashlib
|
||||
import subprocess
|
||||
from io import BytesIO
|
||||
import toml
|
||||
# from concurrent.futures import ThreadPoolExecutor, as_completed
|
||||
|
||||
from tqdm import tqdm
|
||||
|
||||
@@ -912,6 +913,23 @@ class BaseDataset(torch.utils.data.Dataset):
|
||||
if info.image_size is None:
|
||||
info.image_size = self.get_image_size(info.absolute_path)
|
||||
|
||||
# # run in parallel
|
||||
# max_workers = min(os.cpu_count(), len(self.image_data)) # TODO consider multi-gpu (processes)
|
||||
# with ThreadPoolExecutor(max_workers) as executor:
|
||||
# futures = []
|
||||
# for info in tqdm(self.image_data.values(), desc="loading image sizes"):
|
||||
# if info.image_size is None:
|
||||
# def get_and_set_image_size(info):
|
||||
# info.image_size = self.get_image_size(info.absolute_path)
|
||||
# futures.append(executor.submit(get_and_set_image_size, info))
|
||||
# # consume futures to reduce memory usage and prevent Ctrl-C hang
|
||||
# if len(futures) >= max_workers:
|
||||
# for future in futures:
|
||||
# future.result()
|
||||
# futures = []
|
||||
# for future in futures:
|
||||
# future.result()
|
||||
|
||||
if self.enable_bucket:
|
||||
logger.info("make buckets")
|
||||
else:
|
||||
@@ -1826,7 +1844,7 @@ class DreamBoothDataset(BaseDataset):
|
||||
# 画像ファイルごとにプロンプトを読み込み、もしあればそちらを使う
|
||||
captions = []
|
||||
missing_captions = []
|
||||
for img_path in img_paths:
|
||||
for img_path in tqdm(img_paths, desc="read caption"):
|
||||
cap_for_img = read_caption(img_path, subset.caption_extension, subset.enable_wildcard)
|
||||
if cap_for_img is None and subset.class_tokens is None:
|
||||
logger.warning(
|
||||
|
||||
Reference in New Issue
Block a user