twodgirl_diffusers_to_flux_script / flux_devpro_ckpt_mod.py
John6666's picture
Upload 6 files
b716b6e verified
raw
history blame contribute delete
578 Bytes
import gc
from map_from_diffusers import convert_diffusers_to_flux_checkpoint
from safetensors.torch import load_file, save_file
import sys
import torch
import os
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
###
# Code from huggingface/twodgirl
# License: apache-2.0
if __name__ == '__main__':
sd = convert_diffusers_to_flux_checkpoint(load_file(sys.argv[1]))
#assert sd['time_in.in_layer.weight'].dtype == torch.float8_e4m3fn
print(f"dtype: {sd['time_in.in_layer.weight'].dtype}")
print(len(sd))
gc.collect()
save_file(sd, sys.argv[2])