텐서플로우 오류 발생
텐서플로우 1.14.0 버전이 설치되었고 NLP의 XL Net을 적용 중 오류가 발생하였다.
WARNING:tensorflow:From /home/nini/code/xlnet/model_utils.py:295: The name tf.train.Optimizer is deprecated. Please use tf.compat.v1.train.Optimizer instead. Traceback (most recent call last): File "train.py", line 16, in import tpu_estimator File "/home/nini/code/xlnet/tpu_estimator.py", line 34, in from tensorflow.contrib.tpu.proto import compilation_result_pb2 as tpu_compilation_result ImportError: No module named proto |
텐서플로우 오류 원인
XL Net이 Python2 버전에 Tensorflow 1.13.1로 배포가 되어 아래 코드에서 오류가 발생한다.
from tensorflow.contrib.tpu.proto import compilation_result_pb2 as tpu_compilation_result from tensorflow.contrib.tpu.python.tpu import tensor_tracer from tensorflow.contrib.tpu.python.ops import tpu_ops |
텐서플로우 삭제와 설치 명령
XL Net 적용이 목적이므로 텐서플로우 1.14.0 버전을 삭제하고 1.13.1 버전을 설치한다.
설치된 텐서플로우 1.14.0 버전 삭제 | pip uninstall tensorflow |
텐서플로우 1.13.1 버전 설치 | pip install tensorflow==1.13.1 |
텐서플로우 버전 확인
nini@nini-NLP:$ pip list | grep -i tensor DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning. tensorboard (1.13.1) tensorflow (1.13.1) tensorflow-datasets (1.2.0) tensorflow-estimator (1.13.0) tensorflow-metadata (0.15.0) |
삭제, 설치 로그
nini@nini-NLP:$ pip uninstall tensorflow The directory '/home/nini/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. Uninstalling tensorflow-1.14.0: /usr/local/bin/freeze_graph /usr/local/bin/saved_model_cli /usr/local/bin/tensorboard /usr/local/bin/tf_upgrade_v2 /usr/local/bin/tflite_convert /usr/local/bin/toco /usr/local/bin/toco_from_protos /usr/local/lib/python2.7/dist-packages/tensorflow-1.14.0.dist-info/DESCRIPTION.rst /usr/local/lib/python2.7/dist-packages/tensorflow-1.14.0.dist-info/INSTALLER /usr/local/lib/python2.7/dist-packages/tensorflow-1.14.0.dist-info/METADATA ... /usr/local/lib/python2.7/dist-packages/tensorflow/tools/pip_package/setup.py |
nini@nini-NLP:$ sudo pip install tensorflow==1.13.1 The directory '/home/nini/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. The directory '/home/nini/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. Collecting tensorflow==1.13.1 Downloading https://files.pythonhosted.org/packages/d2/ea/ab2c8c0e81bd051cc1180b104c75a865ab0fc66c89be992c4b20bbf6d624/tensorflow-1.13.1-cp27-cp27mu-manylinux1_x86_64.whl (92.5MB) 100% |████████████████████████████████| 92.5MB 18kB/s Collecting tensorflow-estimator<1.14.0rc0,>=1.13.0 (from tensorflow==1.13.1) Downloading https://files.pythonhosted.org/packages/bb/48/13f49fc3fa0fdf916aa1419013bb8f2ad09674c275b4046d5ee669a46873/tensorflow_estimator-1.13.0-py2.py3-none-any.whl (367kB) 100% |████████████████████████████████| 368kB 1.0MB/s Requirement already satisfied: grpcio>=1.8.6 in /usr/local/lib/python2.7/dist-packages (from tensorflow==1.13.1) Requirement already satisfied: mock>=2.0.0 in /usr/local/lib/python2.7/dist-packages (from tensorflow==1.13.1) Requirement already satisfied: keras-applications>=1.0.6 in /usr/local/lib/python2.7/dist-packages (from tensorflow==1.13.1) ... Installing collected packages: tensorflow-estimator, tensorboard, tensorflow Found existing installation: tensorflow-estimator 1.14.0 Uninstalling tensorflow-estimator-1.14.0: Successfully uninstalled tensorflow-estimator-1.14.0 Found existing installation: tensorboard 1.14.0 Uninstalling tensorboard-1.14.0: Successfully uninstalled tensorboard-1.14.0 Successfully installed tensorboard-1.13.1 tensorflow-1.13.1 tensorflow-estimator-1.13.0 |