Text-to-Image
Diffusers
Safetensors
stable-diffusion-xl
preference-optimization
pickscore
diffusion-lair
Instructions to use austin-k-wang/DiffusionLAIR-SDXL with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use austin-k-wang/DiffusionLAIR-SDXL with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("austin-k-wang/DiffusionLAIR-SDXL", dtype=torch.bfloat16, device_map="cuda") prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" image = pipe(prompt).images[0] - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- Draw Things
- DiffusionBee
Update README.md
Browse files
README.md
CHANGED
|
@@ -12,9 +12,73 @@ tags:
|
|
| 12 |
- diffusion-lair
|
| 13 |
---
|
| 14 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
## License
|
| 16 |
|
| 17 |
This model is distributed under the
|
| 18 |
[CreativeML Open RAIL++-M license](./LICENSE.md). Users must comply with
|
| 19 |
the use-based restrictions specified in the license.
|
| 20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
- diffusion-lair
|
| 13 |
---
|
| 14 |
|
| 15 |
+
## Model details
|
| 16 |
+
|
| 17 |
+
- Base model: `stabilityai/stable-diffusion-xl-base-1.0`
|
| 18 |
+
- Base-model revision: `462165984030d82259a11f4367a4eed129e94a7b`
|
| 19 |
+
- Architecture: Stable Diffusion XL
|
| 20 |
+
- Resolution: 1024 × 1024
|
| 21 |
+
- Fine-tuned component: UNet
|
| 22 |
+
- Weight format: sharded Safetensors
|
| 23 |
+
- Weight precision: float32
|
| 24 |
+
- Training objective: [Diffusion LAIR](https://arxiv.org/pdf/2605.26491)
|
| 25 |
+
- Reward/preference model: PickScore
|
| 26 |
+
- Training dataset: Pick-a-Pic v2
|
| 27 |
+
|
| 28 |
## License
|
| 29 |
|
| 30 |
This model is distributed under the
|
| 31 |
[CreativeML Open RAIL++-M license](./LICENSE.md). Users must comply with
|
| 32 |
the use-based restrictions specified in the license.
|
| 33 |
|
| 34 |
+
## Usage
|
| 35 |
+
|
| 36 |
+
```python
|
| 37 |
+
import torch
|
| 38 |
+
from diffusers import (
|
| 39 |
+
AutoencoderKL,
|
| 40 |
+
StableDiffusionXLPipeline,
|
| 41 |
+
UNet2DConditionModel,
|
| 42 |
+
)
|
| 43 |
+
|
| 44 |
+
model_id = "austin-k-wang/DiffusionLAIR-SDXL"
|
| 45 |
+
base_model_id = "stabilityai/stable-diffusion-xl-base-1.0"
|
| 46 |
+
|
| 47 |
+
unet = UNet2DConditionModel.from_pretrained(
|
| 48 |
+
model_id,
|
| 49 |
+
subfolder="unet",
|
| 50 |
+
torch_dtype=torch.float16,
|
| 51 |
+
use_safetensors=True,
|
| 52 |
+
)
|
| 53 |
+
|
| 54 |
+
vae = AutoencoderKL.from_pretrained(
|
| 55 |
+
"madebyollin/sdxl-vae-fp16-fix",
|
| 56 |
+
torch_dtype=torch.float16,
|
| 57 |
+
)
|
| 58 |
+
|
| 59 |
+
pipe = StableDiffusionXLPipeline.from_pretrained(
|
| 60 |
+
base_model_id,
|
| 61 |
+
unet=unet,
|
| 62 |
+
vae=vae,
|
| 63 |
+
variant="fp16",
|
| 64 |
+
torch_dtype=torch.float16,
|
| 65 |
+
use_safetensors=True,
|
| 66 |
+
).to("cuda")
|
| 67 |
+
|
| 68 |
+
generator = torch.Generator(device="cuda").manual_seed(42)
|
| 69 |
+
|
| 70 |
+
image = pipe(
|
| 71 |
+
"a cinematic photograph of a futuristic city at sunset",
|
| 72 |
+
generator=generator,
|
| 73 |
+
guidance_scale=5.0,
|
| 74 |
+
num_inference_steps=30,
|
| 75 |
+
).images[0]
|
| 76 |
+
|
| 77 |
+
image.save("output.png")
|
| 78 |
+
```
|
| 79 |
+
|
| 80 |
+
For lower-VRAM inference, replace `.to("cuda")` with:
|
| 81 |
+
|
| 82 |
+
```python
|
| 83 |
+
pipe.enable_model_cpu_offload()
|
| 84 |
+
```
|