mipat12 commited on
Commit
c6737b6
·
verified ·
1 Parent(s): 4ecb170

Model card auto-generated by SimpleTuner

Browse files
Files changed (1) hide show
  1. README.md +274 -0
README.md ADDED
@@ -0,0 +1,274 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: other
3
+ base_model: "black-forest-labs/FLUX.1-dev"
4
+ tags:
5
+ - flux
6
+ - flux-diffusers
7
+ - text-to-image
8
+ - diffusers
9
+ - simpletuner
10
+ - not-for-all-audiences
11
+ - lora
12
+ - template:sd-lora
13
+ - lycoris
14
+ inference: true
15
+ widget:
16
+ - text: 'unconditional (blank prompt)'
17
+ parameters:
18
+ negative_prompt: 'blurry, cropped, ugly'
19
+ output:
20
+ url: ./assets/image_0_0.png
21
+ - text: 'in the style of a Michelangelo sculpture, Three elderly women huddle together, their robes intertwined as they share a scroll between them. Their faces show deep concentration, with pronounced wrinkles and hollow cheeks.'
22
+ parameters:
23
+ negative_prompt: 'blurry, cropped, ugly'
24
+ output:
25
+ url: ./assets/image_1_0.png
26
+ - text: 'in the style of a Michelangelo sculpture, a hamster'
27
+ parameters:
28
+ negative_prompt: 'blurry, cropped, ugly'
29
+ output:
30
+ url: ./assets/image_2_0.png
31
+ - text: 'in the style of a Michelangelo sculpture, A plump hamster sits upright on its haunches, tiny paws clutching a seed with remarkable dignity. Its fur is rendered in detailed marble ripples, while its alert ears are tilted forward attentively. The creature''s round cheeks suggest stored food, and its whiskers are delicately carved. The base is decorated with miniature carved leaves and fallen seeds, while the background remains unadorned and shadowed.'
32
+ parameters:
33
+ negative_prompt: 'blurry, cropped, ugly'
34
+ output:
35
+ url: ./assets/image_3_0.png
36
+ - text: 'in the style of a Michelangelo sculpture, A Range Rover emerges from solid marble, its commanding presence emphasized by strong angular lines and bold proportions. The vehicle rests in a three-quarter pose, with its distinctive grille and headlights carved in meticulous detail. Each wheel arch suggests latent motion, while the smooth curves of the hood flow into the upright windscreen. The base appears to ripple like terrain beneath the wheels, suggesting the vehicle''s adventurous nature. The background is stark, drawing attention to the interplay of light and shadow across the sculptured surfaces.'
37
+ parameters:
38
+ negative_prompt: 'blurry, cropped, ugly'
39
+ output:
40
+ url: ./assets/image_4_0.png
41
+ - text: 'in the style of a Michelangelo sculpture, A young girl stands on tiptoes reaching upward, her hair falling in loose waves. A ribbon streams behind her, caught in an invisible wind. The base beneath her feet shows carved clouds, suggesting she floats between earth and sky.'
42
+ parameters:
43
+ negative_prompt: 'blurry, cropped, ugly'
44
+ output:
45
+ url: ./assets/image_5_0.png
46
+ - text: 'a man holding a sign that says, ''this is a sign'
47
+ parameters:
48
+ negative_prompt: 'blurry, cropped, ugly'
49
+ output:
50
+ url: ./assets/image_6_0.png
51
+ - text: 'a pig, in a post apocalyptic world, with a shotgun, in a leather jacket, in a desert, with a motorcycle'
52
+ parameters:
53
+ negative_prompt: 'blurry, cropped, ugly'
54
+ output:
55
+ url: ./assets/image_7_0.png
56
+ - text: 'in the style of a Michelangelo sculpture, woman holding a sign that says ''I LOVE PROMPTS!''. '
57
+ parameters:
58
+ negative_prompt: 'blurry, cropped, ugly'
59
+ output:
60
+ url: ./assets/image_8_0.png
61
+ - text: 'in the style of a Michelangelo sculpture, A nude male figure stands tall on a pedestal, his left arm is raised, while his right arm hangs freely by his side. The figure has curly hair and a focused, determined expression on his face looking slightly to his left. In the background, there are large panels with rectangular details on the walls, suggesting an indoor setting. '
62
+ parameters:
63
+ negative_prompt: 'blurry, cropped, ugly'
64
+ output:
65
+ url: ./assets/image_9_0.png
66
+ - text: 'in the style of a Michelangelo sculpture, a bearded man sits down dressed in long garments. The background is plain.'
67
+ parameters:
68
+ negative_prompt: 'blurry, cropped, ugly'
69
+ output:
70
+ url: ./assets/image_10_0.png
71
+ - text: 'in the style of a Michelangelo sculpture, a woman cradling a lifeless man on her lap. The woman wears draped clothing with a hood, and has a sorrowful expression. The man is depicted naked except for a cloth around his waist, his arms and legs extended lifelessly. The background is an intricate marble wall with a mixed pattern of colors (brown, green, beige). '
72
+ parameters:
73
+ negative_prompt: 'blurry, cropped, ugly'
74
+ output:
75
+ url: ./assets/image_11_0.png
76
+ ---
77
+
78
+ # michelangelo-phase1-4e-4-ss3.0
79
+
80
+ This is a LyCORIS adapter derived from [black-forest-labs/FLUX.1-dev](https://huggingface.co/black-forest-labs/FLUX.1-dev).
81
+
82
+
83
+ No validation prompt was used during training.
84
+
85
+ None
86
+
87
+
88
+
89
+ ## Validation settings
90
+ - CFG: `2.5`
91
+ - CFG Rescale: `0.0`
92
+ - Steps: `20`
93
+ - Sampler: `FlowMatchEulerDiscreteScheduler`
94
+ - Seed: `42`
95
+ - Resolution: `1024x1024`
96
+ - Skip-layer guidance:
97
+
98
+ Note: The validation settings are not necessarily the same as the [training settings](#training-settings).
99
+
100
+ You can find some example images in the following gallery:
101
+
102
+
103
+ <Gallery />
104
+
105
+ The text encoder **was not** trained.
106
+ You may reuse the base model text encoder for inference.
107
+
108
+
109
+ ## Training settings
110
+
111
+ - Training epochs: 0
112
+ - Training steps: 200
113
+ - Learning rate: 0.0004
114
+ - Learning rate schedule: polynomial
115
+ - Warmup steps: 100
116
+ - Max grad norm: 0.1
117
+ - Effective batch size: 3
118
+ - Micro-batch size: 3
119
+ - Gradient accumulation steps: 1
120
+ - Number of GPUs: 1
121
+ - Gradient checkpointing: True
122
+ - Prediction type: flow-matching (extra parameters=['shift=3.0', 'flux_guidance_mode=constant', 'flux_guidance_value=1.0', 'flow_matching_loss=compatible'])
123
+ - Optimizer: adamw_bf16
124
+ - Trainable parameter precision: Pure BF16
125
+ - Caption dropout probability: 10.0%
126
+
127
+
128
+ ### LyCORIS Config:
129
+ ```json
130
+ {
131
+ "algo": "lokr",
132
+ "multiplier": 1.0,
133
+ "linear_dim": 10000,
134
+ "linear_alpha": 1,
135
+ "factor": 16,
136
+ "apply_preset": {
137
+ "target_module": [
138
+ "Attention",
139
+ "FeedForward"
140
+ ],
141
+ "module_algo_map": {
142
+ "Attention": {
143
+ "factor": 16
144
+ },
145
+ "FeedForward": {
146
+ "factor": 8
147
+ }
148
+ }
149
+ }
150
+ }
151
+ ```
152
+
153
+ ## Datasets
154
+
155
+ ### davinci-512
156
+ - Repeats: 11
157
+ - Total number of images: 13
158
+ - Total number of aspect buckets: 7
159
+ - Resolution: 0.262144 megapixels
160
+ - Cropped: False
161
+ - Crop style: None
162
+ - Crop aspect: None
163
+ - Used for regularisation data: No
164
+ ### davinci-768
165
+ - Repeats: 8
166
+ - Total number of images: 13
167
+ - Total number of aspect buckets: 8
168
+ - Resolution: 0.589824 megapixels
169
+ - Cropped: False
170
+ - Crop style: None
171
+ - Crop aspect: None
172
+ - Used for regularisation data: No
173
+ ### davinci-1024
174
+ - Repeats: 5
175
+ - Total number of images: 13
176
+ - Total number of aspect buckets: 10
177
+ - Resolution: 1.048576 megapixels
178
+ - Cropped: False
179
+ - Crop style: None
180
+ - Crop aspect: None
181
+ - Used for regularisation data: No
182
+ ### davinci-1536
183
+ - Repeats: 2
184
+ - Total number of images: 13
185
+ - Total number of aspect buckets: 10
186
+ - Resolution: 2.359296 megapixels
187
+ - Cropped: False
188
+ - Crop style: None
189
+ - Crop aspect: None
190
+ - Used for regularisation data: No
191
+ ### davinci-crops-512
192
+ - Repeats: 8
193
+ - Total number of images: 13
194
+ - Total number of aspect buckets: 1
195
+ - Resolution: 0.262144 megapixels
196
+ - Cropped: True
197
+ - Crop style: random
198
+ - Crop aspect: square
199
+ - Used for regularisation data: No
200
+ ### davinci-1024-crop
201
+ - Repeats: 5
202
+ - Total number of images: 13
203
+ - Total number of aspect buckets: 1
204
+ - Resolution: 1.048576 megapixels
205
+ - Cropped: True
206
+ - Crop style: random
207
+ - Crop aspect: square
208
+ - Used for regularisation data: No
209
+
210
+
211
+ ## Inference
212
+
213
+
214
+ ```python
215
+ import torch
216
+ from diffusers import DiffusionPipeline
217
+ from lycoris import create_lycoris_from_weights
218
+
219
+
220
+ def download_adapter(repo_id: str):
221
+ import os
222
+ from huggingface_hub import hf_hub_download
223
+ adapter_filename = "pytorch_lora_weights.safetensors"
224
+ cache_dir = os.environ.get('HF_PATH', os.path.expanduser('~/.cache/huggingface/hub/models'))
225
+ cleaned_adapter_path = repo_id.replace("/", "_").replace("\\", "_").replace(":", "_")
226
+ path_to_adapter = os.path.join(cache_dir, cleaned_adapter_path)
227
+ path_to_adapter_file = os.path.join(path_to_adapter, adapter_filename)
228
+ os.makedirs(path_to_adapter, exist_ok=True)
229
+ hf_hub_download(
230
+ repo_id=repo_id, filename=adapter_filename, local_dir=path_to_adapter
231
+ )
232
+
233
+ return path_to_adapter_file
234
+
235
+ model_id = 'black-forest-labs/FLUX.1-dev'
236
+ adapter_repo_id = 'mipat12/michelangelo-phase1-4e-4-ss3.0'
237
+ adapter_filename = 'pytorch_lora_weights.safetensors'
238
+ adapter_file_path = download_adapter(repo_id=adapter_repo_id)
239
+ pipeline = DiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.bfloat16) # loading directly in bf16
240
+ lora_scale = 1.0
241
+ wrapper, _ = create_lycoris_from_weights(lora_scale, adapter_file_path, pipeline.transformer)
242
+ wrapper.merge_to()
243
+
244
+ prompt = "An astronaut is riding a horse through the jungles of Thailand."
245
+
246
+
247
+ ## Optional: quantise the model to save on vram.
248
+ ## Note: The model was quantised during training, and so it is recommended to do the same during inference time.
249
+ from optimum.quanto import quantize, freeze, qint8
250
+ quantize(pipeline.transformer, weights=qint8)
251
+ freeze(pipeline.transformer)
252
+
253
+ pipeline.to('cuda' if torch.cuda.is_available() else 'mps' if torch.backends.mps.is_available() else 'cpu') # the pipeline is already in its target precision level
254
+ image = pipeline(
255
+ prompt=prompt,
256
+ num_inference_steps=20,
257
+ generator=torch.Generator(device='cuda' if torch.cuda.is_available() else 'mps' if torch.backends.mps.is_available() else 'cpu').manual_seed(42),
258
+ width=1024,
259
+ height=1024,
260
+ guidance_scale=2.5,
261
+ ).images[0]
262
+ image.save("output.png", format="PNG")
263
+ ```
264
+
265
+
266
+
267
+ ## Exponential Moving Average (EMA)
268
+
269
+ SimpleTuner generates a safetensors variant of the EMA weights and a pt file.
270
+
271
+ The safetensors file is intended to be used for inference, and the pt file is for continuing finetuning.
272
+
273
+ The EMA model may provide a more well-rounded result, but typically will feel undertrained compared to the full model as it is a running decayed average of the model weights.
274
+