Open 786039663 opened 10 months ago
you use the code in https://github.com/tencent-ailab/IP-Adapter#how-to-train?
Yes, I trained according to this https://github.com/tencent-ailab/IP-Adapter#how-to-train. After training, get model.safetensors. Then convert model.safetensors to ip_adapter.bin Finally an error when loading ip_adapter.bin
you can load the ip_adapter.bin
, and print the keys:
import torch
sd = torch.load("ip_adapter.bin")
print(sd["image_proj"].keys())
print(sd["ip_adapter"].keys())
That's the result, but I don't know what it means.
The training was prompted with this message.
It seems that some weights are missing, but I don't know where the problem lies. you can try this:
import torch
ckpt = "checkpoint-50000/pytorch_model.bin"
sd = torch.load(ckpt, map_location="cpu")
image_proj_sd = {}
ip_sd = {}
for k in sd:
if k.startswith("image_proj_model"):
image_proj_sd[k.replace("image_proj_model.", "")] = sd[k]
elif "_ip." in k:
ip_sd[k.replace("unet.", "")] = sd[k]
torch.save({"image_proj": image_proj_sd, "ip_adapter": ip_sd}, "ip_adapter.bin")
Have you solved the problem
系统提示培训并显示此消息。
After I converted the model.safetensors file I got after training to ip_adapter.bin, when I tested it, it reported an error.