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

04:23:18-031107 ERROR Can't match model type from /meta/AigcPainting/ComfyUI/models/checkpoints/FLUX1/flux1-schnell.safetensors #479

Closed GFY2000 closed 2 months ago

GFY2000 commented 2 months ago

image

我在使用flux模型训练脚本时,出现了上面这个问题,请问是我参数写错了吗?该修改哪里?下面是我的参数: model_train_type = "flux-lora" pretrained_model_name_or_path = "/meta/AigcPainting/ComfyUI/models/checkpoints/FLUX1/flux1-schnell.safetensors" ae = "/meta/AigcPainting/ComfyUI/models/vae/ae.sft" clip_l = "/meta/AigcPainting/ComfyUI/models/clip/clip_l.safetensors" clip_g = "/meta/AigcPainting/ComfyUI/models/clip/clip_g.safetensors" t5xxl = "/meta/AigcPainting/ComfyUI/models/clip/t5xxl_fp8_e4m3fn.safetensors" timestep_sampling = "sigma" sigmoid_scale = 1 model_prediction_type = "raw" discrete_flow_shift = 1 loss_type = "l2" guidance_scale = 1 train_data_dir = "/meta/AigcPainting/training-data/LoRA/Brain Medical Imaging FLUX/images" prior_loss_weight = 1 resolution = "768,768" enable_bucket = true min_bucket_reso = 256 max_bucket_reso = 1024 bucket_reso_steps = 64 output_name = "Brain Medical Imaging FLUX" output_dir = "/meta/AigcPainting/training-data/LoRA/Brain Medical Imaging FLUX/models" save_model_as = "safetensors" save_precision = "fp16" save_every_n_epochs = 2 max_train_epochs = 20 train_batch_size = 1 gradient_checkpointing = false network_train_unet_only = false network_train_text_encoder_only = false learning_rate = 0.0001 unet_lr = 0.0001 text_encoder_lr = 0.00001 lr_scheduler = "cosine_with_restarts" lr_warmup_steps = 0 lr_scheduler_num_cycles = 1 optimizer_type = "PagedAdamW8bit" network_module = "networks.lora_flux" network_dim = 2 network_alpha = 16 log_with = "tensorboard" logging_dir = "/meta/AigcPainting/training-data/LoRA/Brain Medical Imaging FLUX/logs" caption_extension = ".txt" shuffle_caption = true keep_tokens = 0 max_token_length = 255 seed = 1337 clip_skip = 2 mixed_precision = "fp16" xformers = true lowram = false cache_latents = true cache_latents_to_disk = true persistent_data_loader_workers = true

rwywenyi commented 2 months ago

更新脚本即可,使用readme给的方式更新,或者重新git clone

GFY2000 commented 2 months ago

确实可以了,不过我还有一个问题,我尝试用sd3模型训练dreambooth,他报了下面这个错误,目前sd3可以训练dreambooth吗? Traceback (most recent call last): File "/meta/AigcPainting/lora-scripts/./sd-scripts/train_db.py", line 558, in train(args) File "/meta/AigcPainting/lora-scripts/./sd-scripts/train_db.py", line 131, in train text_encoder, vae, unet, load_stable_diffusion_format = train_util.load_target_model(args, weight_dtype, accelerator) File "/meta/AigcPainting/lora-scripts/sd-scripts/library/train_util.py", line 4813, in load_target_model text_encoder, vae, unet, load_stable_diffusion_format = _load_target_model( File "/meta/AigcPainting/lora-scripts/sd-scripts/library/train_util.py", line 4768, in _load_target_model text_encoder, vae, unet = model_util.load_models_from_stable_diffusion_checkpoint( File "/meta/AigcPainting/lora-scripts/sd-scripts/library/model_util.py", line 1005, in load_models_from_stable_diffusion_checkpoint converted_unet_checkpoint = convert_ldm_unet_checkpoint(v2, state_dict, unet_config) File "/meta/AigcPainting/lora-scripts/sd-scripts/library/model_util.py", line 267, in convert_ldm_unet_checkpoint new_checkpoint["time_embedding.linear_1.weight"] = unet_state_dict["time_embed.0.weight"] KeyError: 'time_embed.0.weight'

GFY2000 commented 2 months ago

更新脚本即可,使用readme给的方式更新,或者重新git clone

谢谢!

rwywenyi commented 2 months ago

确实可以了,不过我还有一个问题,我尝试用sd3模型训练dreambooth,他报了下面这个错误,目前sd3可以训练dreambooth吗? Traceback (most recent call last): File "/meta/AigcPainting/lora-scripts/./sd-scripts/train_db.py", line 558, in train(args) File "/meta/AigcPainting/lora-scripts/./sd-scripts/train_db.py", line 131, in train text_encoder, vae, unet, load_stable_diffusion_format = train_util.load_target_model(args, weight_dtype, accelerator) File "/meta/AigcPainting/lora-scripts/sd-scripts/library/train_util.py", line 4813, in load_target_model text_encoder, vae, unet, load_stable_diffusion_format = _load_target_model( File "/meta/AigcPainting/lora-scripts/sd-scripts/library/train_util.py", line 4768, in _load_target_model text_encoder, vae, unet = model_util.load_models_from_stable_diffusion_checkpoint( File "/meta/AigcPainting/lora-scripts/sd-scripts/library/model_util.py", line 1005, in load_models_from_stable_diffusion_checkpoint converted_unet_checkpoint = convert_ldm_unet_checkpoint(v2, state_dict, unet_config) File "/meta/AigcPainting/lora-scripts/sd-scripts/library/model_util.py", line 267, in convert_ldm_unet_checkpoint new_checkpoint["time_embedding.linear_1.weight"] = unet_state_dict["time_embed.0.weight"] KeyError: 'time_embed.0.weight'

不可以,目前只支持sd1.5的dream booth训练。 我最近也有训练sdxl dreambooth的需求,另外这个脚本训练flux一直没成功,感觉我要换一个脚本了

GFY2000 commented 2 months ago

确实可以了,不过我还有一个问题,我尝试用sd3模型训练dreambooth,他报了下面这个错误,目前sd3可以训练dreambooth吗? Traceback (most recent call last): File "/meta/AigcPainting/lora-scripts/./sd-scripts/train_db.py", line 558, in train(args) File "/meta/AigcPainting/lora-scripts/./sd-scripts/train_db.py", line 131, in train text_encoder, vae, unet, load_stable_diffusion_format = train_util.load_target_model(args, weight_dtype, accelerator) File "/meta/AigcPainting/lora-scripts/sd-scripts/library/train_util.py", line 4813, in load_target_model text_encoder, vae, unet, load_stable_diffusion_format = _load_target_model( File "/meta/AigcPainting/lora-scripts/sd-scripts/library/train_util.py", line 4768, in _load_target_model text_encoder, vae, unet = model_util.load_models_from_stable_diffusion_checkpoint( File "/meta/AigcPainting/lora-scripts/sd-scripts/library/model_util.py", line 1005, in load_models_from_stable_diffusion_checkpoint converted_unet_checkpoint = convert_ldm_unet_checkpoint(v2, state_dict, unet_config) File "/meta/AigcPainting/lora-scripts/sd-scripts/library/model_util.py", line 267, in convert_ldm_unet_checkpoint new_checkpoint["time_embedding.linear_1.weight"] = unet_state_dict["time_embed.0.weight"] KeyError: 'time_embed.0.weight'

不可以,目前只支持sd1.5的dream booth训练。 我最近也有训练sdxl dreambooth的需求,另外这个脚本训练flux一直没成功,感觉我要换一个脚本了

好的谢谢!