引入transformers 报错 Segmentation fault (core dumped)

环境:

anaconda 3

python3.6.1

torch-GPU 1.4.0

transformers 4.0.1

其中 transformers 为pip install 自动安装的最新版。

问题:

引入from transformers 报错 Segmentation fault (core dumped)

from transformers import BertModel, BertTokenizer

原因:

transformers安装时的一个依赖库sentencepiece出了问题,安装的版本是0.1.92,改回上一版本即可。

pip install sentencepiece==0.1.91

参考链接:

https://github.com/huggingface/transformers/issues?q=is%3Aissue+is%3Aopen+Segmentation+fault

https://github.com/huggingface/transformers/issues/8020

https://github.com/huggingface/transformers/issues/8206

 
 
 
原文地址:https://www.cnblogs.com/MaggieForest/p/14119312.html