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|
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: 'In the style of a c4ss4tt oil painting, A child wearing an elaborate blue silk dress with ruffles and white lace trim sits near a window, the fabric catching soft light.'
|
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 cheeks and delicate features, gentle lighting from a nearby window.'
|
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 window light falls across a child''s face and shoulder, creating bold shadows on their blue dress.'
|
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 blue hat stands by a window.'
|
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 soft colors holds her baby close.'
|
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 a detailed white lace dress reads while seated by a window with gauzy curtains, various textures visible in the furnishings.'
|
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 textured knit sweater checks her phone while her baby sleeps against her shoulder.'
|
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 cat grooms her kitten by a sunlit window, their fur catching the light.'
|
57 |
+
parameters:
|
58 |
+
negative_prompt: 'blurry, cropped, ugly'
|
59 |
+
output:
|
60 |
+
url: ./assets/image_8_0.png
|
61 |
+
---
|
62 |
+
|
63 |
+
# Mary-Cassatt-Oil-Crops-Phase-1-Beta-2-3-SS2_0-Flux-LoKr
|
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 |
+
|
71 |
+
|
72 |
+
|
73 |
+
None
|
74 |
+
|
75 |
+
|
76 |
+
## Validation settings
|
77 |
+
- CFG: `3.0`
|
78 |
+
- CFG Rescale: `0.0`
|
79 |
+
- Steps: `20`
|
80 |
+
- Sampler: `None`
|
81 |
+
- Seed: `42`
|
82 |
+
- Resolution: `1024x1024`
|
83 |
+
|
84 |
+
Note: The validation settings are not necessarily the same as the [training settings](#training-settings).
|
85 |
+
|
86 |
+
You can find some example images in the following gallery:
|
87 |
+
|
88 |
+
|
89 |
+
<Gallery />
|
90 |
+
|
91 |
+
The text encoder **was not** trained.
|
92 |
+
You may reuse the base model text encoder for inference.
|
93 |
+
|
94 |
+
|
95 |
+
## Training settings
|
96 |
+
|
97 |
+
- Training epochs: 0
|
98 |
+
- Training steps: 100
|
99 |
+
- Learning rate: 0.0006
|
100 |
+
- Max grad norm: 0.1
|
101 |
+
- Effective batch size: 4
|
102 |
+
- Micro-batch size: 4
|
103 |
+
- Gradient accumulation steps: 1
|
104 |
+
- Number of GPUs: 1
|
105 |
+
- Prediction type: flow-matching (extra parameters=['shift=2.0', 'flux_guidance_value=1.0', 'flux_beta_schedule_alpha=2.0', 'flux_beta_schedule_beta=3.0'])
|
106 |
+
- Rescaled betas zero SNR: False
|
107 |
+
- Optimizer: adamw_bf16
|
108 |
+
- Precision: Pure BF16
|
109 |
+
- Quantised: Yes: int8-quanto
|
110 |
+
- Xformers: Not used
|
111 |
+
- LyCORIS Config:
|
112 |
+
```json
|
113 |
+
{
|
114 |
+
"algo": "lokr",
|
115 |
+
"multiplier": 1.0,
|
116 |
+
"linear_dim": 10000,
|
117 |
+
"linear_alpha": 1,
|
118 |
+
"factor": 16,
|
119 |
+
"apply_preset": {
|
120 |
+
"target_module": [
|
121 |
+
"Attention",
|
122 |
+
"FeedForward"
|
123 |
+
],
|
124 |
+
"module_algo_map": {
|
125 |
+
"Attention": {
|
126 |
+
"factor": 16
|
127 |
+
},
|
128 |
+
"FeedForward": {
|
129 |
+
"factor": 8
|
130 |
+
}
|
131 |
+
}
|
132 |
+
}
|
133 |
+
}
|
134 |
+
```
|
135 |
+
|
136 |
+
## Datasets
|
137 |
+
|
138 |
+
### cassatt-detail-crops-512
|
139 |
+
- Repeats: 11
|
140 |
+
- Total number of images: 25
|
141 |
+
- Total number of aspect buckets: 10
|
142 |
+
- Resolution: 0.262144 megapixels
|
143 |
+
- Cropped: False
|
144 |
+
- Crop style: None
|
145 |
+
- Crop aspect: None
|
146 |
+
- Used for regularisation data: No
|
147 |
+
### cassatt-detail-crops-768
|
148 |
+
- Repeats: 11
|
149 |
+
- Total number of images: 25
|
150 |
+
- Total number of aspect buckets: 11
|
151 |
+
- Resolution: 0.589824 megapixels
|
152 |
+
- Cropped: False
|
153 |
+
- Crop style: None
|
154 |
+
- Crop aspect: None
|
155 |
+
- Used for regularisation data: No
|
156 |
+
### cassatt-detail-crops-1024
|
157 |
+
- Repeats: 5
|
158 |
+
- Total number of images: 25
|
159 |
+
- Total number of aspect buckets: 17
|
160 |
+
- Resolution: 1.048576 megapixels
|
161 |
+
- Cropped: False
|
162 |
+
- Crop style: None
|
163 |
+
- Crop aspect: None
|
164 |
+
- Used for regularisation data: No
|
165 |
+
|
166 |
+
|
167 |
+
## Inference
|
168 |
+
|
169 |
+
|
170 |
+
```python
|
171 |
+
import torch
|
172 |
+
from diffusers import DiffusionPipeline
|
173 |
+
from lycoris import create_lycoris_from_weights
|
174 |
+
|
175 |
+
|
176 |
+
def download_adapter(repo_id: str):
|
177 |
+
import os
|
178 |
+
from huggingface_hub import hf_hub_download
|
179 |
+
adapter_filename = "pytorch_lora_weights.safetensors"
|
180 |
+
cache_dir = os.environ.get('HF_PATH', os.path.expanduser('~/.cache/huggingface/hub/models'))
|
181 |
+
cleaned_adapter_path = repo_id.replace("/", "_").replace("\\", "_").replace(":", "_")
|
182 |
+
path_to_adapter = os.path.join(cache_dir, cleaned_adapter_path)
|
183 |
+
path_to_adapter_file = os.path.join(path_to_adapter, adapter_filename)
|
184 |
+
os.makedirs(path_to_adapter, exist_ok=True)
|
185 |
+
hf_hub_download(
|
186 |
+
repo_id=repo_id, filename=adapter_filename, local_dir=path_to_adapter
|
187 |
+
)
|
188 |
+
|
189 |
+
return path_to_adapter_file
|
190 |
+
|
191 |
+
model_id = 'black-forest-labs/FLUX.1-dev'
|
192 |
+
adapter_repo_id = 'davidrd123/Mary-Cassatt-Oil-Crops-Phase-1-Beta-2-3-SS2_0-Flux-LoKr'
|
193 |
+
adapter_filename = 'pytorch_lora_weights.safetensors'
|
194 |
+
adapter_file_path = download_adapter(repo_id=adapter_repo_id)
|
195 |
+
pipeline = DiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.bfloat16) # loading directly in bf16
|
196 |
+
lora_scale = 1.0
|
197 |
+
wrapper, _ = create_lycoris_from_weights(lora_scale, adapter_file_path, pipeline.transformer)
|
198 |
+
wrapper.merge_to()
|
199 |
+
|
200 |
+
prompt = "An astronaut is riding a horse through the jungles of Thailand."
|
201 |
+
|
202 |
+
|
203 |
+
## Optional: quantise the model to save on vram.
|
204 |
+
## Note: The model was quantised during training, and so it is recommended to do the same during inference time.
|
205 |
+
from optimum.quanto import quantize, freeze, qint8
|
206 |
+
quantize(pipeline.transformer, weights=qint8)
|
207 |
+
freeze(pipeline.transformer)
|
208 |
+
|
209 |
+
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
|
210 |
+
image = pipeline(
|
211 |
+
prompt=prompt,
|
212 |
+
num_inference_steps=20,
|
213 |
+
generator=torch.Generator(device='cuda' if torch.cuda.is_available() else 'mps' if torch.backends.mps.is_available() else 'cpu').manual_seed(1641421826),
|
214 |
+
width=1024,
|
215 |
+
height=1024,
|
216 |
+
guidance_scale=3.0,
|
217 |
+
).images[0]
|
218 |
+
image.save("output.png", format="PNG")
|
219 |
+
```
|
220 |
+
|