エラー
環境
windows10
python3.7
エラー
No module named 'tensorflow.python.keras.engine.keras_tensor'
エラー詳細
Traceback (most recent call last): File "C:\Users\XYZZZ\AppData\Local\Programs\Python\Python37\lib\site-packages\transformers\file_utils.py", line 2777, in _get_module return importlib.import_module("." + module_name, self.__name__) File "C:\Users\XYZZZ\AppData\Local\Programs\Python\Python37\lib\importlib\__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1006, in _gcd_import File "<frozen importlib._bootstrap>", line 983, in _find_and_load File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 677, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 728, in exec_module File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed File "C:\Users\XYZZZ\AppData\Local\Programs\Python\Python37\lib\site-packages\transformers\models\roberta\modeling_tf_roberta.py", line 43, in <module> from ...modeling_tf_utils import ( File "C:\Users\XYZZZ\AppData\Local\Programs\Python\Python37\lib\site-packages\transformers\modeling_tf_utils.py", line 31, in <module> from tensorflow.python.keras.engine.keras_tensor import KerasTensor ModuleNotFoundError: No module named 'tensorflow.python.keras.engine.keras_tensor' The above exception was the direct cause of the following exception: Traceback (most recent call last): File "BERT_from_scratch.py", line 373, in <module> fill = pipeline('fill-mask', model='liberto', tokenizer='liberto') File "C:\Users\XYZZZ\AppData\Local\Programs\Python\Python37\lib\site-packages\transformers\pipelines\__init__.py", line 556, in pipeline **model_kwargs, File "C:\Users\XYZZZ\AppData\Local\Programs\Python\Python37\lib\site-packages\transformers\pipelines\base.py", line 223, in infer_framework_load_model _class = getattr(transformers_module, f"TF{architecture}", None) File "C:\Users\XYZZZ\AppData\Local\Programs\Python\Python37\lib\site-packages\transformers\file_utils.py", line 2768, in __getattr__ value = getattr(module, name) File "C:\Users\XYZZZ\AppData\Local\Programs\Python\Python37\lib\site-packages\transformers\file_utils.py", line 2767, in __getattr__ module = self._get_module(self._class_to_module[name]) File "C:\Users\XYZZZ\AppData\Local\Programs\Python\Python37\lib\site-packages\transformers\file_utils.py", line 2781, in _get_module ) from e RuntimeError: Failed to import transformers.models.roberta.modeling_tf_roberta because of the following error (look up to see its traceback): No module named 'tensorflow.python.keras.engine.keras_tensor'
解決策
python -m pip install tensorflow==2.3.0
コメント
アドバイスあれば、お願いします。