解決策。ModuleNotFoundError: No module named 'official.nlp.bert'
解決策。ModuleNotFoundError: No module named 'official.nlp.bert'
環境
windows10
python3.7.2
GPUなしpc
エラー
2.10.1 Traceback (most recent call last): File "Fine_Tune_BERT_for_Text_Classification_with_TensorFlow.py", line 114, in <module> from official.nlp.bert import tokenization ModuleNotFoundError: No module named 'official.nlp.bert'
対象プログラム
https://github.com/shrikantnaidu/BERT-for-Text-Classification-with-TensorFlow Fine_Tune_BERT_for_Text_Classification_with_TensorFlow.ipynbをpyファイルに変換
解決策
tokenization.pyがあるところを正しく示す。
from official.nlp.tools import tokenization
ただし、このエラーを修正しただけでは、無事には動きませんでした。
tensorflowのバージョンを2.3.0にする必要がありました。 同時に、 tf-models-officialも2.3.0にする必要がありましたか。
コメント
tensorflow と tf-models-officialのバージョンは、一致させるのが、基本だと思います。