stablediffusion吧 关注:25,115贴子:81,968
  • 30回复贴,共1

使用kohya训练lora模型报错

只看楼主收藏回复

尝试使用kohya训练lora模型,但根据视频设好所有参数运行就报错,有没有用过的大神指教一下:
Loading config...
Folder 100_RosieLily: 14100 steps
max_train_steps = 14100
stop_text_encoder_training = 0
lr_warmup_steps = 0
accelerate launch --num_cpu_threads_per_process=2 "train_network.py" --pretrained_model_name_or_path="runwayml/stable-diffusion-v1-5" --train_data_dir="D:/AI/trainmodels/RosieLily/image" --resolution=512,512 --output_dir="D:/AI/trainmodels/RosieLily/model" --logging_dir="D:/AI/trainmodels/RosieLily/log" --network_alpha="128" --save_model_as=safetensors --network_module=networks.lora --text_encoder_lr=5e-5 --unet_lr=0.0001 --network_dim=128 --output_name="RosieLily" --lr_scheduler_num_cycles="1" --learning_rate="0.0001" --lr_scheduler="constant" --train_batch_size="1" --max_train_steps="14100" --save_every_n_epochs="1" --mixed_precision="fp16" --save_precision="fp16" --seed="1234" --caption_extension=".txt" --cache_latents --optimizer_type="AdamW8bit" --max_data_loader_n_workers="1" --clip_skip=2 --bucket_reso_steps=64 --mem_eff_attn --gradient_checkpointing --xformers --bucket_no_upscale
prepare tokenizer
Use DreamBooth method.
prepare images.
found directory D:\AI\trainmodels\RosieLily\image\100_RosieLily contains 141 image files
14100 train images with repeating.
0 reg images.
no regularization images / 正則化画像が見つかりませんでした
[Dataset 0]
batch_size: 1
resolution: (512, 512)
enable_bucket: False
[Subset 0 of Dataset 0]
image_dir: "D:\AI\trainmodels\RosieLily\image\100_RosieLily"
image_count: 141
num_repeats: 100
shuffle_caption: False
keep_tokens: 0
caption_dropout_rate: 0.0
caption_dropout_every_n_epoches: 0
caption_tag_dropout_rate: 0.0
color_aug: False
flip_aug: False
face_crop_aug_range: None
random_crop: False
is_reg: False
class_tokens: RosieLily
caption_extension: .txt
[Dataset 0]
loading image sizes.
100%|███████████████████████████████████████████████████████████████████████████████| 141/141 [00:00<00:00, 941.26it/s]
prepare dataset
prepare accelerator
Using accelerator 0.15.0 or above.
load Diffusers pretrained models
text_encoder\model.safetensors not found
Fetching 19 files: 0%| | 0/19 [00:00<?, ?it/s]D:\AI\kohya_ss\venv\lib\site-packages\huggingface_hub\file_download.py:129: UserWarning: `huggingface_hub` cache-system uses symlinks by default to efficiently store duplicated files but your machine does not support them in C:\Users\13527\.cache\huggingface\diffusers. Caching files will still work but in a degraded version that might require more space on your disk. This warning can be disabled by setting the `HF_HUB_DISABLE_SYMLINKS_WARNING` environment variable. For more details, see https://huggingface.co/docs/huggingface_hub/how-to-cache#limitations.
To support symlinks on Windows, you either need to activate Developer Mode or to run Python as an administrator. In order to see activate developer mode, see this article: https://docs.microsoft.com/en-us/windows/apps/get-started/enable-your-device-for-development
warnings.warn(message)
Fetching 19 files: 0%| | 0/19 [00:01<?, ?it/s]
model is not found as a file or in Hugging Face, perhaps file name is wrong? / 指定したモデル名のファイル、またはHugging Faceのモデルが見つかりません。ファイル名が誤っているかもしれません: runwayml/stable-diffusion-v1-5
Traceback (most recent call last):
File "D:\AI\kohya_ss\train_network.py", line 652, in <module>
train(args)
File "D:\AI\kohya_ss\train_network.py", line 114, in train
text_encoder, vae, unet, _ = train_util.load_target_model(args, weight_dtype)
File "D:\AI\kohya_ss\library\train_util.py", line 2024, in load_target_model
text_encoder = pipe.text_encoder
UnboundLocalError: local variable 'pipe' referenced before assignment
Traceback (most recent call last):
File "C:\Users\13527\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\13527\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "D:\AI\kohya_ss\venv\Scripts\accelerate.exe\__main__.py", line 7, in <module>
File "D:\AI\kohya_ss\venv\lib\site-packages\accelerate\commands\accelerate_cli.py", line 45, in main
args.func(args)
File "D:\AI\kohya_ss\venv\lib\site-packages\accelerate\commands\launch.py", line 1104, in launch_command
simple_launcher(args)
File "D:\AI\kohya_ss\venv\lib\site-packages\accelerate\commands\launch.py", line 567, in simple_launcher
raise subprocess.CalledProcessError(returncode=process.returncode, cmd=cmd)
subprocess.CalledProcessError: Command '['D:\\AI\\kohya_ss\\venv\\Scripts\\python.exe', 'train_network.py', '--pretrained_model_name_or_path=runwayml/stable-diffusion-v1-5', '--train_data_dir=D:/AI/trainmodels/RosieLily/image', '--resolution=512,512', '--output_dir=D:/AI/trainmodels/RosieLily/model', '--logging_dir=D:/AI/trainmodels/RosieLily/log', '--network_alpha=128', '--save_model_as=safetensors', '--network_module=networks.lora', '--text_encoder_lr=5e-5', '--unet_lr=0.0001', '--network_dim=128', '--output_name=RosieLily', '--lr_scheduler_num_cycles=1', '--learning_rate=0.0001', '--lr_scheduler=constant', '--train_batch_size=1', '--max_train_steps=14100', '--save_every_n_epochs=1', '--mixed_precision=fp16', '--save_precision=fp16', '--seed=1234', '--caption_extension=.txt', '--cache_latents', '--optimizer_type=AdamW8bit', '--max_data_loader_n_workers=1', '--clip_skip=2', '--bucket_reso_steps=64', '--mem_eff_attn', '--gradient_checkpointing', '--xformers', '--bucket_no_upscale']' returned non-zero exit status 1.


IP属地:广东1楼2023-03-14 00:09回复
    解决了吗。楼主


    IP属地:浙江2楼2023-03-15 20:38
    收起回复
      一样的问题!哎。。。


      IP属地:广东3楼2023-03-22 01:40
      回复
        什么显卡,显卡内存多少,内存多少,虚拟内存多少


        IP属地:广东4楼2023-03-22 13:03
        收起回复
          解决了吗?我也这样


          IP属地:上海5楼2023-03-26 20:18
          回复
            model is not found as a file or in Hugging Face, perhaps file name is wrong?
            这句话告诉你了,没有选择大模型,你需要手动选择大模型


            IP属地:广东6楼2023-03-27 13:04
            回复
              而且你是141的图片,文件开头100,训练太多了,建议人物5000步就行,太多步数没啥用,反而容易过拟合,或者batch_size: 设置成2也还行,512*512出来的质量一般,建议768*768,不高于1024就还行


              IP属地:广东7楼2023-03-27 13:06
              收起回复
                lora的主页上选第二个页面训练,也就是dreambooth rola,如果你选了dreambooth那一页就会报这个错。


                IP属地:浙江8楼2023-03-28 22:06
                回复
                  哥们,找到解决办法没有,我也这样


                  IP属地:广东10楼2023-03-31 17:20
                  回复
                    用炼丹炉 傻瓜式的


                    IP属地:贵州来自Android客户端13楼2023-06-12 01:24
                    回复
                      模型地址的不要带双引号


                      IP属地:甘肃14楼2023-09-24 15:00
                      回复
                        解决了吗CY,用的sd1.5.不知道为什么突然就这个问题了。重装了kohyass也没解决


                        IP属地:广东15楼2023-10-18 23:13
                        回复
                          1.1的步骤要做两边,显示一长串代码的是错误的,显示几行的才行,如下图
                          4.1的步骤不要点,主要功能是清除train_data目录内上一次生成模型时解压的图片的。


                          IP属地:上海16楼2023-10-29 14:32
                          回复
                            model is not found as a file or in Hugging Face 挂个梯子再试一次就行了


                            IP属地:北京17楼2024-03-15 17:15
                            收起回复