lonePatient / BERT-NER-Pytorch

Chinese NER(Named Entity Recognition) using BERT(Softmax, CRF, Span)
MIT License
2.05k stars 425 forks source link

在预测的时候遇到ValueError: expected sequence of length 517 at dim 1 (got 512)怎么办,下面是详细报错内容 #97

Open huangshuai-ustc opened 11 months ago

huangshuai-ustc commented 11 months ago

Traceback (most recent call last): File "run_ner_crf.py", line 498, in main() File "run_ner_crf.py", line 493, in main predict(args, model, tokenizer, prefix=prefix) File "run_ner_crf.py", line 255, in predict test_dataset = load_and_cache_examples(args, args.task_name, tokenizer, data_type='test') File "run_ner_crf.py", line 368, in load_and_cache_examples all_label_ids = torch.tensor([f.label_ids for f in features], dtype=torch.long) ValueError: expected sequence of length 517 at dim 1 (got 512)