p1atdev's picture
Update README.md
b9bd245 verified
|
raw
history blame
647 Bytes
metadata
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

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")