學習筆記 | 訓練自己樣子的LoRA模型

準備清單


-下載 Stable Diffusion WebUI

https://github.com/AUTOMATIC1111/stable-diffusion-webui

-下載 Kohya's GUI

https://github.com/bmaltais/kohya_ss

- 20-30張照片 (挑畫質較高和不同角度,效果會更好)



1. 開啟 Stable Diffusion WebUI

訓練>圖片預處理

選擇照片位置和輸出位置

開啟Deepbooru, 按"預處理"


處理好的圖片整理到一個子目錄 [100_模型名稱]


開啟 Kohya's GUI

>Dreambooth LoRA

Configuration file: 載入快速設定檔案(LoraBasicSettings.json)

可參考複製以下文字,修改目錄路徑和輸出路徑, 儲存成 LoraBasicSettings.json

{
    "pretrained_model_name_or_path": "runwayml/stable-diffusion-v1-5",
    "v2": false,
    "v_parameterization": false,
    "logging_dir": "",
    "train_data_dir": "目錄路徑",
    "reg_data_dir": "",
    "output_dir": "輸出
路徑",
    "max_resolution": "512,512",
    "learning_rate": "0.0001",
    "lr_scheduler": "constant",
    "lr_warmup": "0",
    "train_batch_size": 2,
    "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": true,
    "xformers": true,
    "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": "Addams",
    "model_list": "runwayml/stable-diffusion-v1-5",
    "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": ""
}


一些結果





CheckPoint: chilloutmix-Ni

Prompts參考

<lora:EC:0.7> ,(((masterpiece))), ((best quality)), (ultra-detailed),8k,1girl, solo, upper body, (smile), open mouth,long hair, ringed eyes,looking at viewer,(detailed eyes), detailed nose, detailed mouth,(elf ear),detailed skin, cinematic lighting, dynamic angle, sunshine, blue sky, seaview,beach, happy,white dress

EasyNegative, (worst quality:2), (low quality:2), paintings, sketches,skin spots, acnes, skin blemishes, age spot, glans,extra fingers,fewer fingers,strange fingers,bad hand,collapsed eyeshadow,multiple eyebrows,brightness,huge breast,bad anatomy


參考來源

https://ivonblog.com/posts/windows-stable-diffusion-webui/

https://mnya.tw/cc/word/1940.html

https://mnya.tw/cc/word/1948.html

沒有留言: