Upload converter.py
Browse files- converter.py +12 -0
converter.py
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import torch
|
2 |
+
from safetensors.torch import load_file, save_file
|
3 |
+
file_path = "./hunyuan_dit_1.1.safetensors"
|
4 |
+
model_path = ("./mp_rank_00_model_states.pt")
|
5 |
+
|
6 |
+
loaded = load_file(file_path)
|
7 |
+
sd = torch.load(model_path, map_location=lambda storage, loc: storage)
|
8 |
+
for i in sd["module"]:
|
9 |
+
loaded["model."+str(i)] = sd["module"][i]
|
10 |
+
|
11 |
+
save_file(loaded, "Freeway_Animation_HunYuan_Demo_comfyui.safetensors")
|
12 |
+
# manual surgery
|