tz2026 commited on
Commit
d47e7c7
·
verified ·
1 Parent(s): f8c06ab

Model card auto-generated by SimpleTuner

Browse files
Files changed (1) hide show
  1. README.md +261 -0
README.md ADDED
@@ -0,0 +1,261 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: other
3
+ base_model: "flux/unknown-model"
4
+ tags:
5
+ - flux
6
+ - flux-diffusers
7
+ - text-to-image
8
+ - image-to-image
9
+ - diffusers
10
+ - simpletuner
11
+ - not-for-all-audiences
12
+ - lora
13
+ - template:sd-lora
14
+ - lycoris
15
+ pipeline_tag: text-to-image
16
+ inference: true
17
+ widget:
18
+ - text: 'unconditional (blank prompt)'
19
+ parameters:
20
+ negative_prompt: 'blurry, cropped, ugly'
21
+ output:
22
+ url: ./assets/image_0_0.png
23
+ - text: 'a breathtaking anime-style portrait of mydog2, capturing her essence with vibrant colors and expressive features'
24
+ parameters:
25
+ negative_prompt: 'blurry, cropped, ugly'
26
+ output:
27
+ url: ./assets/image_1_0.png
28
+ - text: 'a high-quality, detailed photograph of mydog2 as a sous-chef, immersed in the art of culinary creation'
29
+ parameters:
30
+ negative_prompt: 'blurry, cropped, ugly'
31
+ output:
32
+ url: ./assets/image_2_0.png
33
+ - text: 'a lifelike and intimate portrait of mydog2, showcasing her unique personality and charm'
34
+ parameters:
35
+ negative_prompt: 'blurry, cropped, ugly'
36
+ output:
37
+ url: ./assets/image_3_0.png
38
+ - text: 'a cinematic, visually stunning photo of mydog2, emphasizing her dramatic and captivating presence'
39
+ parameters:
40
+ negative_prompt: 'blurry, cropped, ugly'
41
+ output:
42
+ url: ./assets/image_4_0.png
43
+ - text: 'an elegant and timeless portrait of mydog2, exuding grace and sophistication'
44
+ parameters:
45
+ negative_prompt: 'blurry, cropped, ugly'
46
+ output:
47
+ url: ./assets/image_5_0.png
48
+ - text: 'a dynamic and adventurous photo of mydog2, captured in an exciting, action-filled moment'
49
+ parameters:
50
+ negative_prompt: 'blurry, cropped, ugly'
51
+ output:
52
+ url: ./assets/image_6_0.png
53
+ - text: 'a mysterious and enigmatic portrait of mydog2, shrouded in shadows and intrigue'
54
+ parameters:
55
+ negative_prompt: 'blurry, cropped, ugly'
56
+ output:
57
+ url: ./assets/image_7_0.png
58
+ - text: 'a vintage-style portrait of mydog2, evoking the charm and nostalgia of a bygone era'
59
+ parameters:
60
+ negative_prompt: 'blurry, cropped, ugly'
61
+ output:
62
+ url: ./assets/image_8_0.png
63
+ - text: 'an artistic and abstract representation of mydog2, blending creativity with visual storytelling'
64
+ parameters:
65
+ negative_prompt: 'blurry, cropped, ugly'
66
+ output:
67
+ url: ./assets/image_9_0.png
68
+ - text: 'a futuristic and cutting-edge portrayal of mydog2, set against a backdrop of advanced technology'
69
+ parameters:
70
+ negative_prompt: 'blurry, cropped, ugly'
71
+ output:
72
+ url: ./assets/image_10_0.png
73
+ - text: 'a beautifully crafted portrait of a woman, highlighting her natural beauty and unique features'
74
+ parameters:
75
+ negative_prompt: 'blurry, cropped, ugly'
76
+ output:
77
+ url: ./assets/image_11_0.png
78
+ - text: 'a powerful and striking portrait of a man, capturing his strength and character'
79
+ parameters:
80
+ negative_prompt: 'blurry, cropped, ugly'
81
+ output:
82
+ url: ./assets/image_12_0.png
83
+ - text: 'a playful and spirited portrait of a boy, capturing youthful energy and innocence'
84
+ parameters:
85
+ negative_prompt: 'blurry, cropped, ugly'
86
+ output:
87
+ url: ./assets/image_13_0.png
88
+ - text: 'a charming and vibrant portrait of a girl, emphasizing her bright personality and joy'
89
+ parameters:
90
+ negative_prompt: 'blurry, cropped, ugly'
91
+ output:
92
+ url: ./assets/image_14_0.png
93
+ - text: 'a heartwarming and cohesive family portrait, showcasing the bonds and connections between loved ones'
94
+ parameters:
95
+ negative_prompt: 'blurry, cropped, ugly'
96
+ output:
97
+ url: ./assets/image_15_0.png
98
+ - text: 'A photo-realistic image of a cat'
99
+ parameters:
100
+ negative_prompt: 'blurry, cropped, ugly'
101
+ output:
102
+ url: ./assets/image_16_0.png
103
+ ---
104
+
105
+ # simpletuner-lora
106
+
107
+ This is a LyCORIS adapter derived from [flux/unknown-model](https://huggingface.co/flux/unknown-model).
108
+
109
+
110
+ The main validation prompt used during training was:
111
+ ```
112
+ A photo-realistic image of a cat
113
+ ```
114
+
115
+
116
+ ## Validation settings
117
+ - CFG: `3.0`
118
+ - CFG Rescale: `0.0`
119
+ - Steps: `20`
120
+ - Sampler: `FlowMatchEulerDiscreteScheduler`
121
+ - Seed: `42`
122
+ - Resolution: `1024x1024`
123
+ - Skip-layer guidance:
124
+
125
+ Note: The validation settings are not necessarily the same as the [training settings](#training-settings).
126
+
127
+ You can find some example images in the following gallery:
128
+
129
+
130
+ <Gallery />
131
+
132
+ The text encoder **was not** trained.
133
+ You may reuse the base model text encoder for inference.
134
+
135
+
136
+ ## Training settings
137
+
138
+ - Training epochs: 0
139
+ - Training steps: 500
140
+ - Learning rate: 0.0001
141
+ - Learning rate schedule: polynomial
142
+ - Warmup steps: 100
143
+ - Max grad value: 2.0
144
+ - Effective batch size: 1
145
+ - Micro-batch size: 1
146
+ - Gradient accumulation steps: 1
147
+ - Number of GPUs: 1
148
+ - Gradient checkpointing: True
149
+ - Prediction type: flow-matching (extra parameters=['shift=3', 'flux_guidance_mode=constant', 'flux_guidance_value=1.0', 'flow_matching_loss=compatible'])
150
+ - Optimizer: adamw_bf16
151
+ - Trainable parameter precision: Pure BF16
152
+ - Base model precision: `no_change`
153
+ - Caption dropout probability: 10.0%
154
+
155
+
156
+
157
+ ### LyCORIS Config:
158
+ ```json
159
+ {
160
+ "algo": "lora",
161
+ "multiplier": 1.0,
162
+ "linear_dim": 64,
163
+ "linear_alpha": 32,
164
+ "apply_preset": {
165
+ "target_module": [
166
+ "Attention",
167
+ "FeedForward"
168
+ ],
169
+ "module_algo_map": {
170
+ "Attention": {
171
+ "factor": 16
172
+ },
173
+ "FeedForward": {
174
+ "factor": 8
175
+ }
176
+ }
177
+ }
178
+ }
179
+ ```
180
+
181
+
182
+ ## Datasets
183
+
184
+ ### dreambooth-subject
185
+ - Repeats: 1000
186
+ - Total number of images: 6
187
+ - Total number of aspect buckets: 1
188
+ - Resolution: 1.048576 megapixels
189
+ - Cropped: False
190
+ - Crop style: None
191
+ - Crop aspect: None
192
+ - Used for regularisation data: No
193
+ ### dreambooth-subject-512
194
+ - Repeats: 1000
195
+ - Total number of images: 6
196
+ - Total number of aspect buckets: 1
197
+ - Resolution: 0.262144 megapixels
198
+ - Cropped: False
199
+ - Crop style: None
200
+ - Crop aspect: None
201
+ - Used for regularisation data: No
202
+
203
+
204
+ ## Inference
205
+
206
+
207
+ ```python
208
+ import torch
209
+ from diffusers import DiffusionPipeline
210
+ from lycoris import create_lycoris_from_weights
211
+
212
+
213
+ def download_adapter(repo_id: str):
214
+ import os
215
+ from huggingface_hub import hf_hub_download
216
+ adapter_filename = "pytorch_lora_weights.safetensors"
217
+ cache_dir = os.environ.get('HF_PATH', os.path.expanduser('~/.cache/huggingface/hub/models'))
218
+ cleaned_adapter_path = repo_id.replace("/", "_").replace("\\", "_").replace(":", "_")
219
+ path_to_adapter = os.path.join(cache_dir, cleaned_adapter_path)
220
+ path_to_adapter_file = os.path.join(path_to_adapter, adapter_filename)
221
+ os.makedirs(path_to_adapter, exist_ok=True)
222
+ hf_hub_download(
223
+ repo_id=repo_id, filename=adapter_filename, local_dir=path_to_adapter
224
+ )
225
+
226
+ return path_to_adapter_file
227
+
228
+ model_id = '/root/autodl-tmp/black-forest-labs/FLUX.1-dev'
229
+ adapter_repo_id = 'tz2026/simpletuner-lora'
230
+ adapter_filename = 'pytorch_lora_weights.safetensors'
231
+ adapter_file_path = download_adapter(repo_id=adapter_repo_id)
232
+ pipeline = DiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.bfloat16) # loading directly in bf16
233
+ lora_scale = 1.0
234
+ wrapper, _ = create_lycoris_from_weights(lora_scale, adapter_file_path, pipeline.transformer)
235
+ wrapper.merge_to()
236
+
237
+ prompt = "A photo-realistic image of a cat"
238
+
239
+
240
+ ## Optional: quantise the model to save on vram.
241
+ ## Note: The model was not quantised during training, so it is not necessary to quantise it during inference time.
242
+ #from optimum.quanto import quantize, freeze, qint8
243
+ #quantize(pipeline.transformer, weights=qint8)
244
+ #freeze(pipeline.transformer)
245
+
246
+ 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
247
+ model_output = pipeline(
248
+ prompt=prompt,
249
+ num_inference_steps=20,
250
+ generator=torch.Generator(device='cuda' if torch.cuda.is_available() else 'mps' if torch.backends.mps.is_available() else 'cpu').manual_seed(42),
251
+ width=1024,
252
+ height=1024,
253
+ guidance_scale=3.0,
254
+ ).images[0]
255
+
256
+ model_output.save("output.png", format="PNG")
257
+
258
+ ```
259
+
260
+
261
+