我已经在git clone
之前安装了torch deep learning module,之后又使用luarocks make
安装了neuralnetwork_tutorial.lua,安装非常顺利。 require 'dp'
在火炬提示中效果很好。
但是当我尝试执行File.lua(th neuralnetwork_tutorial.lua
)时,会抛出以下错误。
Tanny @neuralnetwork_tutorial.lua: About to initiate: datasource = dp.Mnist{input_preprocess = dp.Standardize()}
Tanny @/home/ubuntu/binaries/torches/torch/install/share/lua/5.1/dp/preprocess/standardize.lua: Marked presence!!!
Tanny @/home/ubuntu/binaries/torches/torch/install/share/lua/5.1/dp/torch/File.lua says: @177 typeidx= 3
Tanny @/home/ubuntu/binaries/torches/torch/install/share/lua/5.1/dp/torch/File.lua says: @177 typeidx= 1
Tanny @/home/ubuntu/binaries/torches/torch/install/share/lua/5.1/dp/torch/File.lua says: @177 typeidx= 4
Tanny @/home/ubuntu/binaries/torches/torch/install/share/lua/5.1/dp/torch/File.lua says: @177 typeidx= 0
Tanny @/home/ubuntu/binaries/torches/torch/install/share/lua/5.1/dp/torch/File.lua says: @177 typeidx= 28
Tanny @/home/ubuntu/binaries/torches/torch/install/share/lua/5.1/dp/torch/File.lua says: @259 typeidx= 28
/home/ubuntu/binaries/torches/torch/install/bin/luajit: ...aries/torches/torch/install/share/lua/5.1/torch/File.lua:260: unknown object
stack traceback:
[C]: in function 'error'
...aries/torches/torch/install/share/lua/5.1/torch/File.lua:260: in function 'readObject'
...aries/torches/torch/install/share/lua/5.1/torch/File.lua:252: in function 'readObject'
...aries/torches/torch/install/share/lua/5.1/torch/File.lua:277: in function 'loadData'
...es/torches/torch/install/share/lua/5.1/dp/data/mnist.lua:74: in function 'loadTrainValid'
...es/torches/torch/install/share/lua/5.1/dp/data/mnist.lua:61: in function '__init'
...aries/torches/torch/install/share/lua/5.1/torch/init.lua:50: in function <...aries/torches/torch/install/share/lua/5.1/torch/init.lua:46>
[C]: in function 'Mnist'
neuralnetwork_tutorial.lua:16: in main chunk
[C]: in function 'dofile'
...ches/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:131: in main chunk
[C]: at 0x0804d650
我在这些脚本中放了一些print
语句来理解流程。我碰巧注意到在MNIST中获取对象后的第一步是确定对象的类型;其中8个已被宣布。类型已通过0到7声明,0为TYPE_NIL
。但是代码失败了,因为它检测到类型28(??)。
请问我哪里出错?或者在哪里寻找问题?
P.S。:脚本自行下载数据,但由于某些标准的企业代理设置问题,它无法下载。因此,我个人下载了数据{{3}}并将其存储在特定的数据目录中。如果这可能是一个线索??
答案 0 :(得分:1)
好的,所以这是代码中的一个错误(序列化的MNIST不是跨平台的)。通过使用ascii格式而不是二进制格式序列化数据集来修复。