你好~
我在尝试运行eva的时候,出现以下错误:
RuntimeError: Error(s) in loading state_dict for Tagger:
size mismatch for drop_replacement: copying a param with shape torch.Size([2248]) from checkpoint, the shape in current model is torch.Size([325]).
希望能得到解答,谢谢~
你好:
方便提供更多的错误信息吗?比如加载的哪个checkpoint,运行的命令和完整的报错信息。根据已有的信息我也没看出来是哪里的错误😂。
祝好!
谢谢回复~
加载的checkpoint是checkpoints-ReClor
运行命令:bash scripts/LogiGraph_Roberta.sh /home/1/reasoning/AdaLoGN-main/checkpoints-ReClor/config.json
完整报错信息:
2022-09-28 11:41:55 WARNING: Can not find mwt: default from official model list. Ignoring it.
2022-09-28 11:41:55 INFO: Loading these models for language: en (English):
| Processor | Package |
| tokenize | combined |
| pos | combined |
| lemma | combined |
| depparse | combined |
| sentiment | sstplus |
2022-09-28 11:41:55 INFO: Use device: cpu
2022-09-28 11:41:55 INFO: Loading: tokenize
2022-09-28 11:41:55 INFO: Loading: pos
Traceback (most recent call last):
File "run_multiple_choice.py", line 42, in
from models import RobertaAdaLoGN
File "/home/1/reasoning/AdaLoGN-main/models/init.py", line 1, in
from .RobertaAdaLoGN import *
File "/home/1/reasoning/AdaLoGN-main/models/RobertaAdaLoGN.py", line 12, in
from models.GNNs import RGAT
File "/home/1/reasoning/AdaLoGN-main/models/GNNs.py", line 10, in
from utils import get_edge_norm
File "/home/1/reasoning/AdaLoGN-main/utils/init.py", line 1, in
from .data_utils import *
File "/home/1/reasoning/AdaLoGN-main/utils/data_utils.py", line 34, in
from utils.data_utils_preprocess import construct_logic_graph, save_new_not_sentence_map
File "/home/1/reasoning/AdaLoGN-main/utils/data_utils_preprocess.py", line 476, in
nlp = stanza.Pipeline(lang='en', processors='tokenize,mwt,pos,sentiment,lemma,depparse', use_gpu=False)
File "/home/1/anaconda3/envs/1/lib/python3.6/site-packages/stanza/pipeline/core.py", line 141, in init
use_gpu=self.use_gpu)
File "/home/1/anaconda3/envs/1/lib/python3.6/site-packages/stanza/pipeline/processor.py", line 159, in init
self._set_up_model(config, use_gpu)
File "/home/1/anaconda3/envs/1/lib/python3.6/site-packages/stanza/pipeline/pos_processor.py", line 25, in _set_up_model
self._trainer = Trainer(pretrain=self.pretrain, model_file=config['model_path'], use_cuda=use_gpu)
File "/home/1/anaconda3/envs/1/lib/python3.6/site-packages/stanza/models/pos/trainer.py", line 35, in init
self.load(model_file, pretrain)
File "/home/1/anaconda3/envs/1/lib/python3.6/site-packages/stanza/models/pos/trainer.py", line 120, in load
self.model.load_state_dict(checkpoint['model'], strict=False)
File "/home/1/anaconda3/envs/1/lib/python3.6/site-packages/torch/nn/modules/module.py", line 1483, in load_state_dict
self.class.name, "\n\t".join(error_msgs)))
RuntimeError: Error(s) in loading state_dict for Tagger:
size mismatch for drop_replacement: copying a param with shape torch.Size([2248]) from checkpoint, the shape in current model is torch.Size([325]).
size mismatch for taggerlstm.lstm.0.lstm.weight_ih_l0: copying a param with shape torch.Size([800, 2248]) from checkpoint, the shape in current model is torch.Size([800, 325]).
size mismatch for taggerlstm.lstm.0.lstm.weight_ih_l0_reverse: copying a param with shape torch.Size([800, 2248]) from checkpoint, the shape in current model is torch.Size([800, 325]).
size mismatch for taggerlstm.highway.0.weight: copying a param with shape torch.Size([400, 2248]) from checkpoint, the shape in current model is torch.Size([400, 325]).
size mismatch for taggerlstm.gate.0.weight: copying a param with shape torch.Size([400, 2248]) from checkpoint, the shape in current model is torch.Size([400, 325]).
谢谢~
你好:
看起来是stanza库的问题,要不试试删除stanza的缓存,重新加载stanza模型?
祝好!