stable diffusion SD 5090 訓練 lora 方式

訓練方式參考:

Stable Diffusion web UI x Kohya’s GUI:訓練 LoRA 模型教學,快速上手最流行的 AI 繪圖訓練方式!

使用 5090 的夥伴們 要注意這些事項

kohya_ss 安裝前準備

參考資料 https://github.com/bmaltais/kohya_ss?tab=readme-ov-file#windows

Windows 先決條件若要在 Windows 系統上安裝必要的依賴項,請依照下列步驟操作:

  1. 安裝Python 3.10.11

    • 在安裝過程中,請確保選擇將 Python 新增至「PATH」環境變數的選項。
  2. 安裝CUDA 12.4 工具包

  3. 安裝Git

  4. 安裝Visual Studio 2015、2017、2019 和 2022 可再發行版本

 

1. SD 圖片預訓練:

chromesun on Dec 27, 2023
On the announcement for v1.7.0:
#14322
it says “remove Train->Preprocessing tab and put all its functionality into Extras tab”. On my installation I’m seeing stuff like “Caption” and “Create flipped copies” in the Extras tab.

它說「刪除 Train->Preprocessing 標籤並將其所有功能放入 Extras 選項卡」。在我的安裝中,我在「附加功能」標籤中看到了「標題」和「建立翻轉副本」之類的內容。

2. 準備好的圖片 使用 kohya_ss 開始訓練

* 須注意 Use 8bit adam 跟 Use xformers 這兩個 5090不能開

提供參考設定 5090 的 LoraBasicSettings.json

{
"pretrained_model_name_or_path": "D:/ai/stable-diffusion-webui/models/Stable-diffusion/RealisticRoriMix_v1.0.ckpt",
"v2": false,
"v_parameterization": false,
"logging_dir": "",
"train_data_dir": "D:/ai/wraith/destination/image",
"reg_data_dir": "",
"output_dir": "D:/ai/wraith/model",
"max_resolution": "512,512",
"learning_rate": "0.0001",
"lr_scheduler": "constant",
"lr_warmup": "0",
"train_batch_size": 1,
"epoch": "1",
"save_every_n_epochs": "1",
"mixed_precision": "fp16",
"save_precision": "fp16",
"seed": "1234",
"num_cpu_threads_per_process": 2,
"cache_latents": true,
"caption_extension": ".txt",
"enable_bucket": false,
"gradient_checkpointing": false,
"full_fp16": false,
"no_token_padding": false,
"stop_text_encoder_training": 0,
"use_8bit_adam": false,
"xformers": false,
"save_model_as": "safetensors",
"shuffle_caption": false,
"save_state": false,
"resume": "",
"prior_loss_weight": 1.0,
"text_encoder_lr": "5e-5",
"unet_lr": "0.0001",
"network_dim": 128,
"lora_network_weights": "",
"color_aug": false,
"flip_aug": false,
"clip_skip": 2,
"gradient_accumulation_steps": 1.0,
"mem_eff_attn": false,
"output_name": "output_name",
"model_list": "custom",
"max_token_length": "75",
"max_train_epochs": "",
"max_data_loader_n_workers": "1",
"network_alpha": 128,
"training_comment": "",
"keep_tokens": "0",
"lr_scheduler_num_cycles": "",
"lr_scheduler_power": "",
"persistent_data_loader_workers": false,
"bucket_no_upscale": true,
"random_crop": false,
"bucket_reso_steps": 64.0,
"caption_dropout_every_n_epochs": 0.0,
"caption_dropout_rate": 0,
"optimizer": "AdamW",
"optimizer_args": "",
"noise_offset": ""
}

 

參考資料:

Stable Diffusion web UI x Kohya’s GUI:訓練 LoRA 模型教學,快速上手最流行的 AI 繪圖訓練方式!

https://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/14440?fbclid=IwZXh0bgNhZW0CMTAAAR1lxIiewEYr1DOK9EHp6JJtYtPjwJq0TlzKTUHuavl51JfgjLYpIbE-6Nw_aem_Af7aZnZfkxs3IPq5Y8z57w

https://github.com/bmaltais/kohya_ss?tab=readme-ov-file#windows

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *