mipat12 commited on
Commit
38f4512
·
verified ·
1 Parent(s): c9cdd94

Model card auto-generated by SimpleTuner

Browse files
Files changed (1) hide show
  1. README.md +283 -0
README.md ADDED
@@ -0,0 +1,283 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ - safe-for-work
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: 'a hipster man with a beard, building a chair in the style of a d0r3 engraving.'
22
+ parameters:
23
+ negative_prompt: 'blurry, cropped, ugly'
24
+ output:
25
+ url: ./assets/image_1_0.png
26
+ - text: 'in the style of a d0r3 engraving, 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.'
27
+ parameters:
28
+ negative_prompt: 'blurry, cropped, ugly'
29
+ output:
30
+ url: ./assets/image_2_0.png
31
+ - text: 'a hamster in the style of a d0r3 engraving.'
32
+ parameters:
33
+ negative_prompt: 'blurry, cropped, ugly'
34
+ output:
35
+ url: ./assets/image_3_0.png
36
+ - text: 'in the style of a d0r3 engraving, 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.'
37
+ parameters:
38
+ negative_prompt: 'blurry, cropped, ugly'
39
+ output:
40
+ url: ./assets/image_4_0.png
41
+ - text: 'a man holding a sign that says, ''this is a sign'
42
+ parameters:
43
+ negative_prompt: 'blurry, cropped, ugly'
44
+ output:
45
+ url: ./assets/image_5_0.png
46
+ - text: 'a pig, in a post apocalyptic world, with a shotgun, in a leather jacket, in a desert, with a motorcycle'
47
+ parameters:
48
+ negative_prompt: 'blurry, cropped, ugly'
49
+ output:
50
+ url: ./assets/image_6_0.png
51
+ - text: 'woman holding a sign that says ''I LOVE PROMPTS!'' in the style of a d0r3 engraving'
52
+ parameters:
53
+ negative_prompt: 'blurry, cropped, ugly'
54
+ output:
55
+ url: ./assets/image_7_0.png
56
+ - text: 'two men in robes with laurel wreaths in a haunted forest with gnarled branches in the style of a d0r3 engraving.'
57
+ parameters:
58
+ negative_prompt: 'blurry, cropped, ugly'
59
+ output:
60
+ url: ./assets/image_8_0.png
61
+ - text: 'A person kneels on the ground with a staff. Three figures with wings stand elevated on the left side. Background shows a cloudy sky and hilly terrain in the style of a d0r3 engraving.'
62
+ parameters:
63
+ negative_prompt: 'blurry, cropped, ugly'
64
+ output:
65
+ url: ./assets/image_9_0.png
66
+ ---
67
+
68
+ # dore-phase1-4e-4-ss3.0-crops
69
+
70
+ This is a LyCORIS adapter derived from [black-forest-labs/FLUX.1-dev](https://huggingface.co/black-forest-labs/FLUX.1-dev).
71
+
72
+
73
+ No validation prompt was used during training.
74
+
75
+ None
76
+
77
+
78
+
79
+ ## Validation settings
80
+ - CFG: `4.0`
81
+ - CFG Rescale: `0.0`
82
+ - Steps: `20`
83
+ - Sampler: `FlowMatchEulerDiscreteScheduler`
84
+ - Seed: `42`
85
+ - Resolution: `768x1024`
86
+ - Skip-layer guidance:
87
+
88
+ Note: The validation settings are not necessarily the same as the [training settings](#training-settings).
89
+
90
+ You can find some example images in the following gallery:
91
+
92
+
93
+ <Gallery />
94
+
95
+ The text encoder **was not** trained.
96
+ You may reuse the base model text encoder for inference.
97
+
98
+
99
+ ## Training settings
100
+
101
+ - Training epochs: 0
102
+ - Training steps: 250
103
+ - Learning rate: 0.0004
104
+ - Learning rate schedule: polynomial
105
+ - Warmup steps: 100
106
+ - Max grad norm: 0.1
107
+ - Effective batch size: 3
108
+ - Micro-batch size: 3
109
+ - Gradient accumulation steps: 1
110
+ - Number of GPUs: 1
111
+ - Gradient checkpointing: True
112
+ - Prediction type: flow-matching (extra parameters=['shift=3.0', 'flux_guidance_mode=constant', 'flux_guidance_value=4.0', 'flow_matching_loss=compatible'])
113
+ - Optimizer: adamw_bf16
114
+ - Trainable parameter precision: Pure BF16
115
+ - Caption dropout probability: 10.0%
116
+
117
+
118
+ ### LyCORIS Config:
119
+ ```json
120
+ {
121
+ "algo": "lokr",
122
+ "multiplier": 1.0,
123
+ "linear_dim": 10000,
124
+ "linear_alpha": 1,
125
+ "factor": 16,
126
+ "apply_preset": {
127
+ "target_module": [
128
+ "Attention",
129
+ "FeedForward"
130
+ ],
131
+ "module_algo_map": {
132
+ "Attention": {
133
+ "factor": 16
134
+ },
135
+ "FeedForward": {
136
+ "factor": 8
137
+ }
138
+ }
139
+ }
140
+ }
141
+ ```
142
+
143
+ ## Datasets
144
+
145
+ ### dore-background-512
146
+ - Repeats: 22
147
+ - Total number of images: 48
148
+ - Total number of aspect buckets: 1
149
+ - Resolution: 0.262144 megapixels
150
+ - Cropped: False
151
+ - Crop style: None
152
+ - Crop aspect: None
153
+ - Used for regularisation data: No
154
+ ### dore-background-768
155
+ - Repeats: 22
156
+ - Total number of images: 48
157
+ - Total number of aspect buckets: 1
158
+ - Resolution: 0.589824 megapixels
159
+ - Cropped: False
160
+ - Crop style: None
161
+ - Crop aspect: None
162
+ - Used for regularisation data: No
163
+ ### dore-background-1024
164
+ - Repeats: 11
165
+ - Total number of images: 48
166
+ - Total number of aspect buckets: 8
167
+ - Resolution: 1.048576 megapixels
168
+ - Cropped: False
169
+ - Crop style: None
170
+ - Crop aspect: None
171
+ - Used for regularisation data: No
172
+ ### dore-background-1536
173
+ - Repeats: 5
174
+ - Total number of images: 46
175
+ - Total number of aspect buckets: 2
176
+ - Resolution: 2.359296 megapixels
177
+ - Cropped: False
178
+ - Crop style: None
179
+ - Crop aspect: None
180
+ - Used for regularisation data: No
181
+ ### dore-background-512-crop
182
+ - Repeats: 11
183
+ - Total number of images: 48
184
+ - Total number of aspect buckets: 1
185
+ - Resolution: 0.262144 megapixels
186
+ - Cropped: True
187
+ - Crop style: random
188
+ - Crop aspect: square
189
+ - Used for regularisation data: No
190
+ ### dore-background-768-crop
191
+ - Repeats: 11
192
+ - Total number of images: 47
193
+ - Total number of aspect buckets: 1
194
+ - Resolution: 0.589824 megapixels
195
+ - Cropped: True
196
+ - Crop style: random
197
+ - Crop aspect: square
198
+ - Used for regularisation data: No
199
+ ### dore-background-512-tight-crop
200
+ - Repeats: 11
201
+ - Total number of images: 48
202
+ - Total number of aspect buckets: 1
203
+ - Resolution: 0.262144 megapixels
204
+ - Cropped: True
205
+ - Crop style: random
206
+ - Crop aspect: square
207
+ - Used for regularisation data: No
208
+ ### dore-background-768-tight-crop
209
+ - Repeats: 11
210
+ - Total number of images: 47
211
+ - Total number of aspect buckets: 1
212
+ - Resolution: 0.589824 megapixels
213
+ - Cropped: True
214
+ - Crop style: random
215
+ - Crop aspect: square
216
+ - Used for regularisation data: No
217
+ ### dore-background-1024-crop
218
+ - Repeats: 5
219
+ - Total number of images: 47
220
+ - Total number of aspect buckets: 1
221
+ - Resolution: 1.048576 megapixels
222
+ - Cropped: True
223
+ - Crop style: random
224
+ - Crop aspect: square
225
+ - Used for regularisation data: No
226
+
227
+
228
+ ## Inference
229
+
230
+
231
+ ```python
232
+ import torch
233
+ from diffusers import DiffusionPipeline
234
+ from lycoris import create_lycoris_from_weights
235
+
236
+
237
+ def download_adapter(repo_id: str):
238
+ import os
239
+ from huggingface_hub import hf_hub_download
240
+ adapter_filename = "pytorch_lora_weights.safetensors"
241
+ cache_dir = os.environ.get('HF_PATH', os.path.expanduser('~/.cache/huggingface/hub/models'))
242
+ cleaned_adapter_path = repo_id.replace("/", "_").replace("\\", "_").replace(":", "_")
243
+ path_to_adapter = os.path.join(cache_dir, cleaned_adapter_path)
244
+ path_to_adapter_file = os.path.join(path_to_adapter, adapter_filename)
245
+ os.makedirs(path_to_adapter, exist_ok=True)
246
+ hf_hub_download(
247
+ repo_id=repo_id, filename=adapter_filename, local_dir=path_to_adapter
248
+ )
249
+
250
+ return path_to_adapter_file
251
+
252
+ model_id = 'black-forest-labs/FLUX.1-dev'
253
+ adapter_repo_id = 'mipat12/dore-phase1-4e-4-ss3.0-crops'
254
+ adapter_filename = 'pytorch_lora_weights.safetensors'
255
+ adapter_file_path = download_adapter(repo_id=adapter_repo_id)
256
+ pipeline = DiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.bfloat16) # loading directly in bf16
257
+ lora_scale = 1.0
258
+ wrapper, _ = create_lycoris_from_weights(lora_scale, adapter_file_path, pipeline.transformer)
259
+ wrapper.merge_to()
260
+
261
+ prompt = "An astronaut is riding a horse through the jungles of Thailand."
262
+
263
+
264
+ ## Optional: quantise the model to save on vram.
265
+ ## Note: The model was quantised during training, and so it is recommended to do the same during inference time.
266
+ from optimum.quanto import quantize, freeze, qint8
267
+ quantize(pipeline.transformer, weights=qint8)
268
+ freeze(pipeline.transformer)
269
+
270
+ 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
271
+ image = pipeline(
272
+ prompt=prompt,
273
+ num_inference_steps=20,
274
+ generator=torch.Generator(device='cuda' if torch.cuda.is_available() else 'mps' if torch.backends.mps.is_available() else 'cpu').manual_seed(42),
275
+ width=768,
276
+ height=1024,
277
+ guidance_scale=4.0,
278
+ ).images[0]
279
+ image.save("output.png", format="PNG")
280
+ ```
281
+
282
+
283
+