austin-k-wang commited on
Commit
0d21eb4
·
verified ·
1 Parent(s): f1301d6

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +64 -0
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
+ ```