mirror of
https://github.com/kohya-ss/sd-scripts.git
synced 2026-04-09 06:45:09 +00:00
fix to work with dreambooth ds without toml
This commit is contained in:
@@ -41,6 +41,7 @@ def train(args):
|
|||||||
), "cache_text_encoder_outputs is not supported when training text encoder / text encoderを学習するときはcache_text_encoder_outputsはサポートされていません"
|
), "cache_text_encoder_outputs is not supported when training text encoder / text encoderを学習するときはcache_text_encoder_outputsはサポートされていません"
|
||||||
|
|
||||||
cache_latents = args.cache_latents
|
cache_latents = args.cache_latents
|
||||||
|
use_dreambooth_method = args.in_json is None
|
||||||
|
|
||||||
if args.seed is not None:
|
if args.seed is not None:
|
||||||
set_seed(args.seed) # 乱数系列を初期化する
|
set_seed(args.seed) # 乱数系列を初期化する
|
||||||
@@ -61,18 +62,31 @@ def train(args):
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
user_config = {
|
if use_dreambooth_method:
|
||||||
"datasets": [
|
print("Using DreamBooth method.")
|
||||||
{
|
user_config = {
|
||||||
"subsets": [
|
"datasets": [
|
||||||
{
|
{
|
||||||
"image_dir": args.train_data_dir,
|
"subsets": config_util.generate_dreambooth_subsets_config_by_subdirs(
|
||||||
"metadata_file": args.in_json,
|
args.train_data_dir, args.reg_data_dir
|
||||||
}
|
)
|
||||||
]
|
}
|
||||||
}
|
]
|
||||||
]
|
}
|
||||||
}
|
else:
|
||||||
|
print("Training with captions.")
|
||||||
|
user_config = {
|
||||||
|
"datasets": [
|
||||||
|
{
|
||||||
|
"subsets": [
|
||||||
|
{
|
||||||
|
"image_dir": args.train_data_dir,
|
||||||
|
"metadata_file": args.in_json,
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
blueprint = blueprint_generator.generate(user_config, args, tokenizer=[tokenizer1, tokenizer2])
|
blueprint = blueprint_generator.generate(user_config, args, tokenizer=[tokenizer1, tokenizer2])
|
||||||
train_dataset_group = config_util.generate_dataset_group_by_blueprint(blueprint.dataset_group)
|
train_dataset_group = config_util.generate_dataset_group_by_blueprint(blueprint.dataset_group)
|
||||||
|
|||||||
Reference in New Issue
Block a user