DragonQuix commited on
Commit
aa0aa2c
1 Parent(s): 5a3c7e9

Model card auto-generated by SimpleTuner

Browse files
Files changed (1) hide show
  1. README.md +235 -0
README.md ADDED
@@ -0,0 +1,235 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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: 'a photo of a q1s woman in a suit standing on the streets of Tokyo'
22
+ parameters:
23
+ negative_prompt: 'blurry, cropped, ugly'
24
+ output:
25
+ url: ./assets/image_1_0.png
26
+ - text: 'a anime of a q1s woman in school uniform standing on a bridge'
27
+ parameters:
28
+ negative_prompt: 'blurry, cropped, ugly'
29
+ output:
30
+ url: ./assets/image_2_0.png
31
+ - text: 'a photo of a q1s woman in leather jacket on the beach'
32
+ parameters:
33
+ negative_prompt: 'blurry, cropped, ugly'
34
+ output:
35
+ url: ./assets/image_3_0.png
36
+ - text: 'A stunning portrait of a q1s woman adorned with a luxurious wide-brimmed red hat that elegantly covers part of her face, illustration, vibrant, sophisticated, portrait photography'
37
+ parameters:
38
+ negative_prompt: 'blurry, cropped, ugly'
39
+ output:
40
+ url: ./assets/image_4_0.png
41
+ - text: 'A grainy, sepia-toned photograph taken with a Kodak Portra 400 film camera in the late 1990s of a q1s woman with captivating gaze poses confidently. She wears a vintage, black MinMin T-shirt, slightly oversized and slightly worn, with the band''s iconic logo prominently displayed. The background is blurred, suggesting a dimly lit, underground music venue or a friend''s basement.'
42
+ parameters:
43
+ negative_prompt: 'blurry, cropped, ugly'
44
+ output:
45
+ url: ./assets/image_5_0.png
46
+ - text: 'A captivating minimalist masterpiece illustration of a q1s woman exuding elegance and tranquility. The beautiful subject is dressed in a linen dress, featuring pastel beige and light grey hues. The background consists of a harmonious composition of rectangles and squares, subtly outlined in black pencil. This vibrant and conceptual artwork elicits a cinematic and fashionable illustration.'
47
+ parameters:
48
+ negative_prompt: 'blurry, cropped, ugly'
49
+ output:
50
+ url: ./assets/image_6_0.png
51
+ - text: 'a digital painting of a q1s woman in a green hoodie and purple skirt standing in front of an office building'
52
+ parameters:
53
+ negative_prompt: 'blurry, cropped, ugly'
54
+ output:
55
+ url: ./assets/image_7_0.png
56
+ - text: 'A whimsical miniature 3D alcohol ink portrait of a q1s woman mermaid nestled in a giant seashell. She has a shimmering fish tail adorned with intricate scales in various shades of blue and turquoise. She wears a top made of tiny seashells and pearls. Surrounding her are small, bioluminescent jellyfish, adding a magical glow to the scene. The lighting creates a dreamy, underwater atmosphere that captures the essence of oceanic wonder and enchantment.'
57
+ parameters:
58
+ negative_prompt: 'blurry, cropped, ugly'
59
+ output:
60
+ url: ./assets/image_8_0.png
61
+ - text: 'a photo of a q1s woman as a historical marble statue in a grand bathroom'
62
+ parameters:
63
+ negative_prompt: 'blurry, cropped, ugly'
64
+ output:
65
+ url: ./assets/image_9_0.png
66
+ - text: 'A captivating watercolor portrayal of a q1s woman. Her eyes are the focal point. The vibrant color palette features bright red, deep green, and pastel beige and white, creating a striking contrast. The fluid, free-flowing brushstrokes imbue the artwork with movement and emotion. The background is an abstract tapestry of color, with splashes of the same hues, adding depth and dimension to the portrait. Painting, illustration.'
67
+ parameters:
68
+ negative_prompt: 'blurry, cropped, ugly'
69
+ output:
70
+ url: ./assets/image_10_0.png
71
+ - text: 'an oil painting of q1s in a hoordie and skirt walking on the beach'
72
+ parameters:
73
+ negative_prompt: 'blurry, cropped, ugly'
74
+ output:
75
+ url: ./assets/image_11_0.png
76
+ ---
77
+
78
+ # flux-test-q1sV16
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
+ The main validation prompt used during training was:
84
+
85
+
86
+
87
+ ```
88
+ an oil painting of q1s in a hoordie and skirt walking on the beach
89
+ ```
90
+
91
+ ## Validation settings
92
+ - CFG: `1.0`
93
+ - CFG Rescale: `0.0`
94
+ - Steps: `20`
95
+ - Sampler: `None`
96
+ - Seed: `42`
97
+ - Resolution: `1024x1024`
98
+
99
+ Note: The validation settings are not necessarily the same as the [training settings](#training-settings).
100
+
101
+ You can find some example images in the following gallery:
102
+
103
+
104
+ <Gallery />
105
+
106
+ The text encoder **was not** trained.
107
+ You may reuse the base model text encoder for inference.
108
+
109
+
110
+ ## Training settings
111
+
112
+ - Training epochs: 0
113
+ - Training steps: 200
114
+ - Learning rate: 6e-05
115
+ - Max grad norm: 1.0
116
+ - Effective batch size: 3
117
+ - Micro-batch size: 1
118
+ - Gradient accumulation steps: 3
119
+ - Number of GPUs: 1
120
+ - Prediction type: flow-matching (extra parameters=['flux_schedule_auto_shift', 'shift=0.0', 'flux_guidance_value=4.0', 'flux_attention_masked_training'])
121
+ - Rescaled betas zero SNR: False
122
+ - Optimizer: optimi-lionweight_decay=1e-3
123
+ - Precision: Pure BF16
124
+ - Quantised: Yes: int8-quanto
125
+ - Xformers: Not used
126
+ - LyCORIS Config:
127
+ ```json
128
+ {
129
+ "algo": "lokr",
130
+ "multiplier": 1.0,
131
+ "linear_dim": 10000,
132
+ "linear_alpha": 1,
133
+ "factor": 16,
134
+ "apply_preset": {
135
+ "target_module": [
136
+ "Attention",
137
+ "FeedForward"
138
+ ],
139
+ "module_algo_map": {
140
+ "Attention": {
141
+ "factor": 16
142
+ },
143
+ "FeedForward": {
144
+ "factor": 8
145
+ }
146
+ }
147
+ }
148
+ }
149
+ ```
150
+
151
+ ## Datasets
152
+
153
+ ### q1sV16-1024-crop
154
+ - Repeats: 14
155
+ - Total number of images: 30
156
+ - Total number of aspect buckets: 1
157
+ - Resolution: 1.048576 megapixels
158
+ - Cropped: True
159
+ - Crop style: center
160
+ - Crop aspect: square
161
+ - Used for regularisation data: No
162
+ ### q1sV16-512-crop
163
+ - Repeats: 14
164
+ - Total number of images: 38
165
+ - Total number of aspect buckets: 1
166
+ - Resolution: 0.262144 megapixels
167
+ - Cropped: True
168
+ - Crop style: center
169
+ - Crop aspect: square
170
+ - Used for regularisation data: No
171
+ ### gen-and-inpaint-q1s-1024-reg
172
+ - Repeats: 0
173
+ - Total number of images: 530
174
+ - Total number of aspect buckets: 1
175
+ - Resolution: 1.048576 megapixels
176
+ - Cropped: True
177
+ - Crop style: center
178
+ - Crop aspect: square
179
+ - Used for regularisation data: Yes
180
+
181
+
182
+ ## Inference
183
+
184
+
185
+ ```python
186
+ import torch
187
+ from diffusers import DiffusionPipeline
188
+ from lycoris import create_lycoris_from_weights
189
+
190
+
191
+ def download_adapter(repo_id: str):
192
+ import os
193
+ from huggingface_hub import hf_hub_download
194
+ adapter_filename = "pytorch_lora_weights.safetensors"
195
+ cache_dir = os.environ.get('HF_PATH', os.path.expanduser('~/.cache/huggingface/hub/models'))
196
+ cleaned_adapter_path = repo_id.replace("/", "_").replace("\\", "_").replace(":", "_")
197
+ path_to_adapter = os.path.join(cache_dir, cleaned_adapter_path)
198
+ path_to_adapter_file = os.path.join(path_to_adapter, adapter_filename)
199
+ os.makedirs(path_to_adapter, exist_ok=True)
200
+ hf_hub_download(
201
+ repo_id=repo_id, filename=adapter_filename, local_dir=path_to_adapter
202
+ )
203
+
204
+ return path_to_adapter_file
205
+
206
+ model_id = 'black-forest-labs/FLUX.1-dev'
207
+ adapter_repo_id = 'DragonQuix/flux-test-q1sV16'
208
+ adapter_filename = 'pytorch_lora_weights.safetensors'
209
+ adapter_file_path = download_adapter(repo_id=adapter_repo_id)
210
+ pipeline = DiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.bfloat16) # loading directly in bf16
211
+ lora_scale = 1.0
212
+ wrapper, _ = create_lycoris_from_weights(lora_scale, adapter_file_path, pipeline.transformer)
213
+ wrapper.merge_to()
214
+
215
+ prompt = "an oil painting of q1s in a hoordie and skirt walking on the beach"
216
+
217
+
218
+ ## Optional: quantise the model to save on vram.
219
+ ## Note: The model was quantised during training, and so it is recommended to do the same during inference time.
220
+ from optimum.quanto import quantize, freeze, qint8
221
+ quantize(pipeline.transformer, weights=qint8)
222
+ freeze(pipeline.transformer)
223
+
224
+ 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
225
+ image = pipeline(
226
+ prompt=prompt,
227
+ num_inference_steps=20,
228
+ generator=torch.Generator(device='cuda' if torch.cuda.is_available() else 'mps' if torch.backends.mps.is_available() else 'cpu').manual_seed(1641421826),
229
+ width=1024,
230
+ height=1024,
231
+ guidance_scale=1.0,
232
+ ).images[0]
233
+ image.save("output.png", format="PNG")
234
+ ```
235
+