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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
- standard
|
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 b3nbr4nd painting, A steaming bowl of ramen with chopsticks resting on the edge, against a background of concentric orange and blue circles. The noodles are detailed in a geometric pattern and the steam creates a rhythmic design.'
|
22 |
+
parameters:
|
23 |
+
negative_prompt: 'blurry, cropped, ugly'
|
24 |
+
output:
|
25 |
+
url: ./assets/image_1_0.png
|
26 |
+
- text: 'In the style of a b3nbr4nd painting, A vintage record player with vinyl spinning, set on a yellow table. The background features an alternating chevron pattern in purple and green. The turntable''s mechanical parts are rendered in precise geometric shapes.'
|
27 |
+
parameters:
|
28 |
+
negative_prompt: 'blurry, cropped, ugly'
|
29 |
+
output:
|
30 |
+
url: ./assets/image_2_0.png
|
31 |
+
- text: 'In the style of a b3nbr4nd painting, A sleeping cat curled up in a modernist chair, with a background of interlocking hexagons in red and blue. The cat''s fur is stylized into rhythmic curves, matching the geometric environment.'
|
32 |
+
parameters:
|
33 |
+
negative_prompt: 'blurry, cropped, ugly'
|
34 |
+
output:
|
35 |
+
url: ./assets/image_3_0.png
|
36 |
+
- text: 'In the style of a b3nbr4nd painting, A classic motorcycle viewed from the side, against a backdrop of radiating diamond patterns in teal and gold. The chrome parts reflect abstract shapes, and the wheels create circular motifs in the composition.'
|
37 |
+
parameters:
|
38 |
+
negative_prompt: 'blurry, cropped, ugly'
|
39 |
+
output:
|
40 |
+
url: ./assets/image_4_0.png
|
41 |
+
- text: 'In the style of a b3nbr4nd painting, Portrait of a woman with silver hair wearing dotted blue glasses and a white lace collar, against a swirling background of green and yellow patterns. The background features geometric circles and zigzag designs.'
|
42 |
+
parameters:
|
43 |
+
negative_prompt: 'blurry, cropped, ugly'
|
44 |
+
output:
|
45 |
+
url: ./assets/image_5_0.png
|
46 |
+
- text: 'In the style of a b3nbr4nd painting, A storefront sign for ''Golden Palace Noodles'' in both English and Chinese characters, mounted on a tall pole against a geometric cityscape with blue and tan buildings. A small arrow points to available parking.'
|
47 |
+
parameters:
|
48 |
+
negative_prompt: 'blurry, cropped, ugly'
|
49 |
+
output:
|
50 |
+
url: ./assets/image_6_0.png
|
51 |
+
- text: 'In the style of a b3nbr4nd painting, Dark purple figs sliced in half on a terra cotta plate, revealing their seeded interiors. The background features a repeating pattern of blue and yellow squares, with wavy lines creating a dynamic lower section.'
|
52 |
+
parameters:
|
53 |
+
negative_prompt: 'blurry, cropped, ugly'
|
54 |
+
output:
|
55 |
+
url: ./assets/image_7_0.png
|
56 |
+
- text: 'In the style of a b3nbr4nd painting, Two young people wearing matching navy shirts and light gray face masks, posed against a warm yellow background. Their curly hair and gentle head tilts create a symmetrical composition.'
|
57 |
+
parameters:
|
58 |
+
negative_prompt: 'blurry, cropped, ugly'
|
59 |
+
output:
|
60 |
+
url: ./assets/image_8_0.png
|
61 |
+
- text: 'In the style of a b3nbr4nd painting, A hamster wearing tiny glasses and a bowtie sitting at a miniature desk with a tiny laptop, against a background of spiral patterns in teal and orange. Office supplies scaled to hamster-size are arranged neatly on the desk.'
|
62 |
+
parameters:
|
63 |
+
negative_prompt: 'blurry, cropped, ugly'
|
64 |
+
output:
|
65 |
+
url: ./assets/image_9_0.png
|
66 |
+
- text: 'In the style of a b3nbr4nd painting, A bearded man in a plaid shirt and denim apron carefully sanding a mid-century modern chair, surrounded by woodworking tools. The background features overlapping triangles in rust and navy blue colors, with sawdust creating delicate patterns in the air.'
|
67 |
+
parameters:
|
68 |
+
negative_prompt: 'blurry, cropped, ugly'
|
69 |
+
output:
|
70 |
+
url: ./assets/image_10_0.png
|
71 |
+
---
|
72 |
+
|
73 |
+
# Ben-Brand-LoRA
|
74 |
+
|
75 |
+
This is a standard PEFT LoRA derived from [black-forest-labs/FLUX.1-dev](https://huggingface.co/black-forest-labs/FLUX.1-dev).
|
76 |
+
|
77 |
+
|
78 |
+
No validation prompt was used during training.
|
79 |
+
|
80 |
+
None
|
81 |
+
|
82 |
+
|
83 |
+
|
84 |
+
## Validation settings
|
85 |
+
- CFG: `3.0`
|
86 |
+
- CFG Rescale: `0.0`
|
87 |
+
- Steps: `20`
|
88 |
+
- Sampler: `FlowMatchEulerDiscreteScheduler`
|
89 |
+
- Seed: `42`
|
90 |
+
- Resolution: `1024x1024`
|
91 |
+
- Skip-layer guidance:
|
92 |
+
|
93 |
+
Note: The validation settings are not necessarily the same as the [training settings](#training-settings).
|
94 |
+
|
95 |
+
You can find some example images in the following gallery:
|
96 |
+
|
97 |
+
|
98 |
+
<Gallery />
|
99 |
+
|
100 |
+
The text encoder **was not** trained.
|
101 |
+
You may reuse the base model text encoder for inference.
|
102 |
+
|
103 |
+
|
104 |
+
## Training settings
|
105 |
+
|
106 |
+
- Training epochs: 0
|
107 |
+
- Training steps: 500
|
108 |
+
- Learning rate: 0.0001
|
109 |
+
- Learning rate schedule: polynomial
|
110 |
+
- Warmup steps: 100
|
111 |
+
- Max grad norm: 0.1
|
112 |
+
- Effective batch size: 6
|
113 |
+
- Micro-batch size: 2
|
114 |
+
- Gradient accumulation steps: 3
|
115 |
+
- Number of GPUs: 1
|
116 |
+
- Gradient checkpointing: True
|
117 |
+
- Prediction type: flow-matching (extra parameters=['shift=3', 'flux_guidance_mode=constant', 'flux_guidance_value=1.0', 'flow_matching_loss=compatible', 'flux_lora_target=all'])
|
118 |
+
- Optimizer: adamw_bf16
|
119 |
+
- Trainable parameter precision: Pure BF16
|
120 |
+
- Caption dropout probability: 10.0%
|
121 |
+
|
122 |
+
|
123 |
+
- LoRA Rank: 64
|
124 |
+
- LoRA Alpha: None
|
125 |
+
- LoRA Dropout: 0.1
|
126 |
+
- LoRA initialisation style: default
|
127 |
+
|
128 |
+
|
129 |
+
## Datasets
|
130 |
+
|
131 |
+
### ben-brand-256
|
132 |
+
- Repeats: 10
|
133 |
+
- Total number of images: 98
|
134 |
+
- Total number of aspect buckets: 1
|
135 |
+
- Resolution: 0.065536 megapixels
|
136 |
+
- Cropped: False
|
137 |
+
- Crop style: None
|
138 |
+
- Crop aspect: None
|
139 |
+
- Used for regularisation data: No
|
140 |
+
### ben-brand-crop-256
|
141 |
+
- Repeats: 10
|
142 |
+
- Total number of images: 98
|
143 |
+
- Total number of aspect buckets: 1
|
144 |
+
- Resolution: 0.065536 megapixels
|
145 |
+
- Cropped: True
|
146 |
+
- Crop style: center
|
147 |
+
- Crop aspect: square
|
148 |
+
- Used for regularisation data: No
|
149 |
+
### ben-brand-512
|
150 |
+
- Repeats: 10
|
151 |
+
- Total number of images: 98
|
152 |
+
- Total number of aspect buckets: 1
|
153 |
+
- Resolution: 0.262144 megapixels
|
154 |
+
- Cropped: False
|
155 |
+
- Crop style: None
|
156 |
+
- Crop aspect: None
|
157 |
+
- Used for regularisation data: No
|
158 |
+
### ben-brand-crop-512
|
159 |
+
- Repeats: 10
|
160 |
+
- Total number of images: 98
|
161 |
+
- Total number of aspect buckets: 1
|
162 |
+
- Resolution: 0.262144 megapixels
|
163 |
+
- Cropped: True
|
164 |
+
- Crop style: center
|
165 |
+
- Crop aspect: square
|
166 |
+
- Used for regularisation data: No
|
167 |
+
### ben-brand-768
|
168 |
+
- Repeats: 10
|
169 |
+
- Total number of images: 98
|
170 |
+
- Total number of aspect buckets: 1
|
171 |
+
- Resolution: 0.589824 megapixels
|
172 |
+
- Cropped: False
|
173 |
+
- Crop style: None
|
174 |
+
- Crop aspect: None
|
175 |
+
- Used for regularisation data: No
|
176 |
+
### ben-brand-crop-768
|
177 |
+
- Repeats: 10
|
178 |
+
- Total number of images: 98
|
179 |
+
- Total number of aspect buckets: 1
|
180 |
+
- Resolution: 0.589824 megapixels
|
181 |
+
- Cropped: True
|
182 |
+
- Crop style: center
|
183 |
+
- Crop aspect: square
|
184 |
+
- Used for regularisation data: No
|
185 |
+
### ben-brand-1024
|
186 |
+
- Repeats: 10
|
187 |
+
- Total number of images: 98
|
188 |
+
- Total number of aspect buckets: 1
|
189 |
+
- Resolution: 1.048576 megapixels
|
190 |
+
- Cropped: False
|
191 |
+
- Crop style: None
|
192 |
+
- Crop aspect: None
|
193 |
+
- Used for regularisation data: No
|
194 |
+
### ben-brand-crop-1024
|
195 |
+
- Repeats: 10
|
196 |
+
- Total number of images: 98
|
197 |
+
- Total number of aspect buckets: 1
|
198 |
+
- Resolution: 1.048576 megapixels
|
199 |
+
- Cropped: True
|
200 |
+
- Crop style: center
|
201 |
+
- Crop aspect: square
|
202 |
+
- Used for regularisation data: No
|
203 |
+
### ben-brand-1440
|
204 |
+
- Repeats: 10
|
205 |
+
- Total number of images: 98
|
206 |
+
- Total number of aspect buckets: 2
|
207 |
+
- Resolution: 2.0736 megapixels
|
208 |
+
- Cropped: False
|
209 |
+
- Crop style: None
|
210 |
+
- Crop aspect: None
|
211 |
+
- Used for regularisation data: No
|
212 |
+
### ben-brand-crop-1440
|
213 |
+
- Repeats: 10
|
214 |
+
- Total number of images: 98
|
215 |
+
- Total number of aspect buckets: 1
|
216 |
+
- Resolution: 2.0736 megapixels
|
217 |
+
- Cropped: True
|
218 |
+
- Crop style: center
|
219 |
+
- Crop aspect: square
|
220 |
+
- Used for regularisation data: No
|
221 |
+
|
222 |
+
|
223 |
+
## Inference
|
224 |
+
|
225 |
+
|
226 |
+
```python
|
227 |
+
import torch
|
228 |
+
from diffusers import DiffusionPipeline
|
229 |
+
|
230 |
+
model_id = 'black-forest-labs/FLUX.1-dev'
|
231 |
+
adapter_id = 'davidrd123/Ben-Brand-LoRA'
|
232 |
+
pipeline = DiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.bfloat16) # loading directly in bf16
|
233 |
+
pipeline.load_lora_weights(adapter_id)
|
234 |
+
|
235 |
+
prompt = "An astronaut is riding a horse through the jungles of Thailand."
|
236 |
+
|
237 |
+
|
238 |
+
## Optional: quantise the model to save on vram.
|
239 |
+
## Note: The model was quantised during training, and so it is recommended to do the same during inference time.
|
240 |
+
from optimum.quanto import quantize, freeze, qint8
|
241 |
+
quantize(pipeline.transformer, weights=qint8)
|
242 |
+
freeze(pipeline.transformer)
|
243 |
+
|
244 |
+
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
|
245 |
+
image = pipeline(
|
246 |
+
prompt=prompt,
|
247 |
+
num_inference_steps=20,
|
248 |
+
generator=torch.Generator(device='cuda' if torch.cuda.is_available() else 'mps' if torch.backends.mps.is_available() else 'cpu').manual_seed(42),
|
249 |
+
width=1024,
|
250 |
+
height=1024,
|
251 |
+
guidance_scale=3.0,
|
252 |
+
).images[0]
|
253 |
+
image.save("output.png", format="PNG")
|
254 |
+
```
|
255 |
+
|
256 |
+
|
257 |
+
|