由于 CUDA 错误,无法从 Keras 模型进行预测

我是Python新手。我按照这个网站作为指导来进行一些未来的预测。完成所有操作后,图表没有显示,并且出现以下错误:


2020-10-09 08:27:09.619051: W tensorflow/stream_executor/platform/default/dso_loader.cc:59] Could not load dynamic library 'cudart64_101.dll'; dlerror: cudart64_101.dll not found

2020-10-09 08:27:09.620905: 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.

这是我写的代码:


import pandas as pd

import numpy as np

import tensorflow as tf

import keras

from keras.preprocessing.sequence import TimeseriesGenerator

from keras.models import Sequential

from keras.layers import LSTM, Dense

import plotly.graph_objects as go


df = pd.read_excel('T:/Python/NRN-Netze_Python/Stromverbrauch2Jahren.xlsx')

print(df.info())


df['Datum'] = pd.to_datetime(df['Datum'])

df.set_axis(df['Datum'], inplace = True)

df.drop(columns = ['Datum_u_Uhrzeit', 'Stunden', 'Minuten', 'Uhrzeit'], inplace = True)


value = df['Werte'].values

value = value.reshape((-1, 1))


split_percent = 0.80

split = int(split_percent * len(value))


value_train = value[:split]

value_test = value[split:]

date_train = df['Datum'][:split]

date_test = df['Datum'][split:]


print('')

print(len(value_train))

print(len(value_test))


look_back = 15


train_generator = TimeseriesGenerator(value_train, value_train, length = look_back, batch_size = 20)

test_generator = TimeseriesGenerator(value_test, value_test, length = look_back, batch_size = 1)


model = Sequential()

model.add(LSTM(10, activation = 'relu', input_shape = (look_back, 1)))

model.add(Dense(1))

model.compile(optimizer = 'adam', loss = 'mse')


num_epochs = 25

model.fit(train_generator, epochs = num_epochs, verbose = 1)


prediction = model.predict(test_generator)


value_train = value_train.reshape((-1))

value_test = value_test.reshape((-1))

prediction = prediction.reshape((-1))


trace1 = go.Scatter(

    x = date_train,

    y = value_train,

    mode = 'lines',

    name = 'Original'

)



慕妹3146593
浏览 80回答 1
1回答

素胚勾勒不出你

从错误信息来看,你的显卡好像没有安装CUDA驱动。
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Python