dataautogpt3 commited on
Commit
f708710
Β·
verified Β·
1 Parent(s): 4c76a3f

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +193 -0
README.md ADDED
@@ -0,0 +1,193 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: other
3
+ license_name: krea-2-research
4
+ license_link: https://huggingface.co/dataautogpt3/Krea2-weights-experiments/blob/main/LICENSE
5
+ language:
6
+ - en
7
+ library_name: diffusers
8
+ tags:
9
+ - krea-2
10
+ - turbo
11
+ - weight-editing
12
+ - diffusion
13
+ - dit
14
+ - mmdit
15
+ - safetensors
16
+ - comfyui
17
+ - experimental
18
+ pipeline_tag: text-to-image
19
+ ---
20
+
21
+ # Krea 2 Turbo β€” Hand-Edited Weight Experiments
22
+
23
+ ![Comparison Grid](comparison_ALL.png)
24
+
25
+ ## Overview
26
+
27
+ This repository contains **weight-edited variants** of the Krea 2 Turbo diffusion model. Each variant was created by surgically scaling specific transformer block weights in the 12.8B parameter single-stream MMDiT, producing artistic and functional model variations without any retraining.
28
+
29
+ These are **research artifacts** from hand-editing diffusion model weights using the methodology described below. The base models (Krea 2 Turbo and Krea 2 Raw) are NOT included β€” only the edited variants.
30
+
31
+ ## Method
32
+
33
+ All variants use the core formula:
34
+
35
+ ```
36
+ theta_new = theta_original * (1 - 2 * alpha)
37
+ ```
38
+
39
+ Where `alpha` controls the inversion strength:
40
+ - `alpha=0.05` β†’ scale 0.90 (subtle)
41
+ - `alpha=0.10` β†’ scale 0.80 (artistic sweet spot)
42
+ - `alpha=0.15` β†’ scale 0.70 (strong)
43
+ - `alpha=0.20` β†’ scale 0.60 (aggressive but functional)
44
+
45
+ Full negation (`alpha=0.5`, scale=-1.0) **breaks the model** and is excluded from this repository.
46
+
47
+ ## Architecture: Krea 2 Turbo
48
+
49
+ - **Type**: Single-stream MMDiT (Diffusion Transformer)
50
+ - **Parameters**: 12.8B
51
+ - **File size**: ~25GB per variant (BF16 + F32 tensors)
52
+ - **Structure**: 28 uniform transformer blocks
53
+ - **Block sub-layers**:
54
+ - `blocks.N.attn.*` (7 tensors): gate, qknorm, wq, wk, wv, wo
55
+ - `blocks.N.mlp.*` (3 tensors): gate, up, down (SwiGLU)
56
+ - `blocks.N.mod.lin` (1 tensor): conditioning modulation
57
+ - `blocks.N.prenorm.scale` / `blocks.N.postnorm.scale`
58
+
59
+ ## Variants
60
+
61
+ ### B1 β€” Partial Inversion (Most Artistic)
62
+ | Property | Value |
63
+ |---|---|
64
+ | File | `Krea_2_turbo_inv_B1_partial10.safetensors` |
65
+ | Blocks | 12-14 (mid) |
66
+ | Layers | ALL (39 tensors per block group) |
67
+ | Alpha | 0.10 (scale=0.80) |
68
+ | Result | **Most artistic variant** β€” strong style/content shift while remaining coherent |
69
+
70
+ ### B3 β€” Attention-Only Partial Inversion
71
+ | Property | Value |
72
+ |---|---|
73
+ | File | `Krea_2_turbo_inv_B3_attn_p10.safetensors` |
74
+ | Blocks | 12-14 (mid) |
75
+ | Layers | attn only (21 tensors) |
76
+ | Alpha | 0.10 (scale=0.80) |
77
+ | Result | Functional, subtler than B1 β€” attention-specific perturbation |
78
+
79
+ ### D β€” Gate Scaling (All Blocks)
80
+ | Property | Value |
81
+ |---|---|
82
+ | File | `Krea_2_turbo_inv_D_gate_p20.safetensors` |
83
+ | Blocks | 0-27 (all) |
84
+ | Layers | attn.gate only (28 tensors) |
85
+ | Alpha | 0.20 (scale=0.60) |
86
+ | Result | Functional, moderate effect β€” gate weights are more tolerant of aggressive scaling |
87
+
88
+ ### F β€” Early/Late Block Inversion
89
+ | Property | Value |
90
+ |---|---|
91
+ | File | `Krea_2_turbo_F_early_a10.safetensors` |
92
+ | Blocks | 0-2 (early) |
93
+ | Layers | ALL |
94
+ | Alpha | 0.10 (scale=0.80) |
95
+ | Result | Affects structure, composition, spatial layout |
96
+
97
+ | Property | Value |
98
+ |---|---|
99
+ | File | `Krea_2_turbo_F_late_a10.safetensors` |
100
+ | Blocks | 25-27 (late) |
101
+ | Layers | ALL |
102
+ | Alpha | 0.10 (scale=0.80) |
103
+ | Result | Affects style, color, detail, texture refinement |
104
+
105
+ ### G β€” Mid-Block Alpha Sweep
106
+ Three variants at different inversion strengths on the same block zone:
107
+
108
+ | File | Alpha | Scale | Notes |
109
+ |---|---|---|---|
110
+ | `Krea_2_turbo_G_mid_a05.safetensors` | 0.05 | 0.90 | Subtle |
111
+ | `Krea_2_turbo_G_mid_a15.safetensors` | 0.15 | 0.70 | Strong |
112
+ | `Krea_2_turbo_G_mid_a20.safetensors` | 0.20 | 0.60 | Aggressive but functional |
113
+
114
+ All target blocks 12-14, ALL layers.
115
+
116
+ ### H β€” Layer-Selective Mid-Block
117
+ | File | Blocks | Layers | Alpha |
118
+ |---|---|---|---|
119
+ | `Krea_2_turbo_H_mid_attn_a10.safetensors` | 12-14 | attn only | 0.10 |
120
+ | `Krea_2_turbo_H_mid_mlp_a10.safetensors` | 12-14 | mlp only | 0.10 |
121
+
122
+ Isolates the effect of attention vs MLP perturbation on the same block zone.
123
+
124
+ ### I β€” Gradient Alpha
125
+ | Property | Value |
126
+ |---|---|
127
+ | File | `Krea_2_turbo_I_gradient.safetensors` |
128
+ | Blocks | 0-27 (all) |
129
+ | Layers | ALL |
130
+ | Alpha | 0.03 β†’ 0.17 (gradient across blocks) |
131
+ | Scale | 0.94 β†’ 0.66 |
132
+ | Result | Smooth global perturbation β€” early blocks barely touched, late blocks aggressively inverted |
133
+
134
+ ## Excluded Variants (Broken)
135
+
136
+ The following variants were created but are **broken** (model produces noise/garbage) and are NOT included:
137
+
138
+ | Variant | What was done | Why it broke |
139
+ |---|---|---|
140
+ | B2_attn_full | attn weights * -1.0 | Full negation destroys attention computation |
141
+ | D_wv_all | wv weights * -1.0 | Full negation of value projection |
142
+ | E_ties_mid | TIES-style sign flip on mid blocks | Full negation variant |
143
+
144
+ ## Usage
145
+
146
+ ### ComfyUI
147
+
148
+ 1. Place `.safetensors` files in `ComfyUI/models/diffusion_models/`
149
+ 2. Load via `UNETLoader` node
150
+ 3. Use the same VAE, CLIP, and text encoder as Krea 2 Turbo
151
+ 4. Generate with your standard Krea 2 workflow
152
+
153
+ ### Diffusers
154
+
155
+ ```python
156
+ from diffusers import DiffusionPipeline
157
+ import torch
158
+
159
+ pipe = DiffusionPipeline.from_pretrained(
160
+ "dataautogpt3/Krea2-weights-experiments",
161
+ torch_dtype=torch.bfloat16,
162
+ variant="bf16"
163
+ ).to("cuda")
164
+ ```
165
+
166
+ > Note: These are diffusion model weights only. You need the corresponding VAE, text encoders, and tokenizer from the original Krea 2 Turbo release.
167
+
168
+ ## Key Findings
169
+
170
+ 1. **Scaling works, full negation breaks.** Partial inversion (scale 0.60-0.90) produces functional, artistic variants. Full negation (scale=-1.0) breaks the model.
171
+
172
+ 2. **10% inversion is the sweet spot.** Alpha=0.10 (scale=0.80) on mid blocks 12-14 produces the most artistically interesting results.
173
+
174
+ 3. **Mid blocks are safest to modify.** Blocks 12-14 are the most redundant and tolerate perturbation best.
175
+
176
+ 4. **Gate weights are most tolerant.** Attention gate weights can be scaled to 0.60 across all blocks while remaining functional β€” other layers break sooner.
177
+
178
+ 5. **The artistic effects come from compensation.** Partial perturbation triggers creative reorganization in unedited blocks β€” the compensatory masquerade effect.
179
+
180
+ ## Research Context
181
+
182
+ This work draws on findings from:
183
+ - **Task Arithmetic** (Ilharco et al., ICLR 2023) β€” formal basis for weight negation
184
+ - **weights2weights** (NeurIPS 2024) β€” diffusion weight space as meta-latent
185
+ - **Unraveling MMDiT Blocks** (2025) β€” per-block role mapping for MMDiT
186
+ - **C3: Creative Concept Catalyst** (CVPR 2025) β€” low-frequency amplification in shallow blocks
187
+ - **ConceptPrune** (ICLR 2025) β€” tiny weight changes shift semantic output
188
+
189
+ ## Credits
190
+
191
+ - Base model: Krea 2 Turbo (Krea AI)
192
+ - Weight editing: DataPlusEngine
193
+ - Methodology: Hand-editing diffusion weights via mmap-based surgical tensor scaling