通过Anaconda下载pytorch_transformers并通过Jupyter Notebook执行import命令后,我遇到了一些与缺少模块有关的错误。
我尝试搜索sacremoses,以通过Anaconda导入软件包,但是它仅适用于Linux计算机。还有其他人遇到过类似的问题吗?预先感谢!
from pytorch_transformers import BertTokenizer, BertModel, BertForMaskedLM
这是错误:
<ipython-input-5-218d0858d00f> in <module>
----> 1 from pytorch_transformers import BertTokenizer, BertModel, BertForMaskedLM
~\Anaconda3\lib\site-packages\pytorch_transformers\__init__.py in <module>
1 __version__ = "1.2.0"
----> 2 from .tokenization_auto import AutoTokenizer
3 from .tokenization_bert import BertTokenizer, BasicTokenizer, WordpieceTokenizer
4 from .tokenization_openai import OpenAIGPTTokenizer
5 from .tokenization_transfo_xl import (TransfoXLTokenizer, TransfoXLCorpus)
~\Anaconda3\lib\site-packages\pytorch_transformers\tokenization_auto.py in <module>
24 from .tokenization_transfo_xl import TransfoXLTokenizer
25 from .tokenization_xlnet import XLNetTokenizer
---> 26 from .tokenization_xlm import XLMTokenizer
27 from .tokenization_roberta import RobertaTokenizer
28 from .tokenization_distilbert import DistilBertTokenizer
~\Anaconda3\lib\site-packages\pytorch_transformers\tokenization_xlm.py in <module>
25 from io import open
26
---> 27 import sacremoses as sm
28
29 from .tokenization_utils import PreTrainedTokenizer
ModuleNotFoundError: No module named 'sacremoses'```