StructBERT问句识别-中文口语-通用领域项目中,采用魔塔提供的notebook免费环境,试了各种镜像,都存在一个这样的问题:
TypeError: PreTrainedTokenizerFast._batch_encode_plus() got an unexpected keyword argument 'label2id'
复现这个问题非常简单,只需要点开这个项目的网址,然后打开魔塔平台免费实例这个网址,然后创建一个实例,在创建好的notebook中运行下面的代码,这也是这个项目网页给出的demo。
from modelscope.pipelines import pipeline
from modelscope.utils.constant import Tasks
from modelscope.outputs import OutputKeys
text_classification = pipeline(Tasks.text_classification, model='damo/nlp_structbert_alimeeting_action-classification_chinese-base')
output = text_classification("今天会议的第一个结论是明天先收集用户的需求吗?")
版本问题
确保使用的库版本与项目要求的版本一致。可以通过查看项目的文档或依赖文件(如requirements.txt)来确定需要的库版本。
通过以下命令检查和更新ModelScope库的版本:
pip show modelscope
pip install --upgrade modelscope