Issue with Loading Model in PowerPaint Repository
#4
by
KimiRegis
- opened
Hello,
I recently tried running the code from your GitHub repository PowerPaint(https://github.com/zhuang2002/PowerPaint), but I encountered an error on line 38. The code snippet and error are as follows:
“RuntimeError Traceback (most recent call last)
<ipython-input-4-7434151a2515> in <cell line: 38>()
36 from safetensors.torch import load_model
37 load_model(pipe.unet, "./models/unet/unet.safetensors")
---> 38 load_model(pipe.text_encoder, "./models/text_encoder/text_encoder.safetensors") # load_model(pipe.text_encoder, "./models/unet/text_encoder.safetensors")
39 pipe = pipe.to('cuda')
40
/usr/local/lib/python3.10/dist-packages/safetensors/torch.py in load_model(model, filename, strict)
214 if unexpected:
215 error += f"\n Unexpected key(s) in state_dict: {unexpected_keys}"
--> 216 raise RuntimeError(error)
217 return missing, unexpected
218
RuntimeError: Error(s) in loading state_dict for CLIPTextModel:
Unexpected key(s) in state_dict: "text_model.embeddings.position_ids"”
It seems that the original code on line 38 had a path issue, which I corrected. However, after fixing the path, I still encountered the above Unexpected key error.
I'm really keen on trying out your work, and any help or guidance you could provide to resolve this issue would be greatly appreciated.
Thank you!
Thank you for your interest in our repository! To address this issue, we recommend trying to install transformers version 4.28.0.
It works! Thank you for your prompt and helpful response.
KimiRegis
changed discussion status to
closed