comfyanonymous
commited on
Commit
•
cbe0127
1
Parent(s):
b565749
Create convert.py
Browse files- convert.py +9 -0
convert.py
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import safetensors.torch
|
2 |
+
sd = safetensors.torch.load_file("lora.safetensors")
|
3 |
+
sd_out = {}
|
4 |
+
|
5 |
+
for k in sd:
|
6 |
+
sd_out["diffusion_model.{}".format(k.replace(".down.weight", ".lora_down.weight").replace(".up.weight", ".lora_up.weight").replace(".processor.proj_lora1.", ".img_attn.proj.").replace(".processor.proj_lora2.", ".txt_attn.proj.").replace(".processor.qkv_lora1.", ".img_attn.qkv.").replace(".processor.qkv_lora2.", ".txt_attn.qkv."))] = sd[k]
|
7 |
+
|
8 |
+
safetensors.torch.save_file(sd_out, "flux_realism_lora.safetensors")
|
9 |
+
|