patrickvonplaten commited on
Commit
8e464fc
1 Parent(s): dd10706

Add example for Diffusers

Browse files
Files changed (1) hide show
  1. README.md +14 -0
README.md CHANGED
@@ -14,6 +14,20 @@ SDXL-VAE-FP16-Fix is the [SDXL VAE](https://huggingface.co/stabilityai/sdxl-vae)
14
  | SDXL-VAE | ✅ ![](./images/orig-fp32.png) | ⚠️ ![](./images/orig-fp16.png) |
15
  | SDXL-VAE-FP16-Fix | ✅ ![](./images/fix-fp32.png) | ✅ ![](./images/fix-fp16.png) |
16
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
 
18
  ## Details
19
 
 
14
  | SDXL-VAE | ✅ ![](./images/orig-fp32.png) | ⚠️ ![](./images/orig-fp16.png) |
15
  | SDXL-VAE-FP16-Fix | ✅ ![](./images/fix-fp32.png) | ✅ ![](./images/fix-fp16.png) |
16
 
17
+ ## 🧨 Diffusers Usage
18
+
19
+ Just load this checkpoint via `AutoencoderKL`:
20
+
21
+ ```py
22
+ from diffusers import DiffusionPipeline, AutoencoderKL
23
+
24
+ vae = AutoencoderKL.from_pretrained("madebyollin/sdxl-vae-fp16-fix", torch_dtype=torch.float16, force_upcast=True)
25
+ pipe = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-xl-base-0.9", vae=vae, torch_dtype=torch.float16, variant="fp16", use_safetensors=True)
26
+ pipe.to("cuda")
27
+
28
+ refiner = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-xl-refiner-0.9", vae=vae, torch_dtype=torch.float16, use_safetensors=True, variant="fp16")
29
+ refiner.to("cuda")
30
+ ```
31
 
32
  ## Details
33