davidrd123 commited on
Commit
ad69e11
1 Parent(s): e8392c5

Model card auto-generated by SimpleTuner

Browse files
Files changed (1) hide show
  1. README.md +242 -0
README.md ADDED
@@ -0,0 +1,242 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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: 'In the style of a c4ss4tt oil painting, A child wearing an elaborate blue silk dress with tiered ruffles, pin-tucked bodice, and white valenciennes lace trim sits near a tall window. The afternoon light catches each fold and pleat, revealing the fabric''s subtle sheen and varied textures. A white satin bow adorns the child''s collar.'
22
+ parameters:
23
+ negative_prompt: 'blurry, cropped, ugly'
24
+ output:
25
+ url: ./assets/image_1_0.png
26
+ - text: 'In the style of a c4ss4tt oil painting, A close portrait of a young child''s face with rosy apple cheeks, naturally flushed complexion, and delicate features typical of the artist. Soft directional light from a nearby window creates subtle shadows under the child''s rounded chin. Their brown hair falls in loose natural curls around their face.'
27
+ parameters:
28
+ negative_prompt: 'blurry, cropped, ugly'
29
+ output:
30
+ url: ./assets/image_2_0.png
31
+ - text: 'In the style of a c4ss4tt oil painting, Strong afternoon light streams through a partially curtained window, falling dramatically across a child''s face and shoulder, casting deep shadows on their cornflower blue dress. The contrast highlights the child''s profile and the crisp white collar at their neck. The background fades to muted, warm tones.'
32
+ parameters:
33
+ negative_prompt: 'blurry, cropped, ugly'
34
+ output:
35
+ url: ./assets/image_3_0.png
36
+ - text: 'In the style of a c4ss4tt oil painting, A child in a wide-brimmed navy blue hat with a white ribbon stands in profile by a tall window. The background is intentionally sparse with soft, neutral tones. The child''s face is partially shadowed by the hat''s brim.'
37
+ parameters:
38
+ negative_prompt: 'blurry, cropped, ugly'
39
+ output:
40
+ url: ./assets/image_4_0.png
41
+ - text: 'In the style of a c4ss4tt oil painting, A woman in a cream-colored dress holds her sleeping baby close to her shoulder, their faces touching. The composition is deliberately simple, set against a plain wall with subtle blue undertones. The baby''s hand rests gently on the mother''s collar.'
42
+ parameters:
43
+ negative_prompt: 'blurry, cropped, ugly'
44
+ output:
45
+ url: ./assets/image_5_0.png
46
+ - text: 'In the style of a c4ss4tt oil painting, A woman in an intricately detailed white lace dress with high collar reads while seated in a damask-upholstered chair by a window with gauzy muslin curtains. A patterned Oriental rug lies beneath, a brass lamp with crystal drops stands nearby, and a Chinese porcelain vase with camellias rests on a mahogany side table.'
47
+ parameters:
48
+ negative_prompt: 'blurry, cropped, ugly'
49
+ output:
50
+ url: ./assets/image_6_0.png
51
+ - text: 'In the style of a c4ss4tt oil painting, A mother in a chunky cream cable-knit sweater checks her smartphone while her baby sleeps against her shoulder. The device''s blue light reflects subtly on her face, while warm lamplight illuminates the scene. The baby wears contemporary striped pajamas.'
52
+ parameters:
53
+ negative_prompt: 'blurry, cropped, ugly'
54
+ output:
55
+ url: ./assets/image_7_0.png
56
+ - text: 'In the style of a c4ss4tt oil painting, A mother Persian cat with long silver fur grooms her cream-colored kitten by a sunlit window with lace curtains. Their fur catches the morning light, creating a soft halo effect. A blue and white porcelain bowl sits nearby on the window sill.'
57
+ parameters:
58
+ negative_prompt: 'blurry, cropped, ugly'
59
+ output:
60
+ url: ./assets/image_8_0.png
61
+ ---
62
+
63
+ # Cassatt-AdjustedCrops-Flux-LoKr-4e-4
64
+
65
+ This is a LyCORIS adapter derived from [black-forest-labs/FLUX.1-dev](https://huggingface.co/black-forest-labs/FLUX.1-dev).
66
+
67
+
68
+ No validation prompt was used during training.
69
+
70
+ None
71
+
72
+
73
+
74
+ ## Validation settings
75
+ - CFG: `3.0`
76
+ - CFG Rescale: `0.0`
77
+ - Steps: `20`
78
+ - Sampler: `FlowMatchEulerDiscreteScheduler`
79
+ - Seed: `42`
80
+ - Resolution: `1024x1024`
81
+ - Skip-layer guidance:
82
+
83
+ Note: The validation settings are not necessarily the same as the [training settings](#training-settings).
84
+
85
+ You can find some example images in the following gallery:
86
+
87
+
88
+ <Gallery />
89
+
90
+ The text encoder **was not** trained.
91
+ You may reuse the base model text encoder for inference.
92
+
93
+
94
+ ## Training settings
95
+
96
+ - Training epochs: 0
97
+ - Training steps: 250
98
+ - Learning rate: 0.0003
99
+ - Learning rate schedule: polynomial
100
+ - Warmup steps: 200
101
+ - Max grad norm: 2.0
102
+ - Effective batch size: 3
103
+ - Micro-batch size: 3
104
+ - Gradient accumulation steps: 1
105
+ - Number of GPUs: 1
106
+ - Gradient checkpointing: True
107
+ - Prediction type: flow-matching (extra parameters=['shift=3', 'flux_guidance_mode=constant', 'flux_guidance_value=1.0', 'flow_matching_loss=compatible'])
108
+ - Optimizer: adamw_bf16
109
+ - Trainable parameter precision: Pure BF16
110
+ - Caption dropout probability: 10.0%
111
+
112
+
113
+ ### LyCORIS Config:
114
+ ```json
115
+ {
116
+ "algo": "lokr",
117
+ "multiplier": 1.0,
118
+ "linear_dim": 10000,
119
+ "linear_alpha": 1,
120
+ "factor": 16,
121
+ "apply_preset": {
122
+ "target_module": [
123
+ "Attention",
124
+ "FeedForward"
125
+ ],
126
+ "module_algo_map": {
127
+ "Attention": {
128
+ "factor": 16
129
+ },
130
+ "FeedForward": {
131
+ "factor": 8
132
+ }
133
+ }
134
+ }
135
+ }
136
+ ```
137
+
138
+ ## Datasets
139
+
140
+ ### cassatt-512
141
+ - Repeats: 10
142
+ - Total number of images: 16
143
+ - Total number of aspect buckets: 6
144
+ - Resolution: 0.262144 megapixels
145
+ - Cropped: False
146
+ - Crop style: None
147
+ - Crop aspect: None
148
+ - Used for regularisation data: No
149
+ ### cassatt-1024
150
+ - Repeats: 10
151
+ - Total number of images: 16
152
+ - Total number of aspect buckets: 8
153
+ - Resolution: 1.048576 megapixels
154
+ - Cropped: False
155
+ - Crop style: None
156
+ - Crop aspect: None
157
+ - Used for regularisation data: No
158
+ ### cassatt-1536
159
+ - Repeats: 5
160
+ - Total number of images: 16
161
+ - Total number of aspect buckets: 10
162
+ - Resolution: 2.359296 megapixels
163
+ - Cropped: False
164
+ - Crop style: None
165
+ - Crop aspect: None
166
+ - Used for regularisation data: No
167
+ ### cassatt-crops-512
168
+ - Repeats: 10
169
+ - Total number of images: 16
170
+ - Total number of aspect buckets: 1
171
+ - Resolution: 0.262144 megapixels
172
+ - Cropped: True
173
+ - Crop style: random
174
+ - Crop aspect: square
175
+ - Used for regularisation data: No
176
+ ### cassatt-crops-1024
177
+ - Repeats: 10
178
+ - Total number of images: 16
179
+ - Total number of aspect buckets: 1
180
+ - Resolution: 1.048576 megapixels
181
+ - Cropped: True
182
+ - Crop style: random
183
+ - Crop aspect: square
184
+ - Used for regularisation data: No
185
+
186
+
187
+ ## Inference
188
+
189
+
190
+ ```python
191
+ import torch
192
+ from diffusers import DiffusionPipeline
193
+ from lycoris import create_lycoris_from_weights
194
+
195
+
196
+ def download_adapter(repo_id: str):
197
+ import os
198
+ from huggingface_hub import hf_hub_download
199
+ adapter_filename = "pytorch_lora_weights.safetensors"
200
+ cache_dir = os.environ.get('HF_PATH', os.path.expanduser('~/.cache/huggingface/hub/models'))
201
+ cleaned_adapter_path = repo_id.replace("/", "_").replace("\\", "_").replace(":", "_")
202
+ path_to_adapter = os.path.join(cache_dir, cleaned_adapter_path)
203
+ path_to_adapter_file = os.path.join(path_to_adapter, adapter_filename)
204
+ os.makedirs(path_to_adapter, exist_ok=True)
205
+ hf_hub_download(
206
+ repo_id=repo_id, filename=adapter_filename, local_dir=path_to_adapter
207
+ )
208
+
209
+ return path_to_adapter_file
210
+
211
+ model_id = 'black-forest-labs/FLUX.1-dev'
212
+ adapter_repo_id = 'davidrd123/Cassatt-AdjustedCrops-Flux-LoKr-4e-4'
213
+ adapter_filename = 'pytorch_lora_weights.safetensors'
214
+ adapter_file_path = download_adapter(repo_id=adapter_repo_id)
215
+ pipeline = DiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.bfloat16) # loading directly in bf16
216
+ lora_scale = 1.0
217
+ wrapper, _ = create_lycoris_from_weights(lora_scale, adapter_file_path, pipeline.transformer)
218
+ wrapper.merge_to()
219
+
220
+ prompt = "An astronaut is riding a horse through the jungles of Thailand."
221
+
222
+
223
+ ## Optional: quantise the model to save on vram.
224
+ ## Note: The model was quantised during training, and so it is recommended to do the same during inference time.
225
+ from optimum.quanto import quantize, freeze, qint8
226
+ quantize(pipeline.transformer, weights=qint8)
227
+ freeze(pipeline.transformer)
228
+
229
+ 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
230
+ image = pipeline(
231
+ prompt=prompt,
232
+ num_inference_steps=20,
233
+ generator=torch.Generator(device='cuda' if torch.cuda.is_available() else 'mps' if torch.backends.mps.is_available() else 'cpu').manual_seed(42),
234
+ width=1024,
235
+ height=1024,
236
+ guidance_scale=3.0,
237
+ ).images[0]
238
+ image.save("output.png", format="PNG")
239
+ ```
240
+
241
+
242
+