[英]TensorFlow / Keras Error : dlerror: cudart64_101.dll not found
我使用 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:\Users\USER\AppData\Local\Programs\Python\Python37\lib\site-packages\pandas\core\frame.py", line 3024, in __getitem__
indexer = self.columns.get_loc(key)
File "C:\Users\USER\AppData\Local\Programs\Python\Python37\lib\site-packages\pandas\core\indexes\base.py", line 3080, in get_loc
return self._engine.get_loc(casted_key)
File "pandas\_libs\index.pyx", line 70, in pandas._libs.index.IndexEngine.get_loc
File "pandas\_libs\index.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 版本。 如果您不想或無法設置 GPU(例如因為您沒有開啟),您可以嘗試使用 tensorflow CPU。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.