TensorFlow / Keras Error : dlerror: cudart64_101.dll not fou



我用Keras写了一个程序。当我运行程序时,它崩溃了,并出现如下所示的错误:

2021-02-23 18:50:50.  : W tensorflow/stream_executor/platform/default/dso_loader.cc:59] Could not load dynamic library 'cudart64_101.dll'; dlerror: cudart64_101.dll not found
2021-02-23 18:50:50.  : I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.

Traceback (most recent call last):
File "C:/Users/USER/PycharmProjects/Sofia/main.py", line 26, in <module>
X = dataset[:,0:8]
File "C:UsersUSERAppDataLocalProgramsPythonPython37libsite-packagespandascoreframe.py", line 3024, in __getitem__
indexer = self.columns.get_loc(key)
File "C:UsersUSERAppDataLocalProgramsPythonPython37libsite-packagespandascoreindexesbase.py", line 3080, in get_loc
return self._engine.get_loc(casted_key)
File "pandas_libsindex.pyx", line 70, in pandas._libs.index.IndexEngine.get_loc
File "pandas_libsindex.pyx", line 75, in pandas._libs.index.IndexEngine.get_loc
TypeError: '(slice(None, None, None), slice(0, 8, None))' is an invalid key
下面是我的代码:
# Develop Neural Network with Keras
# Load Libraries
# first neural network with keras tutorial
from keras.models import Sequential
from keras.layers import Dense
import numpy
from pandas import read_csv
# fix random seed for reproducibility
seed = 7
numpy.random.seed(seed)
# Load Data
dataset = read_csv('pima-indians-diabetes.data.csv', delimiter=',')
# split into input (X) and output (y) variables
X = dataset[:,0:8]
y = dataset[:,8]
# Define Keras Model
model = Sequential()
model.add(Dense(12, input_dim=8, activation='relu'))
model.add(Dense(8, activation='relu'))
model.add(Dense(1, activation='sigmoid'))
# Compile Keras Model
model.compile(loss='binary_crossentropy', optimizer='adam', metrics=['accuracy'])
# Fit Keras Model
model.fit(X, y, epochs=150, batch_size=10)
# Evaluate Keras
_, accuracy = model.evaluate(X, y)
print('Accuracy: %.2f' % (accuracy*100))

我该如何修复这个错误?

您可能没有安装NVIDIA GPU Computing Toolkit,或者您的路径配置不正确,或者您的tensorflow安装版本需要不同的cuda版本。你可以尝试使用tensorflow CPU,如果你不想或不能设置你的GPU(例如,因为你没有)。

最新更新