Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,42 @@
|
|
1 |
---
|
2 |
license: openrail++
|
|
|
|
|
|
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
license: openrail++
|
3 |
+
tags:
|
4 |
+
- stable-diffusion
|
5 |
+
inference: false
|
6 |
---
|
7 |
+
|
8 |
+
this is merge model for
|
9 |
+
100% stable-diffusion-xl-base-1.0
|
10 |
+
https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0
|
11 |
+
+
|
12 |
+
sdxl-vae-fp16-fix
|
13 |
+
https://huggingface.co/madebyollin/sdxl-vae-fp16-fix
|
14 |
+
|
15 |
+
you can use this directly or finetune.
|
16 |
+
|
17 |
+
same license on stable-diffusion-xl-base-1.0
|
18 |
+
|
19 |
+
same vae license on sdxl-vae-fp16-fix
|
20 |
+
|
21 |
+
# SDXL-VAE-FP16-Fix
|
22 |
+
|
23 |
+
SDXL-VAE-FP16-Fix is the [SDXL VAE](https://huggingface.co/stabilityai/sdxl-vae)*, but modified to run in fp16 precision without generating NaNs.
|
24 |
+
|
25 |
+
| VAE | Decoding in `float32` / `bfloat16` precision | Decoding in `float16` precision |
|
26 |
+
| --------------------- | -------------------------------------------- | ------------------------------- |
|
27 |
+
| SDXL-VAE | ✅ ![](./images/orig-fp32.png) | ⚠️ ![](./images/orig-fp16.png) |
|
28 |
+
| SDXL-VAE-FP16-Fix | ✅ ![](./images/fix-fp32.png) | ✅ ![](./images/fix-fp16.png) |
|
29 |
+
|
30 |
+
## Details
|
31 |
+
|
32 |
+
SDXL-VAE generates NaNs in fp16 because the internal activation values are too big:
|
33 |
+
![](./images/activation-magnitudes.jpg)
|
34 |
+
|
35 |
+
SDXL-VAE-FP16-Fix was created by finetuning the SDXL-VAE to:
|
36 |
+
1. keep the final output the same, but
|
37 |
+
2. make the internal activation values smaller, by
|
38 |
+
3. scaling down weights and biases within the network
|
39 |
+
|
40 |
+
There are slight discrepancies between the output of SDXL-VAE-FP16-Fix and SDXL-VAE, but the decoded images should be close enough for most purposes.
|
41 |
+
|
42 |
+
---
|