Skip to content

Commit

Permalink
disable sample_every_n_xxx if value less than 1 ref kohya-ss#1202
Browse files Browse the repository at this point in the history
  • Loading branch information
kohya-ss committed Mar 24, 2024
1 parent f4a4c11 commit 79d1c12
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion library/train_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -1473,7 +1473,7 @@ def read_caption(img_path, caption_extension, enable_wildcard):
raise e
assert len(lines) > 0, f"caption file is empty / キャプションファイルが空です: {cap_path}"
if enable_wildcard:
caption = "\n".join([line.strip() for line in lines if line.strip() != ""]) # 空行を除く、改行で連結
caption = "\n".join([line.strip() for line in lines if line.strip() != ""]) # 空行を除く、改行で連結
else:
caption = lines[0].strip()
break
Expand Down Expand Up @@ -3338,6 +3338,18 @@ def verify_training_args(args: argparse.Namespace):
+ " / zero_terminal_snrが有効ですが、v_parameterizationが有効ではありません。学習結果は想定外になる可能性があります"
)

if args.sample_every_n_epochs is not None and args.sample_every_n_epochs <= 0:
logger.warning(
"sample_every_n_epochs is less than or equal to 0, so it will be disabled / sample_every_n_epochsに0以下の値が指定されたため無効になります"
)
args.sample_every_n_epochs = None

if args.sample_every_n_steps is not None and args.sample_every_n_steps <= 0:
logger.warning(
"sample_every_n_steps is less than or equal to 0, so it will be disabled / sample_every_n_stepsに0以下の値が指定されたため無効になります"
)
args.sample_every_n_steps = None


def add_dataset_arguments(
parser: argparse.ArgumentParser, support_dreambooth: bool, support_caption: bool, support_caption_dropout: bool
Expand Down

0 comments on commit 79d1c12

Please sign in to comment.