如何解决XLNetTokenizer 需要 SentencePiece 库,但在您的环境中找不到
我正在尝试在 Google Collaboratory 上实施 XLNET。但是我遇到了以下问题。
ImportError:
XLNetTokenizer requires the SentencePiece library but it was not found in your environment. Checkout the instructions on the
installation page of its repo: https://github.com/google/sentencepiece#installation and follow the ones
that match your environment.
我也尝试了以下步骤:
!pip install -U transformers
!pip install sentencepiece
from transformers import XLNetTokenizer
tokenizer = XLNetTokenizer.from_pretrained('xlnet-base-cased-spiece.model')
提前感谢您的帮助。
解决方法
之后
!pip 安装变压器和
!pip 安装句子
请重新启动您的运行时,然后执行所有其他代码。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。