导出模型时报错 'structbert is not in the exporters regist

导出 FAQ问答模型('damo/nlp_structbert_faq-question-answering_chinese-base' )的时候提示,

KeyError: 'structbert is not in the exporters registry group faq-question-answering. Please make sure the correct version of ModelScope library is used'

导出的语句是:


from modelscope.models import Model
model_id = 'damo/nlp_structbert_faq-question-answering_chinese-base'
model = Model.from_pretrained(model_id)

from modelscope.exporters import Exporter
# shape参数用来生成dummy inputs
# 在NLP领域中一般len(shape) == 2, 分别代表batch_size和sequence_length
output_files = Exporter.from_model(model).export_onnx(shape=(2, 256), opset=13, output_dir='/tmp')
print(output_files) # {'model': '/tmp/model.onnx'}

我刚接触python,都是按照文档拷贝的代码,求大神帮忙看看这个问题,谢谢。

展开
收起
1593316062336815 2023-02-03 17:05:09 722 分享 版权
1 条回答
写回答
取消 提交回答
  • 看起来像是由于代码中的模型不支持ONNX导出,请确保使用的模型支持ONNX导出,并且检查安装的模型库版本是否与代码要求的版本一致。

    2023-02-03 17:34:59
    赞同 展开评论

包含命名实体识别、文本分类、分词、关系抽取、问答、推理、文本摘要、情感分析、机器翻译等多个领域

收录在圈子:
+ 订阅

热门讨论

热门文章

还有其他疑问?
咨询AI助理