Text-to-Image
Diffusers
stable-diffusion-xl
sdxl
lora
control
controlnet
control-lora
brightness
grayscale
template:sd-lora
Instructions to use Oysiyl/controlnet-lora-brightness-sdxl with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use Oysiyl/controlnet-lora-brightness-sdxl with Diffusers:
pip install -U diffusers transformers accelerate
from diffusers import ControlNetModel, StableDiffusionControlNetPipeline controlnet = ControlNetModel.from_pretrained("Oysiyl/controlnet-lora-brightness-sdxl") pipe = StableDiffusionControlNetPipeline.from_pretrained( "stabilityai/stable-diffusion-xl-base-1.0", controlnet=controlnet ) - Inference
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- Draw Things
- DiffusionBee
Add comprehensive README documentation
Browse files
README.md
CHANGED
|
@@ -1,3 +1,423 @@
|
|
| 1 |
---
|
| 2 |
license: apache-2.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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diffusion-xl
|
| 6 |
+
- sdxl
|
| 7 |
+
- text-to-image
|
| 8 |
+
- diffusers
|
| 9 |
+
- lora
|
| 10 |
+
- control
|
| 11 |
+
- controlnet
|
| 12 |
+
- control-lora
|
| 13 |
+
- brightness
|
| 14 |
+
- grayscale
|
| 15 |
+
- template:sd-lora
|
| 16 |
+
widget:
|
| 17 |
+
- text: "a beautiful garden scene with colorful flowers and butterflies, highly detailed, professional photography, vibrant colors"
|
| 18 |
+
output:
|
| 19 |
+
url: "https://huggingface.co/Oysiyl/controlnet-lora-brightness-sdxl-10k/resolve/main/examples/example.png"
|
| 20 |
+
inference: true
|
| 21 |
---
|
| 22 |
+
|
| 23 |
+
# ControlNet LoRA SDXL - Brightness Control (10k @ 1024×1024)
|
| 24 |
+
|
| 25 |
+
A Control LoRA model trained on Stable Diffusion XL to control image generation through brightness/grayscale information. This model uses **LoRA (Low-Rank Adaptation)** combined with ControlNet architecture for efficient control, providing an **ultra-lightweight alternative** to full ControlNet with excellent pattern preservation.
|
| 26 |
+
|
| 27 |
+
## Model Description
|
| 28 |
+
|
| 29 |
+
This Control LoRA enables brightness-based conditioning for SDXL image generation. By providing a grayscale image as input, you can control the brightness distribution and lighting structure while maintaining creative freedom through text prompts.
|
| 30 |
+
|
| 31 |
+
### Key Features:
|
| 32 |
+
|
| 33 |
+
- 🎨 **Excellent brightness and pattern control** across multiple scales (0.5-2.0)
|
| 34 |
+
- 🚀 **196x smaller than full ControlNet**: ~24MB vs ~4.7GB
|
| 35 |
+
- ⚡ **Ultra-fast loading**: LoRA weights load in <1 second
|
| 36 |
+
- 💡 **Flexible scale control**: Adjustable conditioning scale from 0.5 to 2.0+
|
| 37 |
+
- 🔄 **Compatible with ControlLoRA v3**: Uses the efficient ControlLoRA v3 architecture
|
| 38 |
+
- 📦 **Minimal storage**: All checkpoints + final model = ~120MB total
|
| 39 |
+
- 🖼️ **Native SDXL resolution**: Trained at 1024×1024
|
| 40 |
+
|
| 41 |
+
### Intended Uses:
|
| 42 |
+
|
| 43 |
+
- **Artistic QR code generation** (scale 1.0-1.5 recommended)
|
| 44 |
+
- Image recoloring and colorization
|
| 45 |
+
- Lighting control in text-to-image generation
|
| 46 |
+
- Brightness-based pattern integration
|
| 47 |
+
- Watermark and subtle pattern embedding
|
| 48 |
+
- Photo enhancement and stylization
|
| 49 |
+
|
| 50 |
+
## Training Details
|
| 51 |
+
|
| 52 |
+
### Training Data
|
| 53 |
+
|
| 54 |
+
Trained on 10,000 samples from `latentcat/grayscale_image_aesthetic_3M`:
|
| 55 |
+
- High-quality aesthetic images
|
| 56 |
+
- Paired with grayscale/brightness versions
|
| 57 |
+
- Native resolution: 1024×1024 (SDXL native)
|
| 58 |
+
|
| 59 |
+
### Training Configuration
|
| 60 |
+
|
| 61 |
+
| Parameter | Value |
|
| 62 |
+
|-----------|-------|
|
| 63 |
+
| **Base Model** | `stabilityai/stable-diffusion-xl-base-1.0` |
|
| 64 |
+
| **Architecture** | ControlLoRA v3 (~7M trainable parameters) |
|
| 65 |
+
| **LoRA Rank** | 16 |
|
| 66 |
+
| **Extra Conv Rank** | 64 (conv_in layer) |
|
| 67 |
+
| **Training Resolution** | 1024×1024 |
|
| 68 |
+
| **Training Steps** | 313 (1 epoch) |
|
| 69 |
+
| **Batch Size** | 8 per device |
|
| 70 |
+
| **Gradient Accumulation** | 4 (effective batch: 32) |
|
| 71 |
+
| **Learning Rate** | 1e-4 |
|
| 72 |
+
| **Empty Prompts** | 10% (ControlLoRA v3 recommendation) |
|
| 73 |
+
| **Mixed Precision** | BF16 |
|
| 74 |
+
| **Hardware** | NVIDIA H100 80GB |
|
| 75 |
+
| **Training Time** | ~21 minutes |
|
| 76 |
+
| **Final Loss** | ~0.10-0.12 |
|
| 77 |
+
|
| 78 |
+
### Model Size Comparison
|
| 79 |
+
|
| 80 |
+
| Model | Parameters | Size | Training | Resolution |
|
| 81 |
+
|-------|-----------|------|----------|-----------|
|
| 82 |
+
| **This Control LoRA** | ~7M | **~24MB** | 10k @ 1024 | 1024×1024 |
|
| 83 |
+
| ControlNet (SDXL) | ~700M | 4.7GB | 100k @ 512 | 512×512 |
|
| 84 |
+
| T2I Adapter (SDXL) | ~77M | 302MB | 100k @ 1024 | 1024×1024 |
|
| 85 |
+
| Flux Control LoRA | ~7M | 25MB | 10k @ 512 | 512×512 |
|
| 86 |
+
|
| 87 |
+
## Usage
|
| 88 |
+
|
| 89 |
+
### Installation
|
| 90 |
+
|
| 91 |
+
```bash
|
| 92 |
+
pip install diffusers transformers accelerate torch peft
|
| 93 |
+
# Install ControlLoRA v3
|
| 94 |
+
git clone https://github.com/HighCWu/control-lora-v3
|
| 95 |
+
```
|
| 96 |
+
|
| 97 |
+
### Basic Usage
|
| 98 |
+
|
| 99 |
+
```python
|
| 100 |
+
import torch
|
| 101 |
+
import sys
|
| 102 |
+
sys.path.insert(0, '/path/to/control-lora-v3')
|
| 103 |
+
|
| 104 |
+
from pipeline_sdxl import StableDiffusionXLControlLoraV3Pipeline
|
| 105 |
+
from model import UNet2DConditionModelEx
|
| 106 |
+
from PIL import Image
|
| 107 |
+
|
| 108 |
+
# Load UNet with LoRA support
|
| 109 |
+
unet = UNet2DConditionModelEx.from_pretrained(
|
| 110 |
+
"stabilityai/stable-diffusion-xl-base-1.0",
|
| 111 |
+
subfolder="unet",
|
| 112 |
+
torch_dtype=torch.bfloat16,
|
| 113 |
+
)
|
| 114 |
+
unet = unet.add_extra_conditions(["brightness"])
|
| 115 |
+
|
| 116 |
+
# Load SDXL Control LoRA pipeline
|
| 117 |
+
pipe = StableDiffusionXLControlLoraV3Pipeline.from_pretrained(
|
| 118 |
+
"stabilityai/stable-diffusion-xl-base-1.0",
|
| 119 |
+
unet=unet,
|
| 120 |
+
torch_dtype=torch.bfloat16,
|
| 121 |
+
)
|
| 122 |
+
|
| 123 |
+
# Load Control LoRA weights
|
| 124 |
+
pipe.load_lora_weights("Oysiyl/controlnet-lora-brightness-sdxl-10k", adapter_name="brightness")
|
| 125 |
+
pipe.to("cuda")
|
| 126 |
+
|
| 127 |
+
# Load grayscale/brightness control image
|
| 128 |
+
control_image = Image.open("path/to/grayscale_image.png")
|
| 129 |
+
control_image = control_image.resize((1024, 1024))
|
| 130 |
+
|
| 131 |
+
# Generate image
|
| 132 |
+
prompt = "a beautiful garden scene with colorful flowers and butterflies, highly detailed, professional photography, vibrant colors"
|
| 133 |
+
|
| 134 |
+
image = pipe(
|
| 135 |
+
prompt=prompt,
|
| 136 |
+
image=control_image,
|
| 137 |
+
num_inference_steps=30,
|
| 138 |
+
guidance_scale=7.5,
|
| 139 |
+
extra_condition_scale=1.0, # Controls conditioning strength
|
| 140 |
+
height=1024,
|
| 141 |
+
width=1024,
|
| 142 |
+
).images[0]
|
| 143 |
+
|
| 144 |
+
image.save("output.png")
|
| 145 |
+
```
|
| 146 |
+
|
| 147 |
+
### Adjusting Control Strength
|
| 148 |
+
|
| 149 |
+
The `extra_condition_scale` parameter controls how strongly the brightness map influences generation:
|
| 150 |
+
|
| 151 |
+
```python
|
| 152 |
+
# Subtle control (scale 0.5-0.7)
|
| 153 |
+
image = pipe(
|
| 154 |
+
prompt=prompt,
|
| 155 |
+
image=control_image,
|
| 156 |
+
extra_condition_scale=0.5,
|
| 157 |
+
...
|
| 158 |
+
).images[0]
|
| 159 |
+
|
| 160 |
+
# Balanced control (scale 1.0-1.5) - Recommended for artistic QR codes
|
| 161 |
+
image = pipe(
|
| 162 |
+
prompt=prompt,
|
| 163 |
+
image=control_image,
|
| 164 |
+
extra_condition_scale=1.0,
|
| 165 |
+
...
|
| 166 |
+
).images[0]
|
| 167 |
+
|
| 168 |
+
# Strong control (scale 1.5-2.0)
|
| 169 |
+
image = pipe(
|
| 170 |
+
prompt=prompt,
|
| 171 |
+
image=control_image,
|
| 172 |
+
extra_condition_scale=1.5,
|
| 173 |
+
...
|
| 174 |
+
).images[0]
|
| 175 |
+
```
|
| 176 |
+
|
| 177 |
+
### Artistic QR Code Generation
|
| 178 |
+
|
| 179 |
+
```python
|
| 180 |
+
import qrcode
|
| 181 |
+
from PIL import Image
|
| 182 |
+
|
| 183 |
+
# Generate QR code
|
| 184 |
+
qr = qrcode.QRCode(
|
| 185 |
+
version=1,
|
| 186 |
+
error_correction=qrcode.constants.ERROR_CORRECT_H,
|
| 187 |
+
box_size=10,
|
| 188 |
+
border=4
|
| 189 |
+
)
|
| 190 |
+
qr.add_data("https://your-url.com")
|
| 191 |
+
qr.make(fit=True)
|
| 192 |
+
|
| 193 |
+
qr_image = qr.make_image(fill_color="black", back_color="white")
|
| 194 |
+
qr_image = qr_image.resize((1024, 1024), Image.LANCZOS).convert("RGB")
|
| 195 |
+
|
| 196 |
+
# Generate artistic QR code (scale 1.0-1.5 works best)
|
| 197 |
+
image = pipe(
|
| 198 |
+
prompt="a beautiful garden with colorful flowers and butterflies, highly detailed, professional photography",
|
| 199 |
+
image=qr_image,
|
| 200 |
+
num_inference_steps=30,
|
| 201 |
+
guidance_scale=7.5,
|
| 202 |
+
extra_condition_scale=1.0,
|
| 203 |
+
height=1024,
|
| 204 |
+
width=1024,
|
| 205 |
+
).images[0]
|
| 206 |
+
|
| 207 |
+
image.save("artistic_qr.png")
|
| 208 |
+
```
|
| 209 |
+
|
| 210 |
+
### Using Different Checkpoints
|
| 211 |
+
|
| 212 |
+
The model includes intermediate checkpoints from throughout training:
|
| 213 |
+
|
| 214 |
+
```python
|
| 215 |
+
# Early checkpoint (25% - 2,500 samples)
|
| 216 |
+
pipe.load_lora_weights("Oysiyl/controlnet-lora-brightness-sdxl-10k",
|
| 217 |
+
adapter_name="brightness",
|
| 218 |
+
revision="checkpoint-78")
|
| 219 |
+
|
| 220 |
+
# Mid checkpoint (50% - 5,000 samples)
|
| 221 |
+
pipe.load_lora_weights("Oysiyl/controlnet-lora-brightness-sdxl-10k",
|
| 222 |
+
adapter_name="brightness",
|
| 223 |
+
revision="checkpoint-156")
|
| 224 |
+
|
| 225 |
+
# Late checkpoint (75% - 7,500 samples)
|
| 226 |
+
pipe.load_lora_weights("Oysiyl/controlnet-lora-brightness-sdxl-10k",
|
| 227 |
+
adapter_name="brightness",
|
| 228 |
+
revision="checkpoint-234")
|
| 229 |
+
|
| 230 |
+
# Near-final checkpoint (99% - 9,984 samples)
|
| 231 |
+
pipe.load_lora_weights("Oysiyl/controlnet-lora-brightness-sdxl-10k",
|
| 232 |
+
adapter_name="brightness",
|
| 233 |
+
revision="checkpoint-312")
|
| 234 |
+
|
| 235 |
+
# Final model (10,000 samples, main branch - recommended)
|
| 236 |
+
pipe.load_lora_weights("Oysiyl/controlnet-lora-brightness-sdxl-10k",
|
| 237 |
+
adapter_name="brightness")
|
| 238 |
+
```
|
| 239 |
+
|
| 240 |
+
## Conditioning Scale Guide
|
| 241 |
+
|
| 242 |
+
The `extra_condition_scale` parameter controls how strongly the brightness map influences generation:
|
| 243 |
+
|
| 244 |
+
### Recommended Scale Ranges
|
| 245 |
+
|
| 246 |
+
| Scale | Behavior | Best For |
|
| 247 |
+
|-------|----------|----------|
|
| 248 |
+
| **0.5-0.7** | Subtle artistic integration with hints of pattern | Natural images, soft lighting hints |
|
| 249 |
+
| **0.7-1.0** | Light control - visible structure with artistic freedom | Artistic images, creative reinterpretation |
|
| 250 |
+
| **1.0-1.5** | **🔥 Balanced control** | **Artistic QR codes, watermarks** (recommended) |
|
| 251 |
+
| **1.5-2.0** | Strong control - clear patterns with artistic overlay | Geometric patterns, structured designs |
|
| 252 |
+
| **2.0+** | Maximum control - dominant patterns | Strong brightness maps, technical applications |
|
| 253 |
+
|
| 254 |
+
## Performance Comparison
|
| 255 |
+
|
| 256 |
+
### vs Full ControlNet (SDXL)
|
| 257 |
+
|
| 258 |
+
| Metric | ControlNet (SDXL) | This Control LoRA | Advantage |
|
| 259 |
+
|--------|-------------------|-------------------|-----------|
|
| 260 |
+
| **Parameters** | ~700M | ~7M | **100x smaller** |
|
| 261 |
+
| **Model Size** | 4.7GB | 24MB | **196x smaller** |
|
| 262 |
+
| **Load Time** | ~5-10 seconds | **<1 second** | **10x faster loading** |
|
| 263 |
+
| **Storage (w/ checkpoints)** | ~18.8GB | **~120MB** | **157x less storage** |
|
| 264 |
+
| **Training Time** | ~3 hours | **21 minutes** | **8.5x faster** |
|
| 265 |
+
| **Pattern Preservation @ Scale 1.0** | Excellent | **Excellent** | Comparable quality |
|
| 266 |
+
| **Flexibility** | Fixed architecture | **Adjustable weights** | More versatile |
|
| 267 |
+
|
| 268 |
+
### vs T2I Adapter (SDXL)
|
| 269 |
+
|
| 270 |
+
| Metric | T2I Adapter (SDXL) | This Control LoRA | Advantage |
|
| 271 |
+
|--------|-------------------|-------------------|-----------|
|
| 272 |
+
| **Parameters** | ~77M | ~7M | **11x smaller** |
|
| 273 |
+
| **Model Size** | 302MB | 24MB | **12.6x smaller** |
|
| 274 |
+
| **Training Samples** | 100k | 10k | **More efficient** |
|
| 275 |
+
| **Architecture** | Separate adapter | **Integrated LoRA** | Simpler loading |
|
| 276 |
+
|
| 277 |
+
## Checkpoint Progression Analysis
|
| 278 |
+
|
| 279 |
+
The model includes checkpoints from throughout training:
|
| 280 |
+
|
| 281 |
+
1. **checkpoint-78**: 25% complete (2,500 samples)
|
| 282 |
+
2. **checkpoint-156**: 50% complete (5,000 samples)
|
| 283 |
+
3. **checkpoint-234**: 75% complete (7,500 samples)
|
| 284 |
+
4. **checkpoint-312**: 99% complete (9,984 samples)
|
| 285 |
+
5. **Final model**: 100% complete (10,000 samples - main branch)
|
| 286 |
+
|
| 287 |
+
### Visual Comparison
|
| 288 |
+
|
| 289 |
+

|
| 290 |
+
|
| 291 |
+
*Checkpoint progression at scale 1.0, showing improvement from 25% to 100% training*
|
| 292 |
+
|
| 293 |
+
### Key Observations
|
| 294 |
+
|
| 295 |
+
All checkpoints show consistent, high-quality performance across scales. The progression analysis reveals:
|
| 296 |
+
|
| 297 |
+
1. **Early Checkpoint (78 steps, 2.5k samples)**:
|
| 298 |
+
- Good pattern awareness, developing control
|
| 299 |
+
- More artistic interpretation of prompts
|
| 300 |
+
- Recommended scales: 0.7-1.2
|
| 301 |
+
|
| 302 |
+
2. **Mid Checkpoints (156-234 steps, 5k-7.5k samples)**:
|
| 303 |
+
- Strong balance between control and creativity
|
| 304 |
+
- Stable pattern preservation
|
| 305 |
+
- Recommended scales: 0.8-1.5
|
| 306 |
+
|
| 307 |
+
3. **Final Model (313 steps, 10k samples)**:
|
| 308 |
+
- Maximum control capability
|
| 309 |
+
- Excellent pattern preservation at all scales
|
| 310 |
+
- Recommended scales: 0.7-2.0
|
| 311 |
+
|
| 312 |
+
### No Overfitting Observed
|
| 313 |
+
|
| 314 |
+
Unlike larger models trained on 100k samples, this 10k Control LoRA shows **no signs of overfitting**:
|
| 315 |
+
- Consistent improvement throughout training
|
| 316 |
+
- Final checkpoint is recommended for production use
|
| 317 |
+
- 10k samples appears optimal for LoRA-based control training
|
| 318 |
+
|
| 319 |
+
## When to Use This Model
|
| 320 |
+
|
| 321 |
+
### ✅ Use This Control LoRA When:
|
| 322 |
+
|
| 323 |
+
- Creating **artistic QR codes** with SDXL quality (scale 1.0-1.5)
|
| 324 |
+
- Need **minimal storage overhead** (<30MB per checkpoint)
|
| 325 |
+
- Want **fast model loading** (<1 second)
|
| 326 |
+
- Building **production applications** requiring small model sizes
|
| 327 |
+
- Working with **SDXL** as base model
|
| 328 |
+
- Require **flexible control strength** via extra_condition_scale
|
| 329 |
+
- Need **multiple checkpoints** without massive storage (120MB total vs 18.8GB)
|
| 330 |
+
- Training on **limited data** (10k samples sufficient)
|
| 331 |
+
|
| 332 |
+
### ⚠️ Consider Alternatives When:
|
| 333 |
+
|
| 334 |
+
- Need **full ControlNet** features with extremely precise control
|
| 335 |
+
- Working with existing **T2I Adapter** pipelines
|
| 336 |
+
- Require **different control types** (pose, depth, etc.) - train separate LoRAs
|
| 337 |
+
|
| 338 |
+
## Limitations
|
| 339 |
+
|
| 340 |
+
### Current Limitations
|
| 341 |
+
|
| 342 |
+
- **ControlLoRA v3 dependency**: Requires custom pipeline code (not in main diffusers yet)
|
| 343 |
+
- **Grayscale conditioning only**: Trained specifically for brightness/grayscale control
|
| 344 |
+
- **Single control type**: Only brightness, not other conditioning types
|
| 345 |
+
- **Custom code required**: Need to include ControlLoRA v3 files
|
| 346 |
+
|
| 347 |
+
### Recommendations
|
| 348 |
+
|
| 349 |
+
- For **SDXL generation**, use this Control LoRA
|
| 350 |
+
- For **multiple control types**, train separate LoRAs and combine
|
| 351 |
+
- Experiment with **scales 1.0-1.5** for most use cases
|
| 352 |
+
- Use **final model** for best results
|
| 353 |
+
|
| 354 |
+
## Training Script
|
| 355 |
+
|
| 356 |
+
```bash
|
| 357 |
+
accelerate launch --mixed_precision="bf16" train_sdxl.py \
|
| 358 |
+
--pretrained_model_name_or_path="stabilityai/stable-diffusion-xl-base-1.0" \
|
| 359 |
+
--dataset_name="<path_to_10k_dataset>" \
|
| 360 |
+
--conditioning_image_column="conditioning_image" \
|
| 361 |
+
--image_column="image" \
|
| 362 |
+
--caption_column="text" \
|
| 363 |
+
--output_dir="./controlnet-lora-brightness-sdxl-10k" \
|
| 364 |
+
--mixed_precision="bf16" \
|
| 365 |
+
--resolution=1024 \
|
| 366 |
+
--learning_rate=1e-4 \
|
| 367 |
+
--proportion_empty_prompts=0.1 \
|
| 368 |
+
--rank=16 \
|
| 369 |
+
--lora_adapter_name="brightness" \
|
| 370 |
+
--extra_lora_rank_modules conv_in \
|
| 371 |
+
--extra_lora_ranks 64 \
|
| 372 |
+
--half_or_full_lora=half_skip_attn \
|
| 373 |
+
--train_batch_size=8 \
|
| 374 |
+
--num_train_epochs=1 \
|
| 375 |
+
--gradient_accumulation_steps=4 \
|
| 376 |
+
--gradient_checkpointing \
|
| 377 |
+
--checkpointing_steps=78 \
|
| 378 |
+
--validation_steps=78 \
|
| 379 |
+
--validation_image="validation_qr.png" \
|
| 380 |
+
--validation_prompt="a beautiful garden scene with colorful flowers and butterflies, highly detailed, professional photography, vibrant colors" \
|
| 381 |
+
--num_validation_images=4 \
|
| 382 |
+
--seed=42 \
|
| 383 |
+
--dataloader_num_workers=4 \
|
| 384 |
+
--tracker_project_name="controlnet-lora-brightness-sdxl-10k" \
|
| 385 |
+
--report_to="wandb" \
|
| 386 |
+
--enable_xformers_memory_efficient_attention \
|
| 387 |
+
--use_8bit_adam \
|
| 388 |
+
--init_lora_weights="gaussian"
|
| 389 |
+
```
|
| 390 |
+
|
| 391 |
+
## Available Branches
|
| 392 |
+
|
| 393 |
+
- `main`: Final model (10,000 samples, recommended)
|
| 394 |
+
- `checkpoint-78`: Early checkpoint (2,500 samples)
|
| 395 |
+
- `checkpoint-156`: Mid checkpoint (5,000 samples)
|
| 396 |
+
- `checkpoint-234`: Late checkpoint (7,500 samples)
|
| 397 |
+
- `checkpoint-312`: Near-final checkpoint (9,984 samples)
|
| 398 |
+
|
| 399 |
+
## Citation
|
| 400 |
+
|
| 401 |
+
```bibtex
|
| 402 |
+
@misc{controlnet-lora-brightness-sdxl-10k,
|
| 403 |
+
author = {Oysiyl},
|
| 404 |
+
title = {ControlNet LoRA SDXL - Brightness Control (10k @ 1024×1024)},
|
| 405 |
+
year = {2026},
|
| 406 |
+
publisher = {HuggingFace},
|
| 407 |
+
journal = {HuggingFace Model Hub},
|
| 408 |
+
howpublished = {\url{https://huggingface.co/Oysiyl/controlnet-lora-brightness-sdxl-10k}}
|
| 409 |
+
}
|
| 410 |
+
```
|
| 411 |
+
|
| 412 |
+
## Acknowledgments
|
| 413 |
+
|
| 414 |
+
- Built with [🤗 Diffusers](https://github.com/huggingface/diffusers)
|
| 415 |
+
- Base model: [Stable Diffusion XL](https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0) by Stability AI
|
| 416 |
+
- ControlLoRA v3: [control-lora-v3](https://github.com/HighCWu/control-lora-v3) by HighCWu
|
| 417 |
+
- Dataset: [grayscale_image_aesthetic_3M](https://huggingface.co/datasets/latentcat/grayscale_image_aesthetic_3M) by latentcat
|
| 418 |
+
- Training infrastructure: NVIDIA H100 80GB
|
| 419 |
+
- LoRA implementation: [PEFT](https://github.com/huggingface/peft) by Hugging Face
|
| 420 |
+
|
| 421 |
+
## License
|
| 422 |
+
|
| 423 |
+
Apache 2.0 License. The base SDXL model has separate license terms at [stabilityai/stable-diffusion-xl-base-1.0](https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0).
|