Python gpu运行时出现Keras(theano)错误

Python gpu运行时出现Keras(theano)错误,python,deep-learning,gpu,keras,theano,Python,Deep Learning,Gpu,Keras,Theano,已经有很长时间了,我试着去理解一个问题。请帮帮我 我试图从标准示例git lib()运行“Keras”示例 如果我使用CPU,那么一切都会正常工作;但是,如果我尝试使用GPU加速,它将崩溃而不会捕获任何错误: # build the model: a single LSTM print('Build model...') print(' 1') model = Sequential() print(' 2') model.add(LSTM(128, input_shape=(maxlen

已经有很长时间了,我试着去理解一个问题。请帮帮我

我试图从标准示例git lib()运行“Keras”示例

如果我使用CPU,那么一切都会正常工作;但是,如果我尝试使用GPU加速,它将崩溃而不会捕获任何错误:

# build the model: a single LSTM
print('Build model...')
print('   1')
model = Sequential()
print('   2')
model.add(LSTM(128, input_shape=(maxlen, len(chars))))
print('   3')
model.add(Dense(len(chars)))
print('   4')
model.add(Activation('softmax'))

print('   5')
optimizer = RMSprop(lr=0.01)

print('   Compilling')
model.compile(loss='categorical_crossentropy', optimizer=optimizer)
我放置了一些
print()
,以便更好地理解错误的位置。 我得到的是:

runfile('C:/Users/kostya/Desktop/temp/python/test.py', wdir='C:/Users/kostya/Desktop/temp/python/')
Using Theano backend.
Using cuDNN version 5110 on context None
Preallocating 1638/2048 Mb (0.800000) on cuda
Mapped name None to device cuda: GeForce GTX 650 (0000:01:00.0)
WARNING: Preallocating too much memory can prevent cudnn and cublas from working properly
DEVICE: cuda
corpus length: 206433
total chars: 79
nb sequences: 68798
Vectorization...
Build model...
   1
   2


Ядро остановилось, перезапуск *(It means: The Core has stopped, restarting)*
如果我通过standatr python控制台运行它,我将接受类似的错误。(python.exe紧急停止)

我使用:Win 10-64、Python 3.6.1、激活独立环境的Anaconda、CUDA 8.0、cuRNN 5.1、mkl 2017.0.3、numpy 1.13.0、theano 0.9.0、conda-forge.keras 2.0.2、m2w64 openblas 0.2.19、conda-forge.pygpu 0.6.8、VC 14.0等

这是我的
.theanoc.txt
配置文件。(我确信这能抓住他。如果我把
设备=cpu
-它工作正常(但速度缓慢))


您正在尝试对CUDA后端使用
gpuarray
后端选项(
preallocate
)。来自Theano:

此值仅在使用(GpuArray后端)时分配GPU内存。有关旧后端,请参阅config.lib.cnmem

尝试在Theano配置中替换

[gpuarray]
preallocate = 0.8


谢谢,但它不起作用。在这种情况下,它甚至不分配0.8的内存。我使用CUDA 8.0和Theano 0.9.0,它们支持GpuArray后端。
[gpuarray]
preallocate = 0.8
[lib]
cnmem = 0.8