hg-ai-team commited on
Commit
88faace
·
verified ·
1 Parent(s): 2c13c9b

Model card auto-generated by SimpleTuner

Browse files
Files changed (1) hide show
  1. README.md +176 -0
README.md ADDED
@@ -0,0 +1,176 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: other
3
+ base_model: "flux/unknown-model"
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: 'A photo-realistic image of a cat'
22
+ parameters:
23
+ negative_prompt: 'blurry, cropped, ugly'
24
+ output:
25
+ url: ./assets/image_1_0.png
26
+ ---
27
+
28
+ # string
29
+
30
+ This is a standard PEFT LoRA derived from [flux/unknown-model](https://huggingface.co/flux/unknown-model).
31
+
32
+
33
+ The main validation prompt used during training was:
34
+ ```
35
+ A photo-realistic image of a cat
36
+ ```
37
+
38
+
39
+ ## Validation settings
40
+ - CFG: `3.5`
41
+ - CFG Rescale: `0.0`
42
+ - Steps: `28`
43
+ - Sampler: `FlowMatchEulerDiscreteScheduler`
44
+ - Seed: `42`
45
+ - Resolution: `1024x1024`
46
+ - Skip-layer guidance:
47
+
48
+ Note: The validation settings are not necessarily the same as the [training settings](#training-settings).
49
+
50
+ You can find some example images in the following gallery:
51
+
52
+
53
+ <Gallery />
54
+
55
+ The text encoder **was not** trained.
56
+ You may reuse the base model text encoder for inference.
57
+
58
+
59
+ ## Training settings
60
+
61
+ - Training epochs: 2
62
+ - Training steps: 500
63
+ - Learning rate: 0.0004
64
+ - Learning rate schedule: polynomial
65
+ - Warmup steps: 100
66
+ - Max grad norm: 2.0
67
+ - Effective batch size: 1
68
+ - Micro-batch size: 1
69
+ - Gradient accumulation steps: 1
70
+ - Number of GPUs: 1
71
+ - Gradient checkpointing: True
72
+ - 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'])
73
+ - Optimizer: adamw_bf16
74
+ - Trainable parameter precision: Pure BF16
75
+ - Caption dropout probability: 5.0%
76
+
77
+
78
+ - LoRA Rank: 16
79
+ - LoRA Alpha: None
80
+ - LoRA Dropout: 0.1
81
+ - LoRA initialisation style: default
82
+
83
+
84
+ ## Datasets
85
+
86
+ ### autotrain-512
87
+ - Repeats: 4
88
+ - Total number of images: 6
89
+ - Total number of aspect buckets: 3
90
+ - Resolution: 0.262144 megapixels
91
+ - Cropped: False
92
+ - Crop style: None
93
+ - Crop aspect: None
94
+ - Used for regularisation data: No
95
+ ### autotrain-crop-512
96
+ - Repeats: 4
97
+ - Total number of images: 6
98
+ - Total number of aspect buckets: 1
99
+ - Resolution: 0.262144 megapixels
100
+ - Cropped: True
101
+ - Crop style: center
102
+ - Crop aspect: square
103
+ - Used for regularisation data: No
104
+ ### autotrain-768
105
+ - Repeats: 4
106
+ - Total number of images: 6
107
+ - Total number of aspect buckets: 4
108
+ - Resolution: 0.589824 megapixels
109
+ - Cropped: False
110
+ - Crop style: None
111
+ - Crop aspect: None
112
+ - Used for regularisation data: No
113
+ ### autotrain-crop-768
114
+ - Repeats: 4
115
+ - Total number of images: 6
116
+ - Total number of aspect buckets: 1
117
+ - Resolution: 0.589824 megapixels
118
+ - Cropped: True
119
+ - Crop style: center
120
+ - Crop aspect: square
121
+ - Used for regularisation data: No
122
+ ### autotrain-1024
123
+ - Repeats: 4
124
+ - Total number of images: 6
125
+ - Total number of aspect buckets: 3
126
+ - Resolution: 1.048576 megapixels
127
+ - Cropped: False
128
+ - Crop style: None
129
+ - Crop aspect: None
130
+ - Used for regularisation data: No
131
+ ### autotrain-crop-1024
132
+ - Repeats: 4
133
+ - Total number of images: 6
134
+ - Total number of aspect buckets: 1
135
+ - Resolution: 1.048576 megapixels
136
+ - Cropped: True
137
+ - Crop style: center
138
+ - Crop aspect: square
139
+ - Used for regularisation data: No
140
+
141
+
142
+ ## Inference
143
+
144
+
145
+ ```python
146
+ import torch
147
+ from diffusers import DiffusionPipeline
148
+
149
+ model_id = '/workspace/models/FLUX.1-dev'
150
+ adapter_id = 'hg-ai-team/string'
151
+ pipeline = DiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.bfloat16) # loading directly in bf16
152
+ pipeline.load_lora_weights(adapter_id)
153
+
154
+ prompt = "A photo-realistic image of a cat"
155
+
156
+
157
+ ## Optional: quantise the model to save on vram.
158
+ ## Note: The model was quantised during training, and so it is recommended to do the same during inference time.
159
+ from optimum.quanto import quantize, freeze, qint8
160
+ quantize(pipeline.transformer, weights=qint8)
161
+ freeze(pipeline.transformer)
162
+
163
+ 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
164
+ image = pipeline(
165
+ prompt=prompt,
166
+ num_inference_steps=28,
167
+ generator=torch.Generator(device='cuda' if torch.cuda.is_available() else 'mps' if torch.backends.mps.is_available() else 'cpu').manual_seed(42),
168
+ width=1024,
169
+ height=1024,
170
+ guidance_scale=3.5,
171
+ ).images[0]
172
+ image.save("output.png", format="PNG")
173
+ ```
174
+
175
+
176
+