Text-to-Image
Diffusers
lora
distillation
anime
anima
darask0 commited on
Commit
3fa9343
·
verified ·
1 Parent(s): 499114a

Upload pcm/README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. pcm/README.md +50 -16
pcm/README.md CHANGED
@@ -13,20 +13,30 @@ library_name: diffusers
13
 
14
  # Anima v1.0 — PCM 4-step Distillation LoRA
15
 
16
- Phased Consistency Model (PCM) 蒸留 LoRA for [Anima v1.0 base](https://huggingface.co/circlestone-labs/Anima).
 
17
 
18
- 4-step / CFG=1.0 teacher (20-step CFG=4.5) と近い品質を狙う
 
 
 
 
 
 
 
 
 
19
 
20
  ## Files
21
 
22
  | File | Format | Use |
23
  |---|---|---|
24
- | `pcm_final_peft.safetensors` | PEFT (diffusers) | `peft` / 自前 inference スクリプト |
25
- | `pcm_final_comfy.safetensors` | ComfyUI LoRA | ComfyUI / sd-scripts 互換 LoRA ローダー |
26
 
27
  両者は同一の重み、フォーマット変換のみの違い。
28
 
29
- ## Usage (ComfyUI)
30
 
31
  1. `pcm_final_comfy.safetensors` を `ComfyUI/models/loras/` に配置
32
  2. Anima v1.0 base workflow に `LoraLoaderModelOnly` を挿入、`strength_model: 1.0`
@@ -35,16 +45,14 @@ Phased Consistency Model (PCM) 蒸留 LoRA for [Anima v1.0 base](https://hugging
35
  - **cfg: 1.0**
36
  - sampler / scheduler: 下記サンプル比較を参照
37
 
38
- ## Recommended Sampler
39
-
40
- 訓練後 step 3500-4000 で複数 sampler を比較済み:
41
 
42
  | Sampler | Scheduler | 特徴 |
43
  |---|---|---|
44
  | `er_sde` | `simple` | やや softer、構図上半身寄り、生成 8.8s |
45
  | `res_multistep` | `beta` | anime style 強め、全身描画、生成 11.2s |
46
 
47
- 両者とも 4-step CFG=1.0 で破綻なく動作。`er_sde + simple` trainable distribution に最も近く`res_multistep + beta` visual style がやや強調される。
48
 
49
  ### サンプル比較
50
 
@@ -74,9 +82,10 @@ Phased Consistency Model (PCM) 蒸留 LoRA for [Anima v1.0 base](https://hugging
74
  | Loss | Pseudo-Huber |
75
  | Optimizer | AdamW (lr 5e-6, wd 0.01) |
76
  | Grad clip | 1.0 |
 
77
  | Hardware | NVIDIA B200 (1 GPU) |
78
  | Training time | ~3.4 hours |
79
- | Cost | ~$18-22 (Modal) |
80
 
81
  ### Dataset
82
 
@@ -85,24 +94,49 @@ Anima v1.0 self-distillation cache (5000 caption × teacher x0 + crossattn embed
85
  - Caption pool: 10 prompts × 500 seeds, anime characters + scene
86
  - Precompute cost: ~$7-8 (B200, ~86 min)
87
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
88
  ## Limitations
89
 
90
- - **Base model 固定**: Anima v1.0 base 以外 (preview3、Civitai mix 等) では style drift が起こる
91
- - **Caption distribution narrow**: 10 prompt × 500 seed = 1500 unique seed pattern。データセットに含まれない構図 (大規模群衆、複雑な手指ポーズ等)teacher より退化することがある
92
- - **4-step ハード制約**: 2 step 8 step では同品質保証い (PCM は phase 端点で学習、N=50/K=4 で 4-step 想定)
93
- - **CFG=1.0 推奨**: 訓練時に CFG-aug w∈[4.0, 5.0] を embed しているので、推論時 CFG=1.0 で 4.5 相当の prompt fidelity が出る。CFG>1.0 を重ねると過剰
94
 
95
  ## License
96
 
97
  Apache-2.0
98
 
99
- Base model (Anima v1.0) のライセンスも併せて確認のこと: [circlestone-labs/Anima](https://huggingface.co/circlestone-labs/Anima).
 
100
 
101
  ## Citation
102
 
103
  PCM 元論文:
104
 
105
- ```
106
  @article{wang2024phased,
107
  title={Phased Consistency Model},
108
  author={Wang, Fu-Yun and Huang, Zhaoyang and Bei, Bin and Shi, Xiaoyu and Liu, Xinyu and Tian, Yang and Yang, Yang and Li, Hongsheng},
 
13
 
14
  # Anima v1.0 — PCM 4-step Distillation LoRA
15
 
16
+ ⚠️ **非推奨 / Not Recommended**: LoRA は生成品質が低く、実用には Civitai Anima Turbo を推奨。
17
+ 研究目的・失敗事例の参照用として公開。
18
 
19
+ Phased Consistency Model (PCM) 蒸留 LoRA for [Anima v1.0 base](https://huggingface.co/circlestone-labs/Anima)
20
+ 4-step / CFG=1.0 で生成可能だが、**視覚品質が公式 [Civitai Anima Turbo](https://civitai.com/models/2560840)
21
+ や同 collection の DMDX に劣る**。
22
+
23
+ ## なぜ非推奨か
24
+
25
+ - 5000 step 訓練を **数値的に完走** (loss 健全、divergence なし) したが、生成画像の品質が低い
26
+ - 実用は **公式 Civitai Anima Turbo を直接使用** が確実
27
+
28
+ 詳細な失敗分析は [docs/pcm.md](https://huggingface.co/darask0/rapid-anima/blob/main/docs/pcm.md) 参照。
29
 
30
  ## Files
31
 
32
  | File | Format | Use |
33
  |---|---|---|
34
+ | `pcm_final_peft.safetensors` | PEFT (diffusers) | 研究用 |
35
+ | `pcm_final_comfy.safetensors` | ComfyUI LoRA | 研究用 |
36
 
37
  両者は同一の重み、フォーマット変換のみの違い。
38
 
39
+ ## Usage (ComfyUI、研究用)
40
 
41
  1. `pcm_final_comfy.safetensors` を `ComfyUI/models/loras/` に配置
42
  2. Anima v1.0 base workflow に `LoraLoaderModelOnly` を挿入、`strength_model: 1.0`
 
45
  - **cfg: 1.0**
46
  - sampler / scheduler: 下記サンプル比較を参照
47
 
48
+ ## Recommended Sampler (どちらも品質不足だが)
 
 
49
 
50
  | Sampler | Scheduler | 特徴 |
51
  |---|---|---|
52
  | `er_sde` | `simple` | やや softer、構図上半身寄り、生成 8.8s |
53
  | `res_multistep` | `beta` | anime style 強め、全身描画、生成 11.2s |
54
 
55
+ 両者とも 4-step CFG=1.0 で動作するが、品質的に Civitai Turbo / DMDX より劣る。
56
 
57
  ### サンプル比較
58
 
 
82
  | Loss | Pseudo-Huber |
83
  | Optimizer | AdamW (lr 5e-6, wd 0.01) |
84
  | Grad clip | 1.0 |
85
+ | Warm-start | **無し** (cold-start) |
86
  | Hardware | NVIDIA B200 (1 GPU) |
87
  | Training time | ~3.4 hours |
88
+ | Cost | ~$22 (Modal) |
89
 
90
  ### Dataset
91
 
 
94
  - Caption pool: 10 prompts × 500 seeds, anime characters + scene
95
  - Precompute cost: ~$7-8 (B200, ~86 min)
96
 
97
+ ## 失敗分析 (Lessons Learned)
98
+
99
+ ### 数値上は成功した
100
+ - loss 0.001-0.007 で安定収束
101
+ - mean collapse / NaN / OOM 全部なし
102
+ - training pipeline は完璧に動作
103
+
104
+ ### しかし生成品質は低い
105
+ 推測される原因:
106
+
107
+ 1. **cold-start strategy が Anima 系では機能しない可能性**
108
+ - 公式 Turbo は warm-start が事実上必須
109
+ - 5000 sample dataset は cold-start には不十分かも
110
+ 2. **phase consistency loss だけでは style anchor が弱い**
111
+ - DMD2 系の adversarial signal や LADD の Smooth-L1 recon があれば改善可能性
112
+ 3. **CFG-augmentation embed が不完全**
113
+ - w∈[4.0, 5.0] embed が teacher CFG=4.5 の効果を完全再現していない
114
+
115
+ ### 改善方向 (将来検討)
116
+ - warm-start (Civitai Turbo) を導入して semi-fine-tune に
117
+ - データセット規模拡大 (5000 → 20000+)
118
+ - adversarial loss (LADD style) との組合せ
119
+ - 他手法 (DMD2、Hyper-SD) に切り替え
120
+
121
  ## Limitations
122
 
123
+ - **生成品質が公式 Turbo / DMDX より劣る** 主要な制約
124
+ - Base model 固定 (Anima v1.0 以外でstyle drift)
125
+ - 4-step ハード制約 (2 step / 8 step では同品質保証な)
126
+ - CFG=1.0 推奨 (CFG>1.0 過剰)
127
 
128
  ## License
129
 
130
  Apache-2.0
131
 
132
+ Base model (Anima v1.0) のライセンスも併せて確認のこと:
133
+ [circlestone-labs/Anima](https://huggingface.co/circlestone-labs/Anima)
134
 
135
  ## Citation
136
 
137
  PCM 元論文:
138
 
139
+ ```bibtex
140
  @article{wang2024phased,
141
  title={Phased Consistency Model},
142
  author={Wang, Fu-Yun and Huang, Zhaoyang and Bei, Bin and Shi, Xiaoyu and Liu, Xinyu and Tian, Yang and Yang, Yang and Li, Hongsheng},