LinWeizheDragon / Retrieval-Augmented-Visual-Question-Answering

This is the official repository for Retrieval Augmented Visual Question Answering

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

我加载了您分享的RAVQA的最后测试的检查点文件,但是提示错误,请问怎么解决呢?

1286169349 opened this issue · comments

RuntimeError: Error(s) in loading state_dict for RagExecutor:
size mismatch for model.generator.shared.weight: copying a param with shape torch.Size([32110, 1024]) from checkpoint, the shape in current model is torch.Size([30532, 1024]).
size mismatch for model.generator.encoder.embed_tokens.weight: copying a param with shape torch.Size([32110, 1024]) from checkpoint, the shape in current model is torch.Size([30532, 1024]).
size mismatch for model.generator.decoder.embed_tokens.weight: copying a param with shape torch.Size([32110, 1024]) from checkpoint, the shape in current model is torch.Size([30532, 1024]).
size mismatch for model.generator.lm_head.weight: copying a param with shape torch.Size([32110, 1024]) from checkpoint, the shape in current model is torch.Size([30532, 1024]).

这个是因为你的embedding layer的token vocabulary的大小不对
checkpoint中的token共有32110个,但是模型中的token只有30532个
我去看了一下,好像Huggingface更新了t5-large的tokenizer的vocab文件,以前没有32000+个token,所以导致我以前训练的模型和现在的对不上。所以你需要重新训练模型。