【问题标题】:TensorFlow / Keras Error : dlerror: cudart64_101.dll not foundTensorFlow / Keras 错误:dlerror:找不到 cudart64_101.dll
【发布时间】:2021-02-23 17:04:29
【问题描述】:

我使用 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))

我该如何解决这个错误?

【问题讨论】:

标签: python tensorflow keras deep-learning neural-network


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 2020-11-23
    • 2020-08-31
    • 2020-06-23
    • 2021-11-14
    • 2020-05-06
    • 2021-04-12
    • 1970-01-01
    • 2018-06-24
    • 2020-12-22
    相关资源
    最近更新 更多