我正在使用$apply
,Theano 0.7
和nolearn 0.6adev
来训练GPU上的神经网络(在lasagne 0.2.dev1
笔记本中)。但是,由于第一层(IPython 3.2.1
),以下网络在等待几个小时后才开始训练:
'reduc'
如果我注释掉第一层,训练将在几秒钟后开始。培训更复杂的网络也不是问题。知道是什么导致了这个问题?
修改:奇怪的是,如果我删除import theano
from lasagne import layers
from lasagne.updates import nesterov_momentum
from nolearn.lasagne import NeuralNet
from nolearn.lasagne import BatchIterator
from lasagne import nonlinearities
from lasagne import init
import numpy as np
testNet = NeuralNet(
layers=[(layers.InputLayer, {"name": 'input', 'shape': (None, 12, 1000, )}),
(layers.Conv1DLayer, {"name": 'reduc', 'filter_size': 1, 'num_filters': 4,
"nonlinearity":nonlinearities.linear,}),
(layers.Conv1DLayer, {"name": 'conv1', 'filter_size': 25, 'num_filters': 100,
'pad': 'same', }),
(layers.MaxPool1DLayer, {'name': 'pool1', 'pool_size': 5, 'stride': 3}),
(layers.Conv1DLayer, {"name": 'conv2', 'filter_size': 15, 'num_filters': 100,
'pad': 'same',
'nonlinearity': nonlinearities.LeakyRectify(0.2)}),
(layers.MaxPool1DLayer, {'name': 'pool2', 'pool_size': 5, 'stride': 2}),
(layers.Conv1DLayer, {"name": 'conv3', 'filter_size': 9, 'num_filters': 100,
'pad': 'same',
'nonlinearity': nonlinearities.LeakyRectify(0.2)}),
(layers.MaxPool1DLayer, {'name': 'pool3', 'pool_size': 2}),
(layers.Conv1DLayer, {"name": 'conv4', 'filter_size': 5, 'num_filters': 20,
'pad': 'same', }),
(layers.Conv1DLayer, {"name": 'conv5', 'filter_size': 3, 'num_filters': 20,
'pad': 'same',}),
(layers.DenseLayer, {"name": 'hidden1', 'num_units': 10,
'nonlinearity': nonlinearities.rectify}),
(layers.DenseLayer, {"name": 'output', 'nonlinearity': nonlinearities.sigmoid,
'num_units': 5})
],
# optimization method:
update=nesterov_momentum,
update_learning_rate=5*10**(-3),
update_momentum=0.9,
regression=True,
max_epochs=1000,
verbose=1,
)
testNet.fit(np.random.random([3000, 12, 1000]).astype(np.float32),
np.random.random([3000, 5]).astype(np.float32))
和conv4
,培训也会在合理的时间内启动。
Edit2 :更奇怪的是,如果我在图层conv5
中将过滤器的大小更改为10,那么培训会在合理的时间内开始。如果之后我停止了单元格的执行,将此值更改为1,然后重新执行单元格,培训就可以了......
最后我开始使用另一个框架,但如果有人感兴趣,here's the link to the thread我开始使用千篇一律用户组。