File size: 647 Bytes
6fef2f9
 
 
 
 
 
 
b9bd245
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
base_model: cagliostrolab/animagine-xl-3.1
base_model_relation: quantized

license: other
license_name: faipl-1.0-sd
license_link: https://freedevproject.org/faipl-1.0-sd/
---

## Quantization

```py
import torch
from huggingface_hub import cached_download
from safetensors.torch import load_file, save_file

ckpt_path = cached_download(
    "https://huggingface.co/cagliostrolab/animagine-xl-3.1/resolve/main/animagine-xl-3.1.safetensors",
)

state_dict = load_file(ckpt_path)

for key, value in state_dict.items():
    state_dict[key] = value.to(torch.float8_e4m3fn)

save_file(state_dict, "./animagine-xl-3.1.float8_e4m3fn.safetensors")
```