T5Tokenizer requires the SentencePiece library but it was not found in your environment.

出现错误: T5Tokenizer requires the SentencePiece library but it was not found in your environment.

问题出现是因为我要使用T5Tokenizer

from transformers import AdamW, T5ForConditionalGeneration, T5Tokenizer

出现如下问题:
在这里插入图片描述
解决方法:
第一步:确实用最新的pip 安装, 否则可能会出现错误

pip install --upgrade pip

第二步:安装报错的SentencePiece

pip install SentencePiece

问题解决


版权声明:本文为qq_45056135原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。