kohya-ss / sd-scripts

Apache License 2.0
5.27k stars 876 forks source link

AssertionError: conversion failed: lora_unet_input_blocks_4_1_proj_ina #805

Open Bonoolu opened 1 year ago

Bonoolu commented 1 year ago

I tried to train a lora for sd xl, but whenever i try to use the lora with sd xl i get this error message:

stable-diffusion-webui/extensions/sd-webui-additional-networks/scripts/lora_compvis.py", line 302, in convert_diffusers_name_to_compvis
        assert cv_name is not None, f"conversion failed: {du_name}. the model may not be trained by `sd-scripts`."
               ^^^^^^^^^^^^^^^^^^^
    AssertionError: conversion failed: lora_unet_input_blocks_4_1_proj_in. the model may not be trained by `sd-scripts`.

Any Idea why? What exactly is lora_unet_input_blocks_4_1_proj_in?

I just pulled the latests commits from the sdxl branch of this repo, and of automatic1111 and of the additional networks extension.

I used this command:

accelerate launch \
 --num_cpu_threads_per_process=2 "./sdxl_train_network.py" \
 --min_bucket_reso=256 \
 --max_bucket_reso=2048 \
 --pretrained_model_name_or_path="/home/bonoolu/stable-diffusion-webui/models/Stable-diffusion/sd_xl_base_1.0.safetensors" \
 --train_data_dir="/home/bonoolu/LORA/MyModelName/image" \
 --reg_data_dir="" \
 --resolution="1024,1024" \
 --output_dir="/home/bonoolu/LORA/MyModelName/model" \
 --logging_dir="/home/bonoolu/LORA/MyModelName/log" \
 --network_alpha="1" \
 --save_model_as=safetensors \
 --network_module=networks.lora \
 --text_encoder_lr=0.0004 \
 --unet_lr=0.0004 \
 --network_dim=128 \
 --output_name="MyModelName_sdxl10" \
 --lr_scheduler_num_cycles="10" \
 --cache_text_encoder_outputs \
 --no_half_vae \
 --full_bf16 \
 --learning_rate="0.0004" \
 --lr_scheduler="constant" \
 --train_batch_size="1" \
 --max_train_steps="190" \
 --save_every_n_epochs="1" \
 --mixed_precision="bf16" \
 --save_precision="bf16" \
 --cache_latents \
 --cache_latents_to_disk \
 --optimizer_type="Adafactor" \
 --optimizer_args scale_parameter=False relative_step=False warmup_init=False \
 --max_data_loader_n_workers="0" \
 --bucket_reso_steps=64 \
 --mem_eff_attn \
 --gradient_checkpointing \
 --xformers \
 --bucket_no_upscale \
 --network_train_unet_only

GPU is RTX 3060 12GB.

Any help is much appreciated.

kohya-ss commented 1 year ago

Unfortunately sd-webui-additional-network extension doesn't support SDXL LoRA currently. Please use built-in LoRA functionality in automatic1111's Web UI.