运行tensorflow AI时出现GPU错误



我正在学习初学者的TensorFlow教程并尝试分类。存在一堆GPU错误。我安装了cuda工具以及我最新的GPU驱动程序。这是输出:

2021-01-13 15:42:24.186914:Wtensorflow/stream_executor/platform/default/dso_loader.cc:60]可以未加载动态库"cudart64_110.dll";dlerror:cudart64_110.dll未找到2021-01-13 15:42:24.187065:Itensorflow/stream_executor/cuda/cudart_stub.cc:29]忽略上面的cuartdleerror如果您的机器上没有设置GPU。[NumbericColumn(key='SepalLength',shape=(1,),default_value=None,dtype=tf.float32,normalizer_fn=无),NumericColumn(key='SepalWidth',shape=(1,),default_value=None,dtype=tf.float32,normalizer_fn=None),NumericColumn(键="TableLength",形状=(1,),default_value=None,dtype=tf.float32,normalizer_fn=None),NumericColumn(key='DetailWidth',shape=(1,),default_value=None,dtype=tf.float32,normalizer_fn=None)]2021-01-13 15:42:26.282013:Itensorflow/stream_executor/platform/default/dso_loader.cc:49]成功打开动态库nvcuda.dll 2021-01-1315:42:26.302224:Itensorflow/core/common_runtime/gpu/gpu_device.cc:1760]找到设备0具有属性:pciBusID:0000:0e:00.0名称:GeForce GTX 1080计算机能力:6.1核心时钟:1.86GHz核心计数:20设备内存大小:8.00GiB设备内存带宽:298.32GiB/s2021-01-13 15:42:26.302958:Wtensorflow/stream_executor/platform/default/dso_loader.cc:60]可以未加载动态库"cudart64_110.dll";dlerror:cudart64_110.dll未找到2021-01-13 15:42:26.30313:Wtensorflow/stream_executor/platform/default/dso_loader.cc:60]可以未加载动态库"cublas64_11.dll";数据错误:cublas64_11.dll未找到2021-01-13 15:42:26.3040062:Wtensorflow/stream_executor/platform/default/dso_loader.cc:60]可以未加载动态库"cublasLt64_11.dll";d错误:未找到cublasLt64_11.dll开始训练2021-01-1315:42:26.307161:Itensorflow/stream_executor/platform/default/dso_loader.cc:49]成功打开动态库cufft64_10.dll 2021-01-1315:42:26.308219:Itensorflow/stream_executor/platform/default/dso_loader.cc:49]成功打开动态库curand64_10.dll 2021-01-1315:42:26.312354:Itensorflow/stream_executor/platform/default/dso_loader.cc:49]成功打开动态库cusolver64_10.dll 2021-01-1315:42:26.312941:Wtensorflow/stream_executor/platform/default/dso_loader.cc:60]可以未加载动态库"cusparse64_11.dll";d错误:找不到cusparse64_11.dll 2021-01-13 15:42:26.313499:Wtensorflow/stream_executor/platform/default/dso_loader.cc:60]可以未加载动态库"cudnn64_8.dll";dlerror:cudnn64_8.dll不是发现日期:2021-01-13 15:42:26.313623:Wtensorflow/core/common_runtime/gpu/gpu_device.cc:1793]无法dlopen一些GPU库。请确保提到丢失的库如果您想使用GPU,以上都已正确安装。按照指南https://www.tensorflow.org/install/gpu了解如何下载并为您的平台设置所需的库。跳过正在注册GPU设备。。。2021-01-13 15:42:26.314323:Itensorflow/core/platform/cpu_feature_guard.cc:142]此tensorflow二进制使用oneAPI深度神经网络库(oneDNN)进行优化在性能关键型中使用以下CPU指令操作:AVX2若要在其他操作中启用它们,请重新生成带有适当编译器标志的TensorFlow。2021-01-1315:42:26.315481:Itensorflow/core/common_runtime/gpu/gpu_device.cc:1300]设备具有强度1边缘矩阵的互连StreamExecutor:2021-01-1315:42:26.315604:Itensorflow/core/common_runtime/gpu/gpu_device.cc:1306]
警告:tensorflow:使用临时文件夹作为模型目录:C: \Users\levig\AppData\Local\Temp\tmpbmbc3as1警告:tensorflow:来自C: \Users\levig\AppData\Local\Programs\Python38\lib\site packages\tensorflow\Python\training\training_util.py:235:Variable.initialized_value(来自tensorflow.python.ops.variables)为已弃用,并将在将来的版本中删除。说明更新:使用Variable.read_value。2.X中的变量已初始化在热切和图形(在tf.defun中)上下文中自动执行。警告:tensorflow:来自C: \Users\levig\AppData\Local\Programs\Python38\lib\site packages\tensorflow\Python\keras\poptimizer_v2\adagrad.py:82:调用Constantinit(来自tensorflow.python.ops.init_ops)dtype已弃用,并将在将来的版本中删除。更新说明:使用dtype调用初始值设定项实例参数,而不是将其传递给构造函数2021-01-1315:42:27.410575:Itensorflow/core/common_runtime/gpu/gpu_device.cc:1760]找到设备0具有属性:pciBusID:0000:0e:00.0名称:GeForce GTX 1080计算机能力:6.1核心时钟:1.86GHz核心计数:20设备内存大小:8.00GiB设备内存带宽:298.32GiB/s2021-01-13 15:42:27.410786:Wtensorflow/core/common_runtime/gpu/gpu_device.cc:1793]无法dlopen一些GPU库。请确保提到丢失的库如果您想使用GPU,以上都已正确安装。按照指南https://www.tensorflow.org/install/gpu了解如何下载并为您的平台设置所需的库。跳过正在注册GPU设备。。。2021-01-13 15:42:27.7474456:Itensorflow/core/common_runtime/gpu/gpu_device.cc:1300]设备具有强度1边缘矩阵的互连StreamExecutor:2021-01-1315:42:27.7474571:Itensorflow/core/common_runtime/gpu/gpu_device.cc:1306]02021-01-13 15:42:27.7474637:Itensorflow/core/common_runtime/gpu/gpu_device.cc:1319]0:N2021-01-13 15:42:27.482654:Itensorflow/compiler/mlir/mlir_graph_optimization_pass.cc:258]无启用MLIR优化通行证(已注册0次通行证)

这是我的代码:

from __future__ import absolute_import, division, print_function, unicode_literals
import tensorflow as tf
import pandas as pd
CSV_COLUMN_NAMES = ['SepalLength', 'SepalWidth', 'PetalLength', 'PetalWidth', 'Species']
SPECIES = ['Setosa', 'Versicolor', 'Virginica']
train_path = tf.keras.utils.get_file(
"iris_training.csv", "https://storage.googleapis.com/download.tensorflow.org/data/iris_training.csv")
test_path = tf.keras.utils.get_file(
"iris_test.csv", "https://storage.googleapis.com/download.tensorflow.org/data/iris_test.csv")
train = pd.read_csv(train_path, names=CSV_COLUMN_NAMES, header=0)
test = pd.read_csv(test_path, names=CSV_COLUMN_NAMES, header=0)
# Here we use keras (a module inside of TensorFlow) to grab our datasets and read them into a pandas dataframe
train_y = train.pop('Species')
test_y = test.pop('Species')
train.head() # the species column is now gone

def input_fn(features, labels, training=True, batch_size=256):
# Convert the inputs to a Dataset.
dataset = tf.data.Dataset.from_tensor_slices((dict(features), labels))
# Shuffle and repeat if you are in training mode.
if training:
dataset = dataset.shuffle(1000).repeat()
return dataset.batch(batch_size)
# Feature columns describe how to use the input.
my_feature_columns = []
for key in train.keys():
my_feature_columns.append(tf.feature_column.numeric_column(key=key))
# Build a DNN with 2 hidden layers with 30 and 10 hidden nodes each.
classifier = tf.estimator.DNNClassifier(
feature_columns=my_feature_columns,
# Two hidden layers of 30 and 10 nodes respectively.
hidden_units=[30, 10],
# The model must choose between 3 classes.
n_classes=3)
print("starting training")
classifier.train(
input_fn=lambda: input_fn(train, train_y, training=True),
steps=5000)

来自评论

请确保安装了上述缺失的库如果您想使用GPU,请正确使用。遵循GPU支持有关如何下载和设置所需库的指南您的平台。(转述自Soleil)

最新更新