playerzer0x commited on
Commit
57e28a6
·
verified ·
1 Parent(s): a3edf9d

Model card auto-generated by SimpleTuner

Browse files
Files changed (1) hide show
  1. README.md +210 -0
README.md ADDED
@@ -0,0 +1,210 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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: 'dsndsn robe, light-skinned man with long brown hair, green and white stripes with orange and purple accents, white background'
22
+ parameters:
23
+ negative_prompt: 'blurry, cropped, ugly'
24
+ output:
25
+ url: ./assets/image_1_0.png
26
+ - text: 'dsndsn robe, half blue and white and red and white stripes with green teal and red mint green and yellow white accents, light-skinned man with long blonde hair, beige and eggshell curtains in background'
27
+ parameters:
28
+ negative_prompt: 'blurry, cropped, ugly'
29
+ output:
30
+ url: ./assets/image_2_0.png
31
+ - text: 'dsndsn robe, green and white pseudo-tile pattern, red and cream polka-dot pattern, light-skinned man with curly brown hair and light-skinned asian man, giving the peace sign with his fingers, light-skinned asian man leaning against light-skinned man with curly brown hair, white background'
32
+ parameters:
33
+ negative_prompt: 'blurry, cropped, ugly'
34
+ output:
35
+ url: ./assets/image_3_0.png
36
+ - text: 'dsndsn pattern, green and yellow apron, on a fuzzy beige carpet'
37
+ parameters:
38
+ negative_prompt: 'blurry, cropped, ugly'
39
+ output:
40
+ url: ./assets/image_4_0.png
41
+ - text: 'a photo of a daisy'
42
+ parameters:
43
+ negative_prompt: 'blurry, cropped, ugly'
44
+ output:
45
+ url: ./assets/image_5_0.png
46
+ ---
47
+
48
+ # growwithdaisy/glssrxdsndsn_flat_20241209_212811
49
+
50
+ This is a LyCORIS adapter derived from [black-forest-labs/FLUX.1-dev](https://huggingface.co/black-forest-labs/FLUX.1-dev).
51
+
52
+
53
+ The main validation prompt used during training was:
54
+ ```
55
+ a photo of a daisy
56
+ ```
57
+
58
+
59
+ ## Validation settings
60
+ - CFG: `3.5`
61
+ - CFG Rescale: `0.0`
62
+ - Steps: `20`
63
+ - Sampler: `FlowMatchEulerDiscreteScheduler`
64
+ - Seed: `69`
65
+ - Resolution: `1024x1024`
66
+ - Skip-layer guidance:
67
+
68
+ Note: The validation settings are not necessarily the same as the [training settings](#training-settings).
69
+
70
+ You can find some example images in the following gallery:
71
+
72
+
73
+ <Gallery />
74
+
75
+ The text encoder **was not** trained.
76
+ You may reuse the base model text encoder for inference.
77
+
78
+
79
+ ## Training settings
80
+
81
+ - Training epochs: 3
82
+ - Training steps: 500
83
+ - Learning rate: 0.0001
84
+ - Learning rate schedule: constant
85
+ - Warmup steps: 0
86
+ - Max grad norm: 2.0
87
+ - Effective batch size: 8
88
+ - Micro-batch size: 2
89
+ - Gradient accumulation steps: 1
90
+ - Number of GPUs: 4
91
+ - Gradient checkpointing: True
92
+ - Prediction type: flow-matching (extra parameters=['shift=3', 'flux_guidance_mode=constant', 'flux_guidance_value=1.0', 'flow_matching_loss=compatible'])
93
+ - Optimizer: optimi-stableadamwweight_decay=1e-3
94
+ - Trainable parameter precision: Pure BF16
95
+ - Caption dropout probability: 5.0%
96
+
97
+
98
+ ### LyCORIS Config:
99
+ ```json
100
+ {
101
+ "algo": "lokr",
102
+ "multiplier": 1,
103
+ "linear_dim": 1000000,
104
+ "linear_alpha": 1,
105
+ "factor": 16,
106
+ "init_lokr_norm": 0.001,
107
+ "apply_preset": {
108
+ "target_module": [
109
+ "FluxTransformerBlock",
110
+ "FluxSingleTransformerBlock"
111
+ ],
112
+ "module_algo_map": {
113
+ "Attention": {
114
+ "factor": 16
115
+ },
116
+ "FeedForward": {
117
+ "factor": 8
118
+ }
119
+ }
120
+ }
121
+ }
122
+ ```
123
+
124
+ ## Datasets
125
+
126
+ ### glssrxdsndsn_flat-512
127
+ - Repeats: 0
128
+ - Total number of images: ~320
129
+ - Total number of aspect buckets: 2
130
+ - Resolution: 0.262144 megapixels
131
+ - Cropped: False
132
+ - Crop style: None
133
+ - Crop aspect: None
134
+ - Used for regularisation data: No
135
+ ### glssrxdsndsn_flat-768
136
+ - Repeats: 0
137
+ - Total number of images: ~280
138
+ - Total number of aspect buckets: 5
139
+ - Resolution: 0.589824 megapixels
140
+ - Cropped: False
141
+ - Crop style: None
142
+ - Crop aspect: None
143
+ - Used for regularisation data: No
144
+ ### glssrxdsndsn_flat-1024
145
+ - Repeats: 1
146
+ - Total number of images: ~204
147
+ - Total number of aspect buckets: 12
148
+ - Resolution: 1.048576 megapixels
149
+ - Cropped: False
150
+ - Crop style: None
151
+ - Crop aspect: None
152
+ - Used for regularisation data: No
153
+
154
+
155
+ ## Inference
156
+
157
+
158
+ ```python
159
+ import torch
160
+ from diffusers import DiffusionPipeline
161
+ from lycoris import create_lycoris_from_weights
162
+
163
+
164
+ def download_adapter(repo_id: str):
165
+ import os
166
+ from huggingface_hub import hf_hub_download
167
+ adapter_filename = "pytorch_lora_weights.safetensors"
168
+ cache_dir = os.environ.get('HF_PATH', os.path.expanduser('~/.cache/huggingface/hub/models'))
169
+ cleaned_adapter_path = repo_id.replace("/", "_").replace("\\", "_").replace(":", "_")
170
+ path_to_adapter = os.path.join(cache_dir, cleaned_adapter_path)
171
+ path_to_adapter_file = os.path.join(path_to_adapter, adapter_filename)
172
+ os.makedirs(path_to_adapter, exist_ok=True)
173
+ hf_hub_download(
174
+ repo_id=repo_id, filename=adapter_filename, local_dir=path_to_adapter
175
+ )
176
+
177
+ return path_to_adapter_file
178
+
179
+ model_id = 'black-forest-labs/FLUX.1-dev'
180
+ adapter_repo_id = 'playerzer0x/growwithdaisy/glssrxdsndsn_flat_20241209_212811'
181
+ adapter_filename = 'pytorch_lora_weights.safetensors'
182
+ adapter_file_path = download_adapter(repo_id=adapter_repo_id)
183
+ pipeline = DiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.bfloat16) # loading directly in bf16
184
+ lora_scale = 1.0
185
+ wrapper, _ = create_lycoris_from_weights(lora_scale, adapter_file_path, pipeline.transformer)
186
+ wrapper.merge_to()
187
+
188
+ prompt = "a photo of a daisy"
189
+
190
+
191
+ ## Optional: quantise the model to save on vram.
192
+ ## Note: The model was not quantised during training, so it is not necessary to quantise it during inference time.
193
+ #from optimum.quanto import quantize, freeze, qint8
194
+ #quantize(pipeline.transformer, weights=qint8)
195
+ #freeze(pipeline.transformer)
196
+
197
+ 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
198
+ image = pipeline(
199
+ prompt=prompt,
200
+ num_inference_steps=20,
201
+ generator=torch.Generator(device='cuda' if torch.cuda.is_available() else 'mps' if torch.backends.mps.is_available() else 'cpu').manual_seed(69),
202
+ width=1024,
203
+ height=1024,
204
+ guidance_scale=3.5,
205
+ ).images[0]
206
+ image.save("output.png", format="PNG")
207
+ ```
208
+
209
+
210
+