gattaplayer commited on
Commit
6b397c7
·
verified ·
1 Parent(s): 4d92bef

Model card auto-generated by SimpleTuner

Browse files
Files changed (1) hide show
  1. README.md +299 -0
README.md ADDED
@@ -0,0 +1,299 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: other
3
+ base_model: "stabilityai/stable-diffusion-3.5-medium"
4
+ tags:
5
+ - sd3
6
+ - sd3-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 close-up of a young woman in the foreground with windswept red hair, green eyes full of determination, while a soft light highlights her'
22
+ parameters:
23
+ negative_prompt: 'blurry, cropped, ugly'
24
+ output:
25
+ url: ./assets/image_1_0.png
26
+ - text: 'a beautiful woman with flowing hair adorned with flowers and intricate patterns, her expression is confident and mysterious as she holds her hand near her face, she wears an ornate outfit with floral designs, her skin and features are bathed in soft pink tones, the background is filled with decorative swirls and patterns that enhance the elegant and sensual atmosphere, the overall composition is delicate and detailed with a romantic and alluring vibe'
27
+ parameters:
28
+ negative_prompt: 'blurry, cropped, ugly'
29
+ output:
30
+ url: ./assets/image_2_0.png
31
+ - text: 'profile of a dark-skinned woman with long blonde hair and green-yellow eyes, set against a background of large, vibrant leaves in shades of green, yellow, and red, the leaves dominate the foreground, creating a vivid contrast with the woman’s calm and focused expression, as if she is deep in thought, the lighting highlights her face and hair subtly, while the foliage around her adds a sense of motion and energy, the background fades into deeper greens and yellows'
32
+ parameters:
33
+ negative_prompt: 'blurry, cropped, ugly'
34
+ output:
35
+ url: ./assets/image_3_0.png
36
+ - text: 'a woman with long red hair is shown in a curled-up pose, her face tilted toward her knees, gazing intensely at the camera with a look that combines vulnerability and curiosity, her lips are slightly parted, adding a sense of intrigue, while her green eyes, half-shaded by her bangs, convey a mixture of thoughtfulness and quiet intensity, she wears a bright orange headband that contrasts vividly with the green of her outfit and the background, the outfit is made of olive-green lace, with intricate embroidery that stands out against her fair skin, her left arm is bent and rests on her leg, adorned with an ornate gold bracelet featuring white and black details, the background is a muted teal-green, which enhances the bold colors of the image, creating an elegant contrast between warm and cool tones, the overall atmosphere is sophisticated, with a mix of sensuality, mystery, and strength conveyed through her expressive gaze and compact pose'
37
+ parameters:
38
+ negative_prompt: 'blurry, cropped, ugly'
39
+ output:
40
+ url: ./assets/image_4_0.png
41
+ - text: 'a mesmerizing woman with flowing orange-blonde hair cascading down her back her piercing green eyes framed by vibrant blue eyelashes gaze directly at the viewer contrasting beautifully with her bold orange eyebrows her pink lips add a soft yet striking touch she wears a flowing pink cape that glimmers with delicate sparkles catching the light her pose is elegant with her back turned to the camera yet her expression exudes confidence and mystery as she looks over her shoulder'
42
+ parameters:
43
+ negative_prompt: 'blurry, cropped, ugly'
44
+ output:
45
+ url: ./assets/image_5_0.png
46
+ - text: 'a young woman with long brown hair with pink shades and gray eyes, crouching, holding a drink with a straw, looking to the side, wearing a white jacket with red inserts with a hood and tight black trousers and white sneakers with blue laces and red spider print, with one hand under her chin'
47
+ parameters:
48
+ negative_prompt: 'blurry, cropped, ugly'
49
+ output:
50
+ url: ./assets/image_6_0.png
51
+ - text: 'a seductive vampire under a glowing crescent moon her pale porcelain skin gleams with ethereal light while shadows dance across her curves her deep black hair flows dramatically with hints of blue and purple highlights her crimson lips part in a serene expression as she interacts with a bat above her, minimal dark outfit and high collar enhance her elegance surrounded by swirling pink and teal clouds in a moody nocturnal sky'
52
+ parameters:
53
+ negative_prompt: 'blurry, cropped, ugly'
54
+ output:
55
+ url: ./assets/image_7_0.png
56
+ - text: 'a jungle queen with piercing green eyes her long blonde hair is adorned with flowers and feathers partially catching the light her face is dramatically lit with sharp contrasts one side glowing warmly while the other is cast in soft shadow creating depth and mystery the light highlights her vibrant green eyes and glossed lips while the shadow accentuates her cheekbones and jawline the jungle backdrop intensifies the luminous and moody atmosphere surrounding her'
57
+ parameters:
58
+ negative_prompt: 'blurry, cropped, ugly'
59
+ output:
60
+ url: ./assets/image_8_0.png
61
+ - text: 'a confident young queen with flowing blonde hair and striking blue eyes her gaze is bold and captivating her face illuminated by soft yet dynamic lighting emphasizing the gloss on her lips and the glow of her complexion she wears a hood adorned with playful designs a bold pink heart stands out near her eye the intricate necklace of sharp teeth contrasts with her playful yet regal expression a subtle onomatopoeia hinted through her softly puckered lips evokes a gentle kiss sound amplifying her charm'
62
+ parameters:
63
+ negative_prompt: 'blurry, cropped, ugly'
64
+ output:
65
+ url: ./assets/image_9_0.png
66
+ - text: 'two young women stand side by side , one has dark curly hair, wearing a sleeveless top and shorts with a belt, the other has long blonde hair, wearing similar attire, they exchange a subtle, knowing glance, as if sharing an unspoken understanding'
67
+ parameters:
68
+ negative_prompt: 'blurry, cropped, ugly'
69
+ output:
70
+ url: ./assets/image_10_0.png
71
+ ---
72
+
73
+ # besch-style-st-sd35m-lokr-8e-5-bs6-v03
74
+
75
+ This is a LyCORIS adapter derived from [stabilityai/stable-diffusion-3.5-medium](https://huggingface.co/stabilityai/stable-diffusion-3.5-medium).
76
+
77
+
78
+ No validation prompt was used during training.
79
+
80
+ None
81
+
82
+
83
+
84
+ ## Validation settings
85
+ - CFG: `6.0`
86
+ - CFG Rescale: `0.0`
87
+ - Steps: `30`
88
+ - Sampler: `FlowMatchEulerDiscreteScheduler`
89
+ - Seed: `42`
90
+ - Resolution: `832x1216`
91
+ - Skip-layer guidance:
92
+ skip_guidance_layers=[7, 8, 9],
93
+
94
+ Note: The validation settings are not necessarily the same as the [training settings](#training-settings).
95
+
96
+ You can find some example images in the following gallery:
97
+
98
+
99
+ <Gallery />
100
+
101
+ The text encoder **was not** trained.
102
+ You may reuse the base model text encoder for inference.
103
+
104
+
105
+ ## Training settings
106
+
107
+ - Training epochs: 0
108
+ - Training steps: 798
109
+ - Learning rate: 8e-05
110
+ - Learning rate schedule: polynomial
111
+ - Warmup steps: 798
112
+ - Max grad norm: 0.01
113
+ - Effective batch size: 6
114
+ - Micro-batch size: 6
115
+ - Gradient accumulation steps: 1
116
+ - Number of GPUs: 1
117
+ - Gradient checkpointing: True
118
+ - Prediction type: flow-matching (extra parameters=['flux_schedule_auto_shift', 'shift=0.0', 'flux_use_uniform_schedule'])
119
+ - Optimizer: adamw_bf16
120
+ - Trainable parameter precision: Pure BF16
121
+ - Caption dropout probability: 25.0%
122
+
123
+ ### LyCORIS Config:
124
+ ```json
125
+ {
126
+ "bypass_mode": true,
127
+ "algo": "lokr",
128
+ "multiplier": 1.0,
129
+ "full_matrix": true,
130
+ "linear_dim": 10000,
131
+ "linear_alpha": 1,
132
+ "factor": 4,
133
+ "apply_preset": {
134
+ "target_module": [
135
+ "Attention",
136
+ "FeedForward"
137
+ ],
138
+ "module_algo_map": {
139
+ "FeedForward": {
140
+ "factor": 4
141
+ },
142
+ "Attention": {
143
+ "factor": 2
144
+ }
145
+ }
146
+ }
147
+ }
148
+ ```
149
+
150
+ ## Datasets
151
+
152
+ ### BESCH-CROP-SD35M-V03-512
153
+ - Repeats: 1
154
+ - Total number of images: 101
155
+ - Total number of aspect buckets: 1
156
+ - Resolution: 0.262144 megapixels
157
+ - Cropped: True
158
+ - Crop style: random
159
+ - Crop aspect: closest
160
+ - Used for regularisation data: No
161
+ ### BESCH-CROP-SD35M-V03-768
162
+ - Repeats: 1
163
+ - Total number of images: 101
164
+ - Total number of aspect buckets: 1
165
+ - Resolution: 0.589824 megapixels
166
+ - Cropped: True
167
+ - Crop style: random
168
+ - Crop aspect: closest
169
+ - Used for regularisation data: No
170
+ ### BESCH-CROP-SD35M-V03-1024
171
+ - Repeats: 1
172
+ - Total number of images: 101
173
+ - Total number of aspect buckets: 1
174
+ - Resolution: 1.048576 megapixels
175
+ - Cropped: True
176
+ - Crop style: random
177
+ - Crop aspect: closest
178
+ - Used for regularisation data: No
179
+ ### BESCH-MIX-SD35M-V03-512
180
+ - Repeats: 3
181
+ - Total number of images: 202
182
+ - Total number of aspect buckets: 2
183
+ - Resolution: 0.262144 megapixels
184
+ - Cropped: True
185
+ - Crop style: random
186
+ - Crop aspect: closest
187
+ - Used for regularisation data: No
188
+ ### BESCH-MIX-SD35M-V03-768
189
+ - Repeats: 3
190
+ - Total number of images: 202
191
+ - Total number of aspect buckets: 12
192
+ - Resolution: 0.589824 megapixels
193
+ - Cropped: True
194
+ - Crop style: random
195
+ - Crop aspect: closest
196
+ - Used for regularisation data: No
197
+ ### BESCH-MIX-SD35M-V03-1024
198
+ - Repeats: 3
199
+ - Total number of images: 201
200
+ - Total number of aspect buckets: 2
201
+ - Resolution: 1.048576 megapixels
202
+ - Cropped: True
203
+ - Crop style: random
204
+ - Crop aspect: closest
205
+ - Used for regularisation data: No
206
+ ### BESCH-MIX-SD35M-V03-1280
207
+ - Repeats: 3
208
+ - Total number of images: 199
209
+ - Total number of aspect buckets: 14
210
+ - Resolution: 1.6384 megapixels
211
+ - Cropped: True
212
+ - Crop style: random
213
+ - Crop aspect: closest
214
+ - Used for regularisation data: No
215
+ ### BESCH-ORIGINAL-SD35M-V03-512
216
+ - Repeats: 3
217
+ - Total number of images: 68
218
+ - Total number of aspect buckets: 3
219
+ - Resolution: 0.262144 megapixels
220
+ - Cropped: True
221
+ - Crop style: random
222
+ - Crop aspect: closest
223
+ - Used for regularisation data: No
224
+ ### BESCH-ORIGINAL-SD35M-V03-768
225
+ - Repeats: 3
226
+ - Total number of images: 68
227
+ - Total number of aspect buckets: 4
228
+ - Resolution: 0.589824 megapixels
229
+ - Cropped: True
230
+ - Crop style: random
231
+ - Crop aspect: closest
232
+ - Used for regularisation data: No
233
+ ### BESCH-ORIGINAL-SD35M-V03-1024
234
+ - Repeats: 3
235
+ - Total number of images: 68
236
+ - Total number of aspect buckets: 1
237
+ - Resolution: 1.048576 megapixels
238
+ - Cropped: True
239
+ - Crop style: random
240
+ - Crop aspect: closest
241
+ - Used for regularisation data: No
242
+
243
+
244
+ ## Inference
245
+
246
+
247
+ ```python
248
+ import torch
249
+ from diffusers import DiffusionPipeline
250
+ from lycoris import create_lycoris_from_weights
251
+
252
+
253
+ def download_adapter(repo_id: str):
254
+ import os
255
+ from huggingface_hub import hf_hub_download
256
+ adapter_filename = "pytorch_lora_weights.safetensors"
257
+ cache_dir = os.environ.get('HF_PATH', os.path.expanduser('~/.cache/huggingface/hub/models'))
258
+ cleaned_adapter_path = repo_id.replace("/", "_").replace("\\", "_").replace(":", "_")
259
+ path_to_adapter = os.path.join(cache_dir, cleaned_adapter_path)
260
+ path_to_adapter_file = os.path.join(path_to_adapter, adapter_filename)
261
+ os.makedirs(path_to_adapter, exist_ok=True)
262
+ hf_hub_download(
263
+ repo_id=repo_id, filename=adapter_filename, local_dir=path_to_adapter
264
+ )
265
+
266
+ return path_to_adapter_file
267
+
268
+ model_id = 'stabilityai/stable-diffusion-3.5-medium'
269
+ adapter_repo_id = 'gattaplayer/besch-style-st-sd35m-lokr-8e-5-bs6-v03'
270
+ adapter_filename = 'pytorch_lora_weights.safetensors'
271
+ adapter_file_path = download_adapter(repo_id=adapter_repo_id)
272
+ pipeline = DiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.bfloat16) # loading directly in bf16
273
+ lora_scale = 1.0
274
+ wrapper, _ = create_lycoris_from_weights(lora_scale, adapter_file_path, pipeline.transformer)
275
+ wrapper.merge_to()
276
+
277
+ prompt = "An astronaut is riding a horse through the jungles of Thailand."
278
+ negative_prompt = 'blurry, cropped, ugly'
279
+
280
+ ## Optional: quantise the model to save on vram.
281
+ ## Note: The model was quantised during training, and so it is recommended to do the same during inference time.
282
+ from optimum.quanto import quantize, freeze, qint8
283
+ quantize(pipeline.transformer, weights=qint8)
284
+ freeze(pipeline.transformer)
285
+
286
+ 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
287
+ image = pipeline(
288
+ prompt=prompt,
289
+ negative_prompt=negative_prompt,
290
+ num_inference_steps=30,
291
+ generator=torch.Generator(device='cuda' if torch.cuda.is_available() else 'mps' if torch.backends.mps.is_available() else 'cpu').manual_seed(42),
292
+ width=832,
293
+ height=1216,
294
+ guidance_scale=6.0,
295
+ skip_guidance_layers=[7, 8, 9],
296
+ ).images[0]
297
+ image.save("output.png", format="PNG")
298
+ ```
299
+