Skip to content

Vocab Size Mismatch #9

@xuwayyy

Description

@xuwayyy

使用官方requirements.txt里面的 transformers==4.38.2 在测试时可以顺利测试,但发现使用 transformers==4.56 时运行

 model = SegEarthR2.from_pretrained(model_path, mask_decoder_cfg=mask_cfg, **kwargs)

会报错词表大小不一致, 错误信息:

RuntimeError: Error(s) in loading state_dict for Linear:
        size mismatch for weight: copying a param with shape torch.Size([50296, 2560]) from checkpoint, the shape in current model is torch.Size([51200, 2560]).

因为在llava_phi.py中lm_head硬编码为51200 (Mipha词表大小),但是训练权重下config.vocab_size: 50296, 这是否代表测试时 lm_head为随机初始化参数并没有加载权重参数, 只不过在低版本 transformers 版本下容许了这种行为?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions