Deep Research HTML - RTX 3090 Ti 24GB 環境専用
# kohya_ss 推奨config.toml (waiIllustriousSDXL_v160用)
pretrained_model_name_or_path = "D:/models/waiIllustriousSDXL_v160.safetensors"
output_dir = "D:/lora_output"
output_name = "chara_yukinosan_v1"
[dataset]
resolution = 1024
batch_size = 2
[[dataset.subsets]]
image_dir = "D:/train_data/yukinosan"
num_repeats = 5
caption_extension = ".txt"
[network_args]
network_module = "networks.lora"
network_dim = 32
network_alpha = 16
[optimizer_args]
optimizer_type = "AdamW8bit"
learning_rate = 3e-4
unet_lr = 3e-4
text_encoder_lr = 3e-5
lr_scheduler = "cosine_with_restarts"
lr_scheduler_num_cycles = 3
lr_warmup_steps = 150
[training_args]
max_train_steps = 1500
mixed_precision = "bf16"
gradient_checkpointing = false
cache_latents = true
cache_text_encoder_outputs = true
noise_offset = 0.03
min_snr_gamma = 5.0
debiased_estimation_loss = true
clip_skip = 0
no_half_vae = true
save_every_n_steps = 100
save_last_n_steps = 20
同一キャラの価値計算:
| 手法 | 顔一貫性 | 準備コスト | VRAM | 弱点 |
|---|---|---|---|---|
| キャラLoRA(本手法) | ★★★★★ | 60分/体 | 24GB | 初期学習コスト |
| IPAdapter + FaceID | ★★★☆☆ | 5分 | 8GB | 3シーン目で崩れる |
| ControlNet Reference | ★★★☆☆ | なし | 8GB | 体型まで固定できない |
| DreamBooth | ★★★★☆ | 2〜3時間 | 24GB+ | 過学習しやすい |
| Seed固定+プロンプト固定 | ★★☆☆☆ | なし | なし | 長期量産で破綻 |
必須フラグ(忘れると品質低下):
optimizer選択:
| パラメータ | 推奨値 | 理由 | ソース |
|---|---|---|---|
| network_dim | 32 | 品質とファイルサイズのバランス | [S2][S7] |
| network_alpha | 16 (dim×0.5) | 標準比率 | [S2] |
| lr_unet | 3e-4 | キャラ特徴の強い学習 | [S1][S7] |
| lr_te | 3e-5 (unet×0.1) | TE過学習防止 | [S1][S7] |
| noise_offset | 0.03 | Illustriousベース値に合わせる | [S2][S13] |
| min_snr_gamma | 5.0 | タイムステップ重み付け最適値 | [S11][S18] |
| batch_size | 2 | 3090Ti VRAMに余裕・勾配安定 | |
| total_steps | 1500〜2000 | 収束とやり直し余裕 | [S7][S4] |
| save_every | 100steps | ベストepoch選択のため |
total_steps = 画像枚数 × num_repeats × max_epochs
例A: 20枚 × 5repeats × 15epoch = 1500steps
例B: 25枚 × 4repeats × 20epoch = 2000steps
例C: 20枚 × 3repeats × 25epoch = 1500steps
目安: 2000stepsが上限ライン。超えると過学習リスク増大。
| 項目 | 時間/コスト |
|---|---|
| データセット生成(多様性確保) | 30〜60分 |
| 画像選定・キャプション作業 | 15〜30分 |
| kohya_ss 学習実行(1500steps, batch2) | 40〜60分 |
| 検証(エポック比較・テスト) | 15〜30分 |
| 合計 1体あたり | 100〜180分(約2〜3時間) |
リスク1: スタイル固着(最大のリスク)
原因: 同一モデル・同一タグで生成すると画像が均一→スタイルが焼き込まれる
症状: LoRA適用時にwaiIllustriousの特定の「癖」まで学習してしまう
対策: 多シード(最低20 seeds)で生成 / CFG値を5〜10の範囲で変える / サンプラーをdpmpp_2m/euler/dpmpp_sdeで混ぜる / 背景を意図的に多様化
リスク2: 過学習(ポーズ固定化)
原因: 同じポーズの画像が多すぎる・steps数が多すぎる
症状: 全ての生成で同じポーズになる / トリガーなしでキャラが出る
対策: 多様なポーズ・early stopping(epoch比較で最良point選択)
リスク3: 顔崩れ(学習失敗)
原因: 学習データに崩れた顔・别キャラ混入
対策: 全素材を1024pxグリッドで目視確認してから学習
テスト1: トリガーワードなし生成
→ キャラが出てきたら: スタイル汚染=過学習
→ 通常の生成結果なら: 正常
テスト2: 学習時と全く違うプロンプト
→ 硬直した同じポーズになったら: ポーズ過学習
→ 多様な構図が出れば: 正常
テスト3: LoRA strength段階テスト (0.5 / 0.7 / 0.9 / 1.1)
→ 0.9以上でアーティファクト多発: 学習が強すぎ→epoch戻す
→ 0.7で安定: 理想的
| 日程 | タスク | 成果物 |
|---|---|---|
| Day0〜1 | fanza3_massの過去Best生成物から素材候補50枚収集 | 候補リスト |
| Day2〜3 | 多角度・多表情・多シード補完生成(不足分補強) | 70枚候補 |
| Day3 | PIL/画像グリッドで厳選→20〜25枚に絞り込み | train_data/chara/ |
| Day4 | WD14 Tagger実行→キャプション編集(固有特徴タグ除去・トリガー追加) | .txt全件 |
| Day5 | Aレシピで初回学習(1500steps, 100step毎ckpt保存) | ckpt×15本 |
| Day6 | epoch5/10/15のcheckpoint比較・品質検証3テスト実行 | best LoRA確定 |
| Day7〜9 | 第1作品でLoRA実戦投入・weight0.75〜0.85で調整 | Vol001 |
| Day10〜30 | 10作品量産(同一LoRA再利用・作品ごとに衣装/シチュ変える) | Vol001〜010 |
対象パス: D:\projects\fanza3_mass\ComfyUI\output\oudou_r18_2026-05-20\<vol>_v160
対象: 各Volのbest画像(品質ゲート通過済み = gate.json評価3.8以上)
目標: 各Volume 2〜3枚 × 10 Volume = 20〜30枚の候補
# PIL グリッド確認スクリプト例
from PIL import Image
import glob
imgs = glob.glob(r"D:\train_candidates\*.png")
grid_size = (5, 4) # 20枚グリッド
# 目視で: 同一キャラ感あるか / 顔崩れないか / 多様性あるか を確認
不足している角度・表情を追加生成(目標: 5アングル × 4表情以上)
必須確認アングル:
- 正面 / 斜め45度左 / 横 / やや上から / やや下から
必須表情:
- neutral / smile / blush / ahegao(目的がR18なら必須)
ファイル名: yukinosan_001.txt
内容例: "yukinosan, standing, smile, white background, full body"
"yukinosan, sitting, ahegao, bedroom, bust shot"
"yukinosan, lying, blush, white background, face close-up"
禁止タグ(固有特徴・キャプションに書かない):
× blonde hair / blue eyes / large breasts / default outfit name
| DR名 | 主要テーマ | 本DRとの差別化 |
|---|---|---|
| DR_lora_hyperparam_best_2026-06-02 | ハイパラ詳解・2レシピ | 本DRは少枚数・生成画像特化 |
| DR_LoRA無し一貫性最大化_応急決定版_2026-05-30 | LoRA不要の応急策 | 本DRはLoRA本命 |
| DR_LoRA学習高速化_ファクトリー効率_2026-05-31 | 最速学習 | 本DRは精度重視 |
| DR_LoRAキャラでエロ漫画化_自動パイプライン_2026-05-31 | パイプライン | 本DRは学習法詳細 |
| DR_LoRA量産高速化×一貫性_2026-06-01 | 量産効率 | 本DRは1体の品質 |
| DR_LoRA_キャラ学習失敗パターン_2026-06-02 | 失敗回避 | 本DRは正解フロー |
| DR_lora_factory_99char_architecture_2026-06-02 | 99体工場設計 | 本DRは少枚数スモール |
[S1] https://civitai.com/articles/9148/illustrious-lora-training-discussion-29052025
[S2] https://civitai.com/articles/21257/lora-training-parameters-guide-for-sdxl-illustrious-civitai-on-site-trainer
[S3] https://www.digitalcreativeai.net/en/post/original-character-lora-illustrious-character-training
[S4] https://night-dev.com/en/blog/ai-toolkit-illustrious-sdxl/
[S5] https://comfyui.nomadoor.net/en/notes/ai-toolkit-sdxl-lora-training/
[S6] https://civitai.com/models/850658/illustrious-lora-training-guide
[S7] https://www.seaart.ai/articleDetail/cvdakg5e878c73a5mbrg
[S8] https://apatero.com/blog/anime-character-consistency-complete-guide-2025
[S9] https://apatero.com/blog/training-loras-consistent-ai-influencer-characters-comfyui-2025
[S10] https://civitai.com/articles/8370/nanashianons-cool-lora-training-guide-for-attractive-people
[S11] https://civitai.com/articles/6173/demystifying-snr-min-snr-debiased-estimation-and-ip-noise-gamma
[S12] https://github.com/bmaltais/kohya_ss/discussions/3044
[S13] https://civitai.com/articles/2524/sdxl-controlling-sdxl-brightness-contrast-and-color-noise-offset-and-vectorscope
[S14] https://www.pugetsystems.com/labs/articles/stable-diffusion-lora-training-consumer-gpu-analysis/
[S15] https://apatero.com/blog/ultimate-guide-lora-training-2025
[S16] https://arxiv.org/html/2505.11703v1
[S17] https://medium.com/@guillaume.bieler/a-comprehensive-guide-to-training-a-stable-diffusion-xl-lora-optimal-settings-dataset-building-844113a6d5b3
[S18] https://huggingface.co/blog/sdxl_lora_advanced_script
[S19] https://www.viewcomfy.com/blog/detailed-LoRA-training-guide-for-Stable-Diffusion
[S20] https://github.com/kohya-ss/sd-scripts/discussions/294