mirror of
https://github.com/kohya-ss/sd-scripts.git
synced 2026-04-08 22:35:09 +00:00
disable weighted captions in TI/XTI training
This commit is contained in:
@@ -18,19 +18,20 @@ def apply_snr_weight(loss, timesteps, noise_scheduler, gamma):
|
|||||||
return loss
|
return loss
|
||||||
|
|
||||||
|
|
||||||
def add_custom_train_arguments(parser: argparse.ArgumentParser):
|
def add_custom_train_arguments(parser: argparse.ArgumentParser, support_weighted_captions: bool = True):
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--min_snr_gamma",
|
"--min_snr_gamma",
|
||||||
type=float,
|
type=float,
|
||||||
default=None,
|
default=None,
|
||||||
help="gamma for reducing the weight of high loss timesteps. Lower numbers have stronger effect. 5 is recommended by paper. / 低いタイムステップでの高いlossに対して重みを減らすためのgamma値、低いほど効果が強く、論文では5が推奨",
|
help="gamma for reducing the weight of high loss timesteps. Lower numbers have stronger effect. 5 is recommended by paper. / 低いタイムステップでの高いlossに対して重みを減らすためのgamma値、低いほど効果が強く、論文では5が推奨",
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
if support_weighted_captions:
|
||||||
"--weighted_captions",
|
parser.add_argument(
|
||||||
action="store_true",
|
"--weighted_captions",
|
||||||
default=False,
|
action="store_true",
|
||||||
help="Enable weighted captions in the standard style (token:1.3). No commas inside parens, or shuffle/dropout may break the decoder.",
|
default=False,
|
||||||
)
|
help="Enable weighted captions in the standard style (token:1.3). No commas inside parens, or shuffle/dropout may break the decoder. / 「[token]」、「(token)」「(token:1.3)」のような重み付きキャプションを有効にする。カンマを括弧内に入れるとシャッフルやdropoutで重みづけがおかしくなるので注意",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
re_attention = re.compile(
|
re_attention = re.compile(
|
||||||
|
|||||||
@@ -549,7 +549,7 @@ def setup_parser() -> argparse.ArgumentParser:
|
|||||||
train_util.add_training_arguments(parser, True)
|
train_util.add_training_arguments(parser, True)
|
||||||
train_util.add_optimizer_arguments(parser)
|
train_util.add_optimizer_arguments(parser)
|
||||||
config_util.add_config_arguments(parser)
|
config_util.add_config_arguments(parser)
|
||||||
custom_train_functions.add_custom_train_arguments(parser)
|
custom_train_functions.add_custom_train_arguments(parser, False)
|
||||||
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--save_model_as",
|
"--save_model_as",
|
||||||
|
|||||||
@@ -603,7 +603,7 @@ def setup_parser() -> argparse.ArgumentParser:
|
|||||||
train_util.add_training_arguments(parser, True)
|
train_util.add_training_arguments(parser, True)
|
||||||
train_util.add_optimizer_arguments(parser)
|
train_util.add_optimizer_arguments(parser)
|
||||||
config_util.add_config_arguments(parser)
|
config_util.add_config_arguments(parser)
|
||||||
custom_train_functions.add_custom_train_arguments(parser)
|
custom_train_functions.add_custom_train_arguments(parser, False)
|
||||||
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--save_model_as",
|
"--save_model_as",
|
||||||
|
|||||||
Reference in New Issue
Block a user