File size: 578 Bytes
b716b6e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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])