Akegarasu / lora-scripts

LoRA & Dreambooth training scripts & GUI use kohya-ss's trainer, for diffusion model.
GNU Affero General Public License v3.0
4.58k stars 565 forks source link

怎么样使用 resume 与我遇到关于 resume 参数的报错 #464

Closed x3fang closed 2 months ago

x3fang commented 3 months ago

我开启了 save_state 但当我想从某个状态继续训练时,我收到了报错:

Traceback (most recent call last):
  File "E:\lora-scripts-v1.8.5\sd-scripts\train_network.py", line 1242, in <module>
    trainer.train(args)
  File "E:\lora-scripts-v1.8.5\sd-scripts\train_network.py", line 539, in train
    train_util.resume_from_local_or_hf_if_specified(accelerator, args)
  File "E:\lora-scripts-v1.8.5\sd-scripts\library\train_util.py", line 3946, in resume_from_local_or_hf_if_specified
    accelerator.load_state(args.resume)
  File "E:\lora-scripts-v1.8.5\python\lib\site-packages\accelerate\accelerator.py", line 2790, in load_state
    raise ValueError(f"Tried to find {input_dir} but folder does not exist")
ValueError: Tried to find E:/lora-scripts-v1.8.5/output/SilverWolf-000001-state/model.safetensors but folder does not `exist`

我该怎么做? 这是我的配置:

model_train_type = "sd-lora"
pretrained_model_name_or_path = "E:/ai/models/Stable-diffusion/final-pruned.ckpt"
resume = "E:/lora-scripts-v1.8.5/output/SilverWolf-000001-state/model.safetensors"
v2 = false
train_data_dir = "E:/in/png"
prior_loss_weight = 1
resolution = "512,512"
enable_bucket = true
min_bucket_reso = 256
max_bucket_reso = 1024
bucket_reso_steps = 64
output_name = "SilverWolf"
output_dir = "./output"
save_model_as = "safetensors"
save_precision = "float"
save_every_n_epochs = 1
save_state = true
max_train_epochs = 50
train_batch_size = 3
gradient_checkpointing = true
network_train_unet_only = false
network_train_text_encoder_only = false
learning_rate = 0.000009375
unet_lr = 0.000009375
text_encoder_lr = 0.0000046875
lr_scheduler = "cosine_with_restarts"
lr_warmup_steps = 1448
lr_scheduler_num_cycles = 3
optimizer_type = "Lion"
min_snr_gamma = 5
network_module = "lycoris.kohya"
network_dim = 64
network_alpha = 32
network_dropout = 0.3
sample_prompts = "SilverWolf, (masterpiece, best quality:1.2), 1girl, solo, --n lowres, bad anatomy, bad hands, text, error, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality, normal quality, jpeg artifacts,signature, watermark, username, blurry,  --w 512  --h 768  --l 7  --s 24  --d 1337"
sample_sampler = "dpm_2_a"
sample_every_n_epochs = 3
log_with = "tensorboard"
logging_dir = "./logs"
caption_extension = ".txt"
shuffle_caption = true
keep_tokens = 1
max_token_length = 255
seed = 1337
clip_skip = 2
mixed_precision = "no"
xformers = true
lowram = false
cache_latents = true
cache_latents_to_disk = true
persistent_data_loader_workers = true
network_args = [ "conv_dim=64", "conv_alpha=32", "dropout=0.2", "algo=locon" ]
HelloWarcraft commented 3 months ago

第3行和第5行改为: resume = "E:/lora-scripts-v1.8.5/output/SilverWolf-000001-state" train_data_dir = "E:/in"