我使用google colab来训练数据集。我将我的数据集上传到谷歌驱动器,并从谷歌colab回忆起。但运行train.py脚本意味着跟踪错误。更确切地说,我跑:
!python3 /content/drive/tensorflow1/models/research/object_detection/train.py --logtostderr --train_dir=/content/drive/tensorflow1/models/research/object_detection/training/ --pipeline_config_path=/content/drive/tensorflow1/models/research/object_detection/training/faster_rcnn_inception_v2_pets.config
我得到了这些错误:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
File "/usr/lib/python3.6/imp.py", line 243, in load_module
return load_dynamic(name, filename, file)
File "/usr/lib/python3.6/imp.py", line 343, in load_dynamic
return _load(spec)
ImportError: libcublas.so.9.0: cannot open shared object file: No such file or directory
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/content/drive/tensorflow1/models/research/object_detection/train.py", line 47, in <module>
import tensorflow as tf
File "/usr/local/lib/python3.6/dist-packages/tensorflow/__init__.py", line 24, in <module>
from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 74, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
File "/usr/lib/python3.6/imp.py", line 243, in load_module
return load_dynamic(name, filename, file)
File "/usr/lib/python3.6/imp.py", line 343, in load_dynamic
return _load(spec)
ImportError: libcublas.so.9.0: cannot open shared object file: No such file or directory
Failed to load the native TensorFlow runtime.
See https://www.tensorflow.org/install/install_sources#common_installation_problems
for some common reasons and solutions. Include the entire stack trace
above this error message when asking for help.
我是否需要首先安装或上传Cuda9或Cudnn到谷歌驱动器以解决colab上的主题?我怎样才能传递这些错误?
答案 0 :(得分:4)
请记住,在使用tensorflow-gpu之前必须在笔记本上显式启用GPU。我怀疑这个步骤不见了。
要启用GPU,请尝试菜单'runtime-&gt; change runtime-&gt; hardware accelerator-&gt; gpu'
将此标记为解决方案,如果这有助于其他人可以从中受益。
答案 1 :(得分:0)
因为tensorflow-gpu> = 1.5.0需要CUDA 9,所以您应该安装tensorflow-gpu == 1.4.0。
pip install --upgrade tensorflow-gpu==1.4
请参考以下两个链接。
https://github.com/tensorflow/tensorflow/issues/15604
https://www.tensorflow.org/install/install_sources#tested_source_configurations
答案 2 :(得分:0)
首先,在Google Colab Notebook上启用GPU
Go to Menu > Runtime > Change runtime.
Change hardware acceleration to GPU.