Update README.md
Browse files
README.md
CHANGED
@@ -5,4 +5,23 @@ base_model_relation: quantized
|
|
5 |
license: other
|
6 |
license_name: faipl-1.0-sd
|
7 |
license_link: https://freedevproject.org/faipl-1.0-sd/
|
8 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
license: other
|
6 |
license_name: faipl-1.0-sd
|
7 |
license_link: https://freedevproject.org/faipl-1.0-sd/
|
8 |
+
---
|
9 |
+
|
10 |
+
## Quantization
|
11 |
+
|
12 |
+
```py
|
13 |
+
import torch
|
14 |
+
from huggingface_hub import cached_download
|
15 |
+
from safetensors.torch import load_file, save_file
|
16 |
+
|
17 |
+
ckpt_path = cached_download(
|
18 |
+
"https://huggingface.co/cagliostrolab/animagine-xl-3.1/resolve/main/animagine-xl-3.1.safetensors",
|
19 |
+
)
|
20 |
+
|
21 |
+
state_dict = load_file(ckpt_path)
|
22 |
+
|
23 |
+
for key, value in state_dict.items():
|
24 |
+
state_dict[key] = value.to(torch.float8_e4m3fn)
|
25 |
+
|
26 |
+
save_file(state_dict, "./animagine-xl-3.1.float8_e4m3fn.safetensors")
|
27 |
+
```
|