Model card auto-generated by SimpleTuner
Browse files
README.md
ADDED
@@ -0,0 +1,137 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: creativeml-openrail-m
|
3 |
+
base_model: "stabilityai/stable-diffusion-xl-base-1.0"
|
4 |
+
tags:
|
5 |
+
- sdxl
|
6 |
+
- sdxl-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 |
+
- standard
|
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 photo-realistic image of a cat'
|
24 |
+
parameters:
|
25 |
+
negative_prompt: 'blurry, cropped, ugly'
|
26 |
+
output:
|
27 |
+
url: ./assets/image_1_0.png
|
28 |
+
---
|
29 |
+
|
30 |
+
# simpletuner-sdxl-lora-test
|
31 |
+
|
32 |
+
This is a standard PEFT LoRA derived from [stabilityai/stable-diffusion-xl-base-1.0](https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0).
|
33 |
+
|
34 |
+
The main validation prompt used during training was:
|
35 |
+
```
|
36 |
+
A photo-realistic image of a cat
|
37 |
+
```
|
38 |
+
|
39 |
+
|
40 |
+
## Validation settings
|
41 |
+
- CFG: `4.2`
|
42 |
+
- CFG Rescale: `0.0`
|
43 |
+
- Steps: `20`
|
44 |
+
- Sampler: `ddim`
|
45 |
+
- Seed: `42`
|
46 |
+
- Resolution: `1024x1024`
|
47 |
+
|
48 |
+
|
49 |
+
Note: The validation settings are not necessarily the same as the [training settings](#training-settings).
|
50 |
+
|
51 |
+
You can find some example images in the following gallery:
|
52 |
+
|
53 |
+
|
54 |
+
<Gallery />
|
55 |
+
|
56 |
+
The text encoder **was not** trained.
|
57 |
+
You may reuse the base model text encoder for inference.
|
58 |
+
|
59 |
+
|
60 |
+
## Training settings
|
61 |
+
|
62 |
+
- Training epochs: 0
|
63 |
+
- Training steps: 10
|
64 |
+
- Learning rate: 3e-07
|
65 |
+
- Learning rate schedule: constant
|
66 |
+
- Warmup steps: 100
|
67 |
+
- Max grad value: 2.0
|
68 |
+
- Effective batch size: 1
|
69 |
+
- Micro-batch size: 1
|
70 |
+
- Gradient accumulation steps: 1
|
71 |
+
- Number of GPUs: 1
|
72 |
+
- Gradient checkpointing: True
|
73 |
+
- Prediction type: epsilon (extra parameters=['training_scheduler_timestep_spacing=trailing', 'inference_scheduler_timestep_spacing=trailing'])
|
74 |
+
- Optimizer: bnb-lion8bit
|
75 |
+
- Trainable parameter precision: Pure BF16
|
76 |
+
- Base model precision: `no_change`
|
77 |
+
- Caption dropout probability: 0.1%
|
78 |
+
|
79 |
+
|
80 |
+
- LoRA Rank: 16
|
81 |
+
- LoRA Alpha: None
|
82 |
+
- LoRA Dropout: 0.1
|
83 |
+
- LoRA initialisation style: default
|
84 |
+
|
85 |
+
|
86 |
+
## Datasets
|
87 |
+
|
88 |
+
### signs
|
89 |
+
- Repeats: 0
|
90 |
+
- Total number of images: 405
|
91 |
+
- Total number of aspect buckets: 15
|
92 |
+
- Resolution: 1.048576 megapixels
|
93 |
+
- Cropped: False
|
94 |
+
- Crop style: None
|
95 |
+
- Crop aspect: None
|
96 |
+
- Used for regularisation data: No
|
97 |
+
|
98 |
+
|
99 |
+
## Inference
|
100 |
+
|
101 |
+
|
102 |
+
```python
|
103 |
+
import torch
|
104 |
+
from diffusers import DiffusionPipeline
|
105 |
+
|
106 |
+
model_id = 'stabilityai/stable-diffusion-xl-base-1.0'
|
107 |
+
adapter_id = 'bghira/simpletuner-sdxl-lora-test'
|
108 |
+
pipeline = DiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.bfloat16) # loading directly in bf16
|
109 |
+
pipeline.load_lora_weights(adapter_id)
|
110 |
+
|
111 |
+
prompt = "A photo-realistic image of a cat"
|
112 |
+
negative_prompt = 'blurry, cropped, ugly'
|
113 |
+
|
114 |
+
## Optional: quantise the model to save on vram.
|
115 |
+
## Note: The model was not quantised during training, so it is not necessary to quantise it during inference time.
|
116 |
+
#from optimum.quanto import quantize, freeze, qint8
|
117 |
+
#quantize(pipeline.unet, weights=qint8)
|
118 |
+
#freeze(pipeline.unet)
|
119 |
+
|
120 |
+
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
|
121 |
+
model_output = pipeline(
|
122 |
+
prompt=prompt,
|
123 |
+
negative_prompt=negative_prompt,
|
124 |
+
num_inference_steps=20,
|
125 |
+
generator=torch.Generator(device='cuda' if torch.cuda.is_available() else 'mps' if torch.backends.mps.is_available() else 'cpu').manual_seed(42),
|
126 |
+
width=1024,
|
127 |
+
height=1024,
|
128 |
+
guidance_scale=4.2,
|
129 |
+
guidance_rescale=0.0,
|
130 |
+
).images[0]
|
131 |
+
|
132 |
+
model_output.save("output.png", format="PNG")
|
133 |
+
|
134 |
+
```
|
135 |
+
|
136 |
+
|
137 |
+
|