我正在学习变压器的预训练模型xlm-roberta-大型-xnli示例
from transformers import pipeline
classifier = pipeline("zero-shot-classification",
model="joeddav/xlm-roberta-large-xnli")
我得到以下错误
ValueError: Couldn't instantiate the backend tokenizer from one of: (1) a `tokenizers` library serialization file, (2) a slow tokenizer instance to convert or (3) an equivalent slow tokenizer class to instantiate and convert. You need to have sentencepiece installed to convert a slow tokenizer to a fast one.
我在使用变形金刚版本的'4.1.1'
发布于 2020-12-23 22:44:30
据变形金刚( Transformers v4.0.0
发布 )称,sentencepiece
作为必需的依赖项被删除。这意味着
“依赖于SentencePiece库的令牌器在标准变压器安装中不可用”
包括XLMRobertaTokenizer
。但是,sentencepiece
可以作为额外的依赖项安装。
pip install transformers[sentencepiece]
或
pip install sentencepiece
如果你已经安装了变压器。
发布于 2021-04-01 18:43:08
如果你在谷歌实验室:
发布于 2021-08-24 04:37:00
下面的代码在colab笔记本中对我有用
!pip install transformers[sentencepiece]
https://stackoverflow.com/questions/65431837
复制相似问题