在推理模型,其中预训练模型在加载它们的tokenizer时都会遇到这个错误。
You need to have sentencepiece installed to convert a slow tokenizer to a fast one.
Traceback (most recent call last):
现在,我们需要安装要求
1.最新的pip版本20.3.3(在Colab上,我默认安装了19和其他版本);
2.use_fast = False。
当然也可以使用另一种方法更加直接,
pip install sentencepiece
但是 当你安装完sentencepiece,再次加载时依旧会面临一个问题,sentencepiece的加载需要依赖protobuf
pip install protobuf
接下来就可以推理预训练模型。