Skip to content

使用taiyi_xl_minimal_inference.py推理huggingface上的模型报错 #7

@shyshuai90

Description

@shyshuai90

您好,如题,原始模型是从huggingface上直接下载的,我在taiyi_xl_minimal_inference.py中修改了加载的位置

`

# todo
args.ckpt_path = "/Volumes/Taiyi-Stable-Diffusion-XL-3.5B/taiyi_diffusion_xl.safetensors"

# todo
# HuggingFaceのmodel id
PRETRAINED_MODEL_DIR = "/Volumes/Taiyi-Stable-Diffusion-XL-3.5B"
text_encoder_1_name = f"{PRETRAINED_MODEL_DIR}/tokenizer"
text_encoder_2_name = f"{PRETRAINED_MODEL_DIR}/tokenizer_2"

`

推理的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".

`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions