【发布时间】:2021-08-13 20:45:13
【问题描述】:
昨天一切都与变压器一起工作。现在我无法使用 colab 上提供的 GPU。这有效:
%tensorflow_version 2.x
!pip install -q tensorflow_datasets
!pip install -q tensorflow_text
import tensorflow as tf
import tensorflow_datasets as tfds
#import tensorflow_text as text
print(tf.__version__)
device_name = tf.test.gpu_device_name()
if device_name != '/device:GPU:0':
raise SystemError('GPU device not found')
print('Found GPU at: {}'.format(device_name))
输出:
2.4.1
Found GPU at: /device:GPU:0
如果我取消注释 tensorflow_text 导入,则:
!pip install -q tensorflow_datasets
!pip install -q tensorflow_text
import tensorflow as tf
import tensorflow_datasets as tfds
import tensorflow_text as text
print(tf.__version__)
device_name = tf.test.gpu_device_name()
if device_name != '/device:GPU:0':
raise SystemError('GPU device not found')
print('Found GPU at: {}'.format(device_name))
输出:
---------------------------------------------------------------------------
NotFoundError Traceback (most recent call last)
<ipython-input-8-adc8722d8d1e> in <module>()
5 import tensorflow as tf
6 import tensorflow_datasets as tfds
----> 7 import tensorflow_text as text
8 print(tf.__version__)
9 device_name = tf.test.gpu_device_name()
3 frames
/usr/local/lib/python3.7/dist-packages/tensorflow/python/framework/load_library.py in load_op_library(library_filename)
55 Raises:
56 RuntimeError: when unable to load the library or get the python wrappers.
---> 57 """
58 lib_handle = py_tf.TF_LoadLibrary(library_filename)
59 try:
NotFoundError: /usr/local/lib/python3.7/dist-packages/tensorflow_text/python/metrics/_text_similarity_metric_ops.so: undefined symbol: _ZN10tensorflow15OpKernelContext15allocate_outputEN4absl14lts_2020_09_2311string_viewERKNS_11TensorShapeEPPNS_6TensorE
如果我终止 GPU 会话并再次连接到托管运行时,我会得到导入的 tensorflow_text:
2.5.0
---------------------------------------------------------------------------
SystemError Traceback (most recent call last)
<ipython-input-1-adc8722d8d1e> in <module>()
9 device_name = tf.test.gpu_device_name()
10 if device_name != '/device:GPU:0':
---> 11 raise SystemError('GPU device not found')
12 print('Found GPU at: {}'.format(device_name))
SystemError: GPU device not found
由于某种原因,现在版本已更改为 2.5.0 tensorflow_text 可以导入但未找到 GPU。
【问题讨论】:
标签: tensorflow text google-colaboratory tensorflow2.0