3

我正在尝试在 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')

提前谢谢你的帮助。

4

1 回答 1

7


!pip install tr​​ansformers 和 !pip install sentencepiece之后,
请重新启动您的运行时,然后执行所有其他代码。

于 2021-01-06T16:50:23.647 回答