2

Google's Deep Q Network for Atari Games is here.

https://github.com/rahular/deepmind-dqn

When I run it with GPU setting

./run_gpu <game name>

I had this error

../torch/bin/luajit: ./convnet.lua:22: attempt to call local 'convLayer' (a nil value)
stack traceback:
    ./convnet.lua:22: in function 'network'
    ./NeuralQLearner.lua:89: in function '__init'
    ...einforcement_Learning/torch/share/lua/5.1/torch/init.lua:51: in function <...einforcement_Learning/torch/share/lua/5.1/torch/init.lua:47>
    [C]: at 0x7f419423d380
    ./initenv.lua:133: in function 'setup'
    train_agent.lua:52: in main chunk
    [C]: at 0x00406230

The code that caused this issue is in this file https://github.com/rahular/deepmind-dqn/blob/master/dqn/convnet.lua

and it is in this function

function create_network(args)

    local net = nn.Sequential()
    net:add(nn.Reshape(unpack(args.input_dims)))

    --- first convolutional layer
    local convLayer = nn.SpatialConvolution

    if args.gpu >= 0 then
        net:add(nn.Transpose({1,2},{2,3},{3,4}))
        convLayer = nn.SpatialConvolutionCUDA
    end

    net:add(convLayer(args.hist_len*args.ncols, args.n_units[1],
                        args.filter_size[1], args.filter_size[1],
                        args.filter_stride[1], args.filter_stride[1],1))
    net:add(args.nl())

The net:add(convLayer( is 22th line.

I used gpu setting so it seems

convLayer =  nn.SpatialConvolutionCUDA

caused convLayer to be nil.

Does anyone know why nn.SpatialConvolutionCUDA returns a nil ?

4

2 回答 2

3

代码最初是带有 GPU 支持的,还是您自己添加的?

您应该替换已弃用的层,即替换:

net:add(nn.Transpose({1,2},{2,3},{3,4}))
convLayer = nn.SpatialConvolutionCUDA

convLayer = nn.SpatialConvolution

检查图层的文档。

编辑:使用这个分支,我修复了它以获得 GPU 支持。

于 2015-04-10T15:11:21.013 回答
1

找到了解决方案。

使用这个 github 分支

https://github.com/soumith/deepmind-atari

克隆这个分支后,然后使用 luarocks 安装 cutorch 和 cunn。

现在你可以运行代码了。

于 2015-04-14T08:14:59.757 回答