Merge branch 'dev' into sd3

This commit is contained in:
kohya-ss
2024-08-13 21:00:44 +09:00
3 changed files with 16 additions and 12 deletions

View File

@@ -648,7 +648,7 @@ masterpiece, best quality, 1boy, in business suit, standing at street, looking b
詳細については各自お調べください。 詳細については各自お調べください。
任意のスケジューラを使う場合、任意のオプティマイザと同様に、`--scheduler_args`でオプション引数を指定してください。 任意のスケジューラを使う場合、任意のオプティマイザと同様に、`--lr_scheduler_args`でオプション引数を指定してください。
### オプティマイザの指定について ### オプティマイザの指定について

View File

@@ -582,7 +582,7 @@ masterpiece, best quality, 1boy, in business suit, standing at street, looking b
有关详细信息,请自行研究。 有关详细信息,请自行研究。
要使用任何调度程序,请像使用任何优化器一样使用“--scheduler_args”指定可选参数。 要使用任何调度程序,请像使用任何优化器一样使用“--lr_scheduler_args”指定可选参数。
### 关于指定优化器 ### 关于指定优化器
使用 --optimizer_args 选项指定优化器选项参数。可以以key=value的格式指定多个值。此外您可以指定多个值以逗号分隔。例如要指定 AdamW 优化器的参数,``--optimizer_args weight_decay=0.01 betas=.9,.999``。 使用 --optimizer_args 选项指定优化器选项参数。可以以key=value的格式指定多个值。此外您可以指定多个值以逗号分隔。例如要指定 AdamW 优化器的参数,``--optimizer_args weight_decay=0.01 betas=.9,.999``。

View File

@@ -2638,16 +2638,20 @@ def load_arbitrary_dataset(args, tokenizer) -> MinimalDataset:
return train_dataset_group return train_dataset_group
def load_image(image_path, alpha=False): def load_image(image_path, alpha=False):
image = Image.open(image_path) try:
if alpha: with Image.open(image_path) as image:
if not image.mode == "RGBA": if alpha:
image = image.convert("RGBA") if not image.mode == "RGBA":
else: image = image.convert("RGBA")
if not image.mode == "RGB": else:
image = image.convert("RGB") if not image.mode == "RGB":
img = np.array(image, np.uint8) image = image.convert("RGB")
return img img = np.array(image, np.uint8)
return img
except (IOError, OSError) as e:
logger.error(f"Error loading file: {image_path}")
raise e
# 画像を読み込む。戻り値はnumpy.ndarray,(original width, original height),(crop left, crop top, crop right, crop bottom) # 画像を読み込む。戻り値はnumpy.ndarray,(original width, original height),(crop left, crop top, crop right, crop bottom)