AdaSeq icon indicating copy to clipboard operation
AdaSeq copied to clipboard

KeyError: 'mask'

Open HuilongYu opened this issue 1 year ago • 2 comments

What is your question?

在训练完NER模型后进行推理,报错KeyError: 'mask'

What have you tried?

No response

Code (if necessary)

from modelscope.pipelines import pipeline from modelscope.utils.constant import Tasks import os

os.environ['HTTP_PROXY'] = 'http://127.0.0.1:7897' os.environ['HTTPS_PROXY'] = 'http://127.0.0.1:7897'

p = pipeline( Tasks.named_entity_recognition, 'D:/PyCharm Community Edition 2024.1.1/workspace/SMNER/adaseq/experiments/RiVEG-twitter-10000/241128164248.201824/output_best' # 绝对路径 ) result = p('1984年出生,中国国籍,汉族,硕士学历')

print(result)

What's your environment?

  • AdaSeq Version (e.g., 1.0 or master):
  • ModelScope Version (e.g., 1.0 or master):
  • PyTorch Version (e.g., 1.12.1):
  • OS (e.g., Ubuntu 20.04):
  • Python version:
  • CUDA/cuDNN version:
  • GPU models and configuration:
  • Any other relevant information:

Code of Conduct

  • [X] I agree to follow this project's Code of Conduct

HuilongYu avatar Nov 30 '24 08:11 HuilongYu

File "D:\PyCharm Community Edition 2024.1.1\workspace\SMNER\adaseq\adaseq\data\preprocessors\nlp_preprocessor.py", line 108, in call output_dict['origin_mask'] = data['mask'] KeyError: 'mask'

HuilongYu avatar Nov 30 '24 08:11 HuilongYu

我也遇到了这个报错,请问你解决了吗?

whiteyyc avatar Feb 06 '25 09:02 whiteyyc