File size: 1,911 Bytes
2ddb58a
 
69a3e15
 
 
 
 
 
 
 
 
 
2ddb58a
69a3e15
0d21eb4
 
 
 
 
 
 
 
 
 
 
 
 
69a3e15
 
 
 
 
 
0d21eb4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
---
license: openrail++
base_model:
  - stabilityai/stable-diffusion-xl-base-1.0
base_model_relation: finetune
pipeline_tag: text-to-image
library_name: diffusers
tags:
  - stable-diffusion-xl
  - preference-optimization
  - pickscore
  - diffusion-lair
---

## Model details

- Base model: `stabilityai/stable-diffusion-xl-base-1.0`
- Base-model revision: `462165984030d82259a11f4367a4eed129e94a7b`
- Architecture: Stable Diffusion XL
- Resolution: 1024 × 1024
- Fine-tuned component: UNet
- Weight format: sharded Safetensors
- Weight precision: float32
- Training objective: [Diffusion LAIR](https://arxiv.org/pdf/2605.26491)
- Reward/preference model: PickScore
- Training dataset: Pick-a-Pic v2

## License

This model is distributed under the
[CreativeML Open RAIL++-M license](./LICENSE.md). Users must comply with
the use-based restrictions specified in the license.

## Usage

```python
import torch
from diffusers import (
    AutoencoderKL,
    StableDiffusionXLPipeline,
    UNet2DConditionModel,
)

model_id = "austin-k-wang/DiffusionLAIR-SDXL"
base_model_id = "stabilityai/stable-diffusion-xl-base-1.0"

unet = UNet2DConditionModel.from_pretrained(
    model_id,
    subfolder="unet",
    torch_dtype=torch.float16,
    use_safetensors=True,
)

vae = AutoencoderKL.from_pretrained(
    "madebyollin/sdxl-vae-fp16-fix",
    torch_dtype=torch.float16,
)

pipe = StableDiffusionXLPipeline.from_pretrained(
    base_model_id,
    unet=unet,
    vae=vae,
    variant="fp16",
    torch_dtype=torch.float16,
    use_safetensors=True,
).to("cuda")

generator = torch.Generator(device="cuda").manual_seed(42)

image = pipe(
    "a cinematic photograph of a futuristic city at sunset",
    generator=generator,
    guidance_scale=5.0,
    num_inference_steps=30,
).images[0]

image.save("output.png")
```

For lower-VRAM inference, replace `.to("cuda")` with:

```python
pipe.enable_model_cpu_offload()
```