-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
使用taiyi_xl_minimal_inference.py推理huggingface上的模型报错 #7
Comments
你的transformers版本是多少? |
好的,transformers改成 requirements.txt中的版本就可以了! 感谢回复! |
不客气~ |
大佬,如果我想升级transformers版本,这个应该怎么办呢?由于别的几个模型用的版本比较高,导致也会出现这个错误 |
找到text_model.load_state_dict(converted_text_encoder_checkpoint),改成text_model.load_state_dict(converted_text_encoder_checkpoint, strict = False) |
https://github.com/IDEA-CCNL/Taiyi-Diffusion-XL/blob/main/library/sdxl_model_util.py |
|
先删除position_ids试下: 再去正常to(self.device) |
那在这里同样的函数,在函数最开始,删掉state_dict里的embeddings.position_ids,就不会有unexcepted key(s)了 查看huggingface的源码https://github.com/huggingface/transformers/blob/main/src/transformers/models/clip/modeling_clip.py第202行,position_ids会在缓存里自己生成,所以我们在删掉是没事的 |
不行,预测的时候,还是报错 |
报啥错 |
|
您好,如题,原始模型是从huggingface上直接下载的,我在taiyi_xl_minimal_inference.py中修改了加载的位置
`
`
推理的log如下
`
(sd) ➜ Taiyi-Diffusion-XL git:(debug) ✗ python taiyi_xl_minimal_inference.py
building U-Net
loading U-Net from checkpoint
U-Net:
building text encoders
使用taiyi模型微调!
loading text encoders from checkpoint
Traceback (most recent call last):
File "/Users/codes/Taiyi-Diffusion-XL/taiyi_xl_minimal_inference.py", line 267, in
text_model1, text_model2, vae, unet, _, _ = sdxl_model_util.load_models_from_sdxl_checkpoint(
File "/Users/codes/Taiyi-Diffusion-XL/library/sdxl_model_util.py", line 275, in load_models_from_sdxl_checkpoint
info1 = _load_state_dict_on_device(text_model1, te1_sd, device=map_location) # remain fp32
File "/Users/codes/Taiyi-Diffusion-XL/library/sdxl_model_util.py", line 158, in _load_state_dict_on_device
raise RuntimeError("Error(s) in loading state_dict for {}:\n\t{}".format(model.class.name, "\n\t".join(error_msgs)))
RuntimeError: Error(s) in loading state_dict for CLIPTextModel:
Unexpected key(s) in state_dict: "text_model.embeddings.position_ids".
`
The text was updated successfully, but these errors were encountered: