torch / tutorials Goto Github PK
View Code? Open in Web Editor NEWA series of machine learning tutorials for Torch7
A series of machine learning tutorials for Torch7
I noticed in the optim
methods there's a required feval
to be passed through. For example:
f(x)
and df / dx
. What is this f
supposed to do?Is f
a loss function, then what is x
? In some code (e.x. LSTM), why they weren't using optim
?
See #8
Getting a permissions (403) error still/again
this is the errror:
lua:78: attempt to index field 'file' (a nil value)
stack traceback:
/home/ubuntu/torch/install/share/lua/5.1/optim/Logger.lua:78: in function 'add'
4_train.lua:197: in function 'train'
doall.lua:77: in main chunk
[C]: in function 'dofile'
...untu/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:131: in main chunk
[C]: at 0x00406670
Hi,
Not able to access the tutorial link given here:
https://github.com/torch/torch7/wiki/Cheatsheet#tutorials-demos-by-category
Clicking on the Tutorial Link does not do anything, keeps trying to access http://code.madbits.com but is not able to.
Is the documentation for the tutorials available somewhere else? Can you please share it?
I have some difficult to resolve that issue. I install unsup but it's look like not working. I uninstall and install again and i show what i have .
/usr/local/bin/luajit: model.lua:37: attempt to index global 'unsup' (a nil value)
stack traceback:
model.lua:37: in main chunk
[C]: in function 'dofile'
tuto.lua:77: in main chunk
[C]: in function 'dofile'
/usr/local/lib/luarocks/rocks/trepl/scm-1/bin/th:109: in main chunk
[C]: at 0x00405e60
I am getting the following error. can anyone help me with this.
Error: could not find ipython in PATH. Do you have it installed?
cd build && make install
sh: line 0: cd: build: No such file or directory
Error: Build error: Failed installing.
Not updating your shell profile.
You might want to
add the following lines to your shell profile:
Hi there,
I did a fresh install of torch on ubuntu 4.8.2 and I am running through the tutorials. I ran
th -i doall.lua
and it all seems to set up fine till it goes to training. Then it gets stuck here -
==> defining test procedure
==> training!
==> doing epoch on training data:
==> online epoch # 1 [batchSize = 1]
[................................ 1/73257 ....................................] ETA: 0ms | Step: 0ms
I have 3GB memory on this VM so that shouldn't be a problem. I see luajit taking 300% CPU (although each core seems relatively idle) and 44% memory.
I tried to run it a couple of times, and sometimes it gets a little further but it keeps getting stuck in the first epoch. What am I missing?
PS, it does work for mlp model, just not conv
As it is written in the title, after completing the "Getting Started with Torch" tutorial (http://code.cogbits.com/wiki/doku.php?id=tutorial_basics), at the "Getting help" paragraph, the double-TAB for the TAB-completion feature does not work.
Writing the following code:
t7> torch. [TAB] [TAB]
produces the following useless:
t7> torch.e(
instead of what is shown in the tutorial.
datafile http://data.neuflow.org/data/tr-berkeley-N5K-M56x56-lcn.ascii
is not accessible. It is Forbidden.
Is there any other site I can get this dataset?
@clementfarabet @koraykv
Thanks in advance!
The inn using cunn for speed up.
Why not replace cunn bu clnn?
So we can use gpu on Intel Iris Pro.
Hi all,
I want a function that save .png or .mat data like Street View House Number and saved them in torch format. I am a new in programming and torch and it seems the code gets the data ready in torch format.
Hi,
I am trying to run supervised learning example with
th -i doall.lua
But I got error in the middle as following shown,
==> processing options
==> executing all
==> downloading dataset
==> using regular, full training data
==> loading dataset
==> preprocessing data
==> preprocessing data: colorspace RGB -> YUV
==> preprocessing data: normalize each feature (channel) globally
==> preprocessing data: normalize all three channels locally
/usr/local/bin/luajit: ...cal/share/lua/5.1/nn/SpatialSubtractiveNormalization.lua:49: attempt to index a number value
stack traceback:
...cal/share/lua/5.1/nn/SpatialSubtractiveNormalization.lua:49: in function '__init'
/usr/local/share/lua/5.1/torch/init.lua:50: in function </usr/local/share/lua/5.1/torch/init.lua:46>
[C]: in function 'SpatialSubtractiveNormalization'
...cal/share/lua/5.1/nn/SpatialContrastiveNormalization.lua:23: in function '__init'
/usr/local/share/lua/5.1/torch/init.lua:50: in function </usr/local/share/lua/5.1/torch/init.lua:46>
[C]: in function 'SpatialContrastiveNormalization'
1_data.lua:203: in main chunk
[C]: in function 'dofile'
doall.lua:67: in main chunk
[C]: in function 'dofile'
/usr/local/lib/luarocks/rocks/trepl/scm-1/bin/th:131: in main chunk
[C]: at 0x004061d0
I didn't make any changes to the source codes. Please help me with this issue. Thank you!
I wasn't able to figure out what is purpose of gradParameters in 2_suprvised/4_train.lua.
In definition of closure function, at line 152, is set to 0, and then, at line 173, is normalized without being previously set to any new values. Then, what is it for?
Hi,
I cannot run the notebook of imagenet_classification with my CPU only machine. It requires cuda.
I kept getting errors like
MODULE data UNDEFINED warning: module 'data [type 5]' not found deploy.prototxt.lua:32: attempt to call method 'ceil' (a nil value) stack traceback: deploy.prototxt.lua:32: in main chunk [C]: in function 'dofile' /root/torch/install/share/lua/5.1/loadcaffe/loadcaffe.lua:24: in function 'load' [string "-- Setting up networks and downloading stuff ..."]:21: in main chunk [C]: in function 'xpcall' /root/torch/install/share/lua/5.1/itorch/main.lua:179: in function </root/torch/install/share/lua/5.1/itorch/main.lua:143> /root/torch/install/share/lua/5.1/lzmq/poller.lua:75: in function 'poll' /root/torch/install/share/lua/5.1/lzmq/impl/loop.lua:307: in function 'poll' /root/torch/install/share/lua/5.1/lzmq/impl/loop.lua:325: in function 'sleep_ex' /root/torch/install/share/lua/5.1/lzmq/impl/loop.lua:370: in function 'start' /root/torch/install/share/lua/5.1/itorch/main.lua:350: in main chunk [C]: in function 'require' [string "arg={'/root/.local/share/jupyter/runtime/kern..."]:1: in main chunk
Hi, I am new to torch, I am looking ways to save the code written in torch in linux shell,
i found there are ways to save code by .th, .net and .dat,
Can anybody explain me these file extensions and how I can save the whole code from " require 'nn'" to training dataset.
Thanks in aniticipation
Hi guys,
I think i managed to install unsup however It seems to be installing into my usr/local folder and when I try to call it seems it can't be found.
Any ideas?
Here's my error:
/Users/zSUGARBANK/torch/install/bin/luajit: ...rs/zSUGARBANK/torch/install/share/lua/5.1/trepl/init.lua:389: module 'unsup' not found:No LuaRocks module found for unsup
and here's my install log:
Christians-iMac:install zSUGARBANK$ luarocks install /Users/zSUGARBANK/Desktop/unsup-0.1-0.rockspec
Using /Users/zSUGARBANK/Desktop/unsup-0.1-0.rockspec... switching to 'build' mode
Cloning into 'unsup'...
remote: Counting objects: 39, done.
remote: Compressing objects: 100% (37/37), done.
remote: Total 39 (delta 5), reused 14 (delta 1), pack-reused 0
Unpacking objects: 100% (39/39), done.
Checking connectivity... done.
cmake -E make_directory build && cd build && cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="/usr/local/bin/.." -DCMAKE_INSTALL_PREFIX="/usr/local/lib/luarocks/rocks-5.2/unsup/0.1-0" && make
-- The C compiler identification is AppleClang 7.3.0.7030031
-- The CXX compiler identification is AppleClang 7.3.0.7030031
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Torch7 in /usr/local
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/luarocks_unsup-0.1-0-5870/unsup/build
Scanning dependencies of target unsup
[ 50%] Building C object CMakeFiles/unsup.dir/init.c.o
[100%] Linking C shared module libunsup.so
[100%] Built target unsup
cd build && make install
[100%] Built target unsup
Install the project...
-- Install configuration: "Release"
-- Installing: /usr/local/lib/luarocks/rocks-5.2/unsup/0.1-0/lib/libunsup.so
-- Installing: /usr/local/lib/luarocks/rocks-5.2/unsup/0.1-0/lua/unsup/AutoEncoder.lua
-- Installing: /usr/local/lib/luarocks/rocks-5.2/unsup/0.1-0/lua/unsup/ConvPsd.lua
-- Installing: /usr/local/lib/luarocks/rocks-5.2/unsup/0.1-0/lua/unsup/Diag.lua
-- Installing: /usr/local/lib/luarocks/rocks-5.2/unsup/0.1-0/lua/unsup/FistaL1.lua
-- Installing: /usr/local/lib/luarocks/rocks-5.2/unsup/0.1-0/lua/unsup/LinearFistaL1.lua
-- Installing: /usr/local/lib/luarocks/rocks-5.2/unsup/0.1-0/lua/unsup/LinearPsd.lua
-- Installing: /usr/local/lib/luarocks/rocks-5.2/unsup/0.1-0/lua/unsup/SparseAutoEncoder.lua
-- Installing: /usr/local/lib/luarocks/rocks-5.2/unsup/0.1-0/lua/unsup/SpatialConvFistaL1.lua
-- Installing: /usr/local/lib/luarocks/rocks-5.2/unsup/0.1-0/lua/unsup/UnsupModule.lua
-- Installing: /usr/local/lib/luarocks/rocks-5.2/unsup/0.1-0/lua/unsup/UnsupTrainer.lua
-- Installing: /usr/local/lib/luarocks/rocks-5.2/unsup/0.1-0/lua/unsup/init.lua
-- Installing: /usr/local/lib/luarocks/rocks-5.2/unsup/0.1-0/lua/unsup/kmeans.lua
-- Installing: /usr/local/lib/luarocks/rocks-5.2/unsup/0.1-0/lua/unsup/pca.lua
-- Installing: /usr/local/lib/luarocks/rocks-5.2/unsup/0.1-0/lua/unsup/psd.lua
-- Installing: /usr/local/lib/luarocks/rocks-5.2/unsup/0.1-0/lua/unsup/topo-kmeans.lua
-- Installing: /usr/local/lib/luarocks/rocks-5.2/unsup/0.1-0/lua/unsup/whitening.lua
Updating manifest for /usr/local/lib/luarocks/rocks-5.2
unsup 0.1-0 is now built and installed in /usr/local (license: BSD)
The YUV conversion is done only on the first 10000 elements of trainData.data
, but the global normalization is done across all elements (including those which are still RGB and which have a different mean/variance). Fix is to slice the training/test data when doing global normalization, and again when "verifying statistics."
As an aside, why do the comments state "luminance is locally normalized and color globally," when in fact local and global normalization is applied to all channels?
Hello, Clement Farabet,
I'm studying your Machine Learning with Torch7 tutorial and trying its torch7 code. Unfortunately, I could not run the code in section 3_unsupervised successfully (Pls see the following info).
Would you give me some hints to tackle this running error?
(My system configuration is ubuntu 13.04 desktop 64bit , Torch 7.0 installed, Torch packages (unsup, nn, etc..) installed )
Thanks and regards,
Milton
milton@milton-X230:~/Downloads/torch-tutorials-master/3_unsupervised$ torch -i doall.lua
Torch 7.0 Copyright (C) 2001-2011 Idiap, NEC Labs, NYU
Can not find any of the default terminals for linux you can manually set terminal by gnuplot.setterm("terminal-name")
-- ignore option dir
[program started on Sun 21 Jul 2013 06:48:47 PM EDT]
[command line arguments]
seed 1
statinterval 5000
datafile http://data.neuflow.org/data/tr-berkeley-N5K-M56x56-lcn.ascii
v false
lambda 1
beta 1
hessian true
maxhessian 500
kernelsize 9
inputsize 25
nfiltersin 1
etadecay 1e-05
rundir outputs/psd
model conv-psd
maxiter 1000000
eta 0.002
batchsize 1
nfiltersout 16
tied false
hessiansamples 500
threads 2
momentum 0
dir outputs
minhessian 0.02
hessianinterval 10000
display true
wcar
[----------------------]
==> constructing model
==> constructed convolutional predictive sparse decomposition (PSD) auto-encoder
==> training model
torch-qlua: /usr/local/share/torch/lua/unsup/psd.lua:39: attempt to call method 'initDiagHessianParameters' (a nil value)
stack traceback:
[C]: in function 'initDiagHessianParameters'
/usr/local/share/torch/lua/unsup/psd.lua:39: in function 'initDiagHessianParameters'
3_train.lua:7: in main chunk
[C]: in function 'dofile'
doall.lua:117: in main chunk
Lua 5.1 Copyright (C) 1994-2008 Lua.org, PUC-Rio
Hi,
I am new to torch and lua.
I am trying to install torch on window 7.
I have run these three commands
curl -s https://raw.githubusercontent.com/torch/ezinstall/master/install-deps
git clone https://github.com/torch/distro.git ~/torch
cd ~/torch; ./install.sh
but I dont know how to set the path for torch, previously i have instaled lua, it works well.
I was wondering what is the Ubuntu's password used in the Torch7-Linux package distributed as virtual machine. Thanks
While running 2_supervised/1_data.lua, I get a 403 error when trying to wget
http://data.neuflow.org/data/housenumbers/test_32x32.t7
And I get the similar error when visiting with my browser.
Do you happen to own the server on this site, and if so, could you fix the permissions? Thanks.
error info::
/torch/install/share/lua/5.2/graphicsmagick/Image.lua:322: could not load library GraphicsMagickWand
stack traceback:
[C]: in function 'error'
/home/anjiang/torch/install/share/lua/5.2/trepl/init.lua:386: in function 'require'
main.lua:5: in main chunk
[C]: in function 'dofile'
...iang/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:145: in main chunk
[C]: in ?
The completely newbie does not find anything trying to follow the link for the dead wiki page.
Besides, there's no installation guide on Torch.
Criticism or fact... I'm sorry... but I have to find some other tutorial somewhere else, cos this one is completely useless.
When I tried to run the demo of 7_imagenet_classification
as th classify.lua
, I received the following error:
==> Loading network
Successfully loaded ./nin_imagenet.caffemodel
MODULE data UNDEFINED
warning: module 'data' not found
/home/ma/feng/torch/install/bin/luajit: deploy.prototxt.lua:34: attempt to cal
l method 'ceil' (a nil value)
stack traceback:
deploy.prototxt.lua:34: in main chunk
[C]: in function 'dofile'
...feng/torch/install/share/lua/5.1/loadcaffe/loadcaffe.lua:20: in fun
ction 'load'
classify.lua:55: in main chunk
[C]: in function 'dofile'
...feng/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:131: in ma
in chunk
[C]: at 0x00406240
I check the generated deploy.prototxt.lua
, which is
table.insert(model, {'pool4', nn.SpatialAveragePooling(6, 6, 1, 1):ceil()})
maths.md states:
"The Torch package adopts the same concept, so that calling a function directly on the Tensor itself using an object-oriented syntax is equivalent to passing the Tensor as the optional resulting Tensor. The following two calls are equivalent.
torch.log(x, x)
x:log()
"
However, this doesn't always seem to be the case. For example, if we call
x:cat(y), x.reshape(2,3), x:t()
then x does NOT change after the call. In particular, I can't see why x:add(y) changes x, while x:cat(y) doesn't.
So is there any rule on when a tensor will be changed by calling on itself in OO syntax? Thanks.
ubgpu@ubgpu:/github/torch/tutorials/3_unsupervised$ ll/github/torch/tutorials/3_unsupervised$
total 44
drwxrwxr-x 3 ubgpu ubgpu 4096 8月 23 19:34 ./
drwxrwxr-x 12 ubgpu ubgpu 4096 8月 23 04:47 ../
-rw-rw-r-- 1 ubgpu ubgpu 5989 8月 23 04:47 1_data.lua
-rw-rw-r-- 1 ubgpu ubgpu 3613 8月 23 04:47 2_models.lua
-rw-rw-r-- 1 ubgpu ubgpu 5330 8月 23 04:47 3_train.lua
-rw-rw-r-- 1 ubgpu ubgpu 3111 8月 23 04:47 A_kmeans.lua
-rw-rw-r-- 1 ubgpu ubgpu 4232 8月 23 04:47 doall.lua
drwxrwxr-x 2 ubgpu ubgpu 4096 8月 23 04:47 img/
ubgpu@ubgpu:
ubgpu@ubgpu:/github/torch/tutorials/3_unsupervised$/github/torch/tutorials/3_unsupervised$ th doall.lua
ubgpu@ubgpu:
/home/ubgpu/torch/install/bin/luajit: /home/ubgpu/torch/install/share/lua/5.1/trepl/init.lua:354: module 'unsup' not found:No LuaRocks module found for unsup
no field package.preload['unsup']
no file '/home/ubgpu/.luarocks/share/lua/5.1/unsup.lua'
no file '/home/ubgpu/.luarocks/share/lua/5.1/unsup/init.lua'
no file '/home/ubgpu/torch/install/share/lua/5.1/unsup.lua'
no file '/home/ubgpu/torch/install/share/lua/5.1/unsup/init.lua'
no file './unsup.lua'
no file '/home/ubgpu/torch/install/share/luajit-2.1.0-alpha/unsup.lua'
no file '/usr/local/share/lua/5.1/unsup.lua'
no file '/usr/local/share/lua/5.1/unsup/init.lua'
no file '/home/ubgpu/.luarocks/lib/lua/5.1/unsup.so'
no file '/home/ubgpu/torch/install/lib/lua/5.1/unsup.so'
no file './unsup.so'
no file '/usr/local/lib/lua/5.1/unsup.so'
no file '/usr/local/lib/lua/5.1/loadall.so'
stack traceback:
[C]: in function 'error'
/home/ubgpu/torch/install/share/lua/5.1/trepl/init.lua:354: in function 'require'
doall.lua:27: in main chunk
[C]: in function 'dofile'
...bgpu/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:131: in main chunk
[C]: at 0x00406640
ubgpu@ubgpu:~/github/torch/tutorials/3_unsupervised$
I can't run /5_newmodules/1_dropout.lua with th
. Should I run this file on iTorch notebook like this?
$ th 1_dropout.lua
original image:
/home/twlee/torch/install/bin/luajit: 1_dropout.lua:18: attempt to index global 'itorch' (a nil value)
stack traceback:
1_dropout.lua:18: in main chunk
[C]: in function 'dofile'
...wlee/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:131: in main chunk
[C]: at 0x00406670
$ itorch --version
4.0.1
As an FYI, the link at http://code.madbits.com/wiki/doku.php?id=tutorial_basics labeled "documentation" is broken. If this is not the correct destination for such reports, please tell me what is.
Hi,
Can anyone tell me, how to save the trained data and reload it in another file for later testing.
is it by torch.save( command?
Hi!, first of all saying that I'm new using torch and itorch, but I have been trying a couple of afternoons to make this tutorial work and I am still getting an error.
In tutorial 2 part 1, when loading the data I have no problems doing it from console...but when I try to do it from the itorch notebook to visualize the data, I am getting the following error:
Out[1]:
==> processing options
==> downloading dataset
==> using reduced training data, for fast experiments
==> loading dataset
Out[1]:
==> preprocessing data
Out[1]:
==> preprocessing data: colorspace RGB -> YUV
Out[1]:
==> preprocessing data: normalize each feature (channel) globally
Out[1]:
==> preprocessing data: normalize all three channels locally
expected arguments: [Generator] [double] [double] | DoubleTensor [Generator] [double] [double]
stack traceback:
[C]: at 0x7fcf1f980750
[C]: in function 'uniform'
...torch/install/share/lua/5.1/nn/SpatialConvolutionMap.lua:103: in function 'reset'
...torch/install/share/lua/5.1/nn/SpatialConvolutionMap.lua:73: in function '__init'
/home/vvaq/torch/install/share/lua/5.1/torch/init.lua:51: in function </home/vvaq/torch/install/share/lua/5.1/torch/init.lua:47>
[C]: in function 'SpatialConvolutionMap'
...all/share/lua/5.1/nn/SpatialSubtractiveNormalization.lua:35: in function '__init'
/home/vvaq/torch/install/share/lua/5.1/torch/init.lua:51: in function </home/vvaq/torch/install/share/lua/5.1/torch/init.lua:47>
[C]: in function 'SpatialSubtractiveNormalization'
...all/share/lua/5.1/nn/SpatialContrastiveNormalization.lua:23: in function '__init'
/home/vvaq/torch/install/share/lua/5.1/torch/init.lua:51: in function </home/vvaq/torch/install/share/lua/5.1/torch/init.lua:47>
...
[string "local f = function() return dofile '1_data.lu..."]:1: in main chunk
[C]: in function 'xpcall'
/home/vvaq/torch/install/share/lua/5.1/itorch/main.lua:177: in function </home/vvaq/torch/install/share/lua/5.1/itorch/main.lua:143>
/home/vvaq/torch/install/share/lua/5.1/lzmq/poller.lua:75: in function 'poll'
.../vvaq/torch/install/share/lua/5.1/lzmq/impl/loop.lua:307: in function 'poll'
.../vvaq/torch/install/share/lua/5.1/lzmq/impl/loop.lua:325: in function 'sleep_ex'
.../vvaq/torch/install/share/lua/5.1/lzmq/impl/loop.lua:370: in function 'start'
/home/vvaq/torch/install/share/lua/5.1/itorch/main.lua:344: in main chunk
[C]: in function 'require'
[string "arg={'/home/vvaq/.ipython/profile_default..."]:1: in main chunk
Did anyone have a similar problem?.
I have checked and reinstall components... everything seems OK. More details:
Thank you for the help!
I got the following error with cuda option(CUDNN v3 was used),
44: bad argument #3 to 'ClassNLLCriterion_updateOutput' (torch.CudaTensor expected, got number)
I am not able to get what was the error
Thanks in advance
Hi,
The wiki(code.madbits.com/) is not available.
Anyone could help? This website is quite useful for beginners.
Thanks.
The link to the wiki in the readme is no longer working.
In /2-supervised/1_data.lua, the trainData and testData are first normalized globally and then locally, why do we need to normalize data twice?
I added the Dropout layer (that is created in these tutorials) in my network and then created a code to check the gradient using finite differences. Without the Dropout layer, the difference is very less(order of 10e-6), but as I add the Dropout layer, the error increased a lot (0.9). I feel there is some error in dropout you implemented. I am a newbie in torch and i am trying to learn torch using https://github.com/oxford-cs-ml-2015/practical4 .
Setting the mse criterion in doall.lua causes error when the types are cuda or double.
Settings:
cmd:option('-seed', 1, 'fixed input seed for repeatable experiments')
cmd:option('-threads', 8, 'number of threads')
-- data:
cmd:option('-size', 'full', 'how many samples do we load: small | full | extra')
-- model:
cmd:option('-model', 'convnet', 'type of model to construct: linear | mlp | convnet')
-- training:
cmd:option('-save', 'results', 'subdirectory to save/log experiments in')
cmd:option('-plot', false, 'live plot')
cmd:option('-optimization', 'SGD', 'optimization method: SGD | ASGD | CG | LBFGS')
cmd:option('-learningRate', 1e-3, 'learning rate at t=0')
cmd:option('-batchSize', 1, 'mini-batch size (1 = pure stochastic)')
cmd:option('-weightDecay', 0, 'weight decay (SGD only)')
cmd:option('-momentum', 0, 'momentum (SGD only)')
cmd:option('-t0', 1, 'start averaging at t0 (ASGD only), in nb of epochs')
cmd:option('-maxIter', 2, 'maximum nb of iterations for CG and LBFGS')
Error when the type is set to cuda:
/root/torch/install/share/lua/5.1/nn/THNN.lua:804: bad argument #3 to 'v' (cannot convert 'struct THFloatTensor *' to 'struct THCudaTensor *')
stack traceback:
[C]: in function 'v'
/root/torch/install/share/lua/5.1/nn/THNN.lua:804: in function 'MSECriterion_updateOutput'
/root/torch/install/share/lua/5.1/nn/MSECriterion.lua:14: in function 'forward'
4_train.lua:161: in function 'opfunc'
/root/torch/install/share/lua/5.1/optim/sgd.lua:44: in function 'optimMethod'
4_train.lua:184: in function 'train'
doall.lua:80: in main chunk
[C]: in function 'f'
[string "local f = function() return dofile('doall.lua..."]:1: in main chunk
[C]: in function 'xpcall'
/root/torch/install/share/lua/5.1/itorch/main.lua:209: in function </root/torch/install/share/lua/5.1/itorch/main.lua:173>
/root/torch/install/share/lua/5.1/lzmq/poller.lua:75: in function 'poll'
/root/torch/install/share/lua/5.1/lzmq/impl/loop.lua:307: in function 'poll'
/root/torch/install/share/lua/5.1/lzmq/impl/loop.lua:325: in function 'sleep_ex'
/root/torch/install/share/lua/5.1/lzmq/impl/loop.lua:370: in function 'start'
/root/torch/install/share/lua/5.1/itorch/main.lua:381: in main chunk
[C]: in function 'require'
(command line):1: in main chunk
[C]: at 0x00405bd0
Error when set to double type:
/root/torch/install/share/lua/5.1/nn/THNN.lua:804: bad argument #3 to 'v' (cannot convert 'struct THFloatTensor *' to 'struct THDoubleTensor *')
stack traceback:
[C]: in function 'v'
/root/torch/install/share/lua/5.1/nn/THNN.lua:804: in function 'SpatialConvolutionMM_updateOutput'
.../torch/install/share/lua/5.1/nn/SpatialConvolutionMM.lua:72: in function 'updateOutput'
/root/torch/install/share/lua/5.1/nn/Sequential.lua:44: in function 'forward'
4_train.lua:160: in function 'opfunc'
/root/torch/install/share/lua/5.1/optim/sgd.lua:44: in function 'optimMethod'
4_train.lua:184: in function 'train'
doall.lua:80: in main chunk
[C]: in function 'f'
[string "local f = function() return dofile('doall.lua..."]:1: in main chunk
[C]: in function 'xpcall'
/root/torch/install/share/lua/5.1/itorch/main.lua:209: in function </root/torch/install/share/lua/5.1/itorch/main.lua:173>
/root/torch/install/share/lua/5.1/lzmq/poller.lua:75: in function 'poll'
/root/torch/install/share/lua/5.1/lzmq/impl/loop.lua:307: in function 'poll'
/root/torch/install/share/lua/5.1/lzmq/impl/loop.lua:325: in function 'sleep_ex'
/root/torch/install/share/lua/5.1/lzmq/impl/loop.lua:370: in function 'start'
/root/torch/install/share/lua/5.1/itorch/main.lua:381: in main chunk
[C]: in function 'require'
(command line):1: in main chunk
[C]: at 0x00405bd0
MultiMarginCriterion error with cuda:
/root/torch/install/share/lua/5.1/nn/THNN.lua:804: wrong number of arguments for function call
stack traceback:
[C]: in function 'v'
/root/torch/install/share/lua/5.1/nn/THNN.lua:804: in function 'MultiMarginCriterion_updateOutput'
.../torch/install/share/lua/5.1/nn/MultiMarginCriterion.lua:19: in function 'forward'
4_train.lua:161: in function 'opfunc'
/root/torch/install/share/lua/5.1/optim/sgd.lua:44: in function 'optimMethod'
4_train.lua:184: in function 'train'
doall.lua:80: in main chunk
[C]: in function 'f'
[string "local f = function() return dofile('doall.lua..."]:1: in main chunk
[C]: in function 'xpcall'
/root/torch/install/share/lua/5.1/itorch/main.lua:209: in function </root/torch/install/share/lua/5.1/itorch/main.lua:173>
/root/torch/install/share/lua/5.1/lzmq/poller.lua:75: in function 'poll'
/root/torch/install/share/lua/5.1/lzmq/impl/loop.lua:307: in function 'poll'
/root/torch/install/share/lua/5.1/lzmq/impl/loop.lua:325: in function 'sleep_ex'
/root/torch/install/share/lua/5.1/lzmq/impl/loop.lua:370: in function 'start'
/root/torch/install/share/lua/5.1/itorch/main.lua:381: in main chunk
[C]: in function 'require'
(command line):1: in main chunk
[C]: at 0x00405bd0
if I run
torch -i doall.lua -type cuda
I get this error:
torch-qlua: /usr/local/share/torch/lua/nn/SpatialConvolutionMM.lua:42: attempt to call field 'SpatialConvolutionMM_updateOutput' (a nil value)
stack traceback:
[C]: in function 'SpatialConvolutionMM_updateOutput'
/usr/local/share/torch/lua/nn/SpatialConvolutionMM.lua:42: in function 'updateOutput'
/usr/local/share/torch/lua/nn/Sequential.lua:27: in function 'forward'
4_train.lua:157: in function 'opfunc'
/usr/local/share/torch/lua/optim/sgd.lua:36: in function 'optimMethod'
4_train.lua:181: in function 'train'
doall.lua:76: in main chunk
The code works fine if I use the default arguments.
Should I be using a different version of the tutorial?
Hi
I needed to use net:cuda()
before the network ran through the forward pass. Is it just me or can it be modified?
-Makarand
Hello there,
I don't understand why the dataset MNIST from Torch Tutorial dataset MNIST is made of 32x32 images instead of 28x28 as in the original dataset.
Do I have to crop the images using narrow ?
Thanks
I am wondering which one of the following links brings you to the most updated and comprehensive tutorial. Both of them seem to be quite similar to each other..
luarocks install gfx.js
produces errors on my Ubunu 14.04
Here are some
npm http 304 https://registry.npmjs.org/fsevents/0.2.0
npm WARN optional dep failed, continuing [email protected]
..
npm http 304 https://registry.npmjs.org/cookie-signature/1.0.1
/bin/sh: 1: node: not found
gyp: Call to 'node -e "require('nan')"' returned exit status 127. while trying to load binding.gyp
gyp ERR! configure error
npm http 304 https://registry.npmjs.org/debug
gyp ERR! stack Error: gyp
failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/usr/share/node-gyp/lib/configure.js:431:16)
gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:797:12)
gyp ERR! System Linux 3.13.0-32-generic
gyp ERR! command "nodejs" "/usr/bin/node-gyp" "rebuild"
gyp ERR! cwd /tmp/luarocks_gfx.js-scm-0-7846/gfx.js/node_modules/pty.js
gyp ERR! node -v v0.10.25
gyp ERR! node-gyp -v v0.10.10
gyp ERR! not ok
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian
npm ERR! weird error 1
npm http 304 https://registry.npmjs.org/connect/2.11.0
..
npm http 304 https://registry.npmjs.org/inherits
npm ERR! not ok code 0
==> installing static resources into ~/.gfx.js/
==> installing torch client into /home/ihor/torch/install/bin/../share/lua/5.1/gfx/
==> Torch client installed globally, run me like this:
$ luajit -lgfx.start
or
$ luajit -lgfx.go
(this will start the gfx server automatically)
gfx command-line binary installed. Use it to display images quickly
$ gfx test.jpg
Updating manifest for /home/ihor/torch/install/lib/luarocks/rocks
gfx.js scm-0 is now built and installed in /home/ihor/torch/install/ (license: MIT)
then when I launch
ihor@ihor-VirtualBox:~$ luajit -lgfx.go
gm (GraphicsMagick) binary not found, please install (see www.graphicsmagick.org)
sh: 1: node: not found
[gfx.js] server started on port 8000, graphics will be rendered into http://localhost:8000
LuaJIT 2.1.0-alpha -- Copyright (C) 2005-2014 Mike Pall. http://luajit.org/
|_ | | |
| | ___ _ __ | |
| |/ _ | '**/ _| ' \
| | () | | | (| | | |
//|| _**|| ||
JIT: ON SSE2 SSE3 fold cse dce fwd dse narrow loop abc sink fuse
th>
(process:10010): GLib-CRITICAL **: g_slice_set_config: assertion 'sys_page_size == 0' failed
and the gfx doesn't apper to work properly, though it loads a browser on "http://localhost:8000/" which it is "Unable to connect" to. Or if I launch differently,
ihor@ihor-VirtualBox:~$ luajit -lgfx.start
gm (GraphicsMagick) binary not found, please install (see www.graphicsmagick.org)
[gfx.js] server started on port 8000, graphics will be rendered into http://localhost:8000
sh: 1: node: not found
Things look a bit different under root. Firefox is launchd here aswell displaying the same.
root@ihor-VirtualBox:/home/ihor# luajit -lgfx.go
gm (GraphicsMagick) binary not found, please install (see www.graphicsmagick.org)
[gfx.js] server started on port 8000, graphics will be rendered into http://localhost:8000
sh: 1: node: not found
(process:10309): GLib-CRITICAL **: g_slice_set_config: assertion 'sys_page_size == 0' failed
1422546489939 addons.xpi WARN Add-on [email protected] is missing bootstrap method install
Note this
th> require 'gfx.js'
gm (GraphicsMagick) binary not found, please install (see www.graphicsmagick.org)
{
show : function: 0x41582d78
chart : function: 0x415830a8
redraw : function: 0x41583160
startserver : function: 0x41582ce8
template : "/home/ihor/.gfx.js/templates/"
templates : {...}
static : "/home/ihor/.gfx.js/static/data/"
list : function: 0x41582cc8
verbose : true
image : function: 0x4098b550
killserver : function: 0x41582d58
listservers : function: 0x41582d08
prefix : "/data/"
clear : function: 0x41583140
images : function: 0x41582f68
}
Note when it thinks it is working successfully (under root)
root@ihor-VirtualBox:/home/ihor# luajit -gfx.go
usage: luajit [options]... [script [args]...].
Available options are:
-e chunk Execute string 'chunk'.
-l name Require library 'name'.
-b ... Save or list bytecode.
-j cmd Perform LuaJIT control command.
-O[opt] Control LuaJIT optimizations.
-i Enter interactive mode after executing 'script'.
-v Show version information.
-E Ignore environment variables.
-- Stop handling options.
Execute stdin and stop handling options.
root@ihor-VirtualBox:/home/ihor# luajit -lgfx.go
gm (GraphicsMagick) binary not found, please install (see www.graphicsmagick.org)
[gfx.js] server started on port 8000, graphics will be rendered into http://localhost:8000
sh: 1: node: not found
(process:10462): GLib-CRITICAL **: g_slice_set_config: assertion 'sys_page_size == 0' failed
LuaJIT 2.1.0-alpha -- Copyright (C) 2005-2014 Mike Pall. http://luajit.org/
|_ | | |
| | ___ _ __ | |
| |/ _ | '**/ _| ' \
| | () | | | (| | | |
//|| _**|| ||
JIT: ON SSE2 SSE3 fold cse dce fwd dse narrow loop abc sink fuse
th> require 'gfx.js'
th> require 'image'
th> i=image.lena()
th> gfx
th>> .image(i)
[gfx.js] rendering cell <dom_1422546926079420629243124>
th>
but it's not, nothing happens, still "Unable to connect"
apt-get install graphicsmagick
from root
(Talking about the
gm (GraphicsMagick) binary not found, please install (see www.graphicsmagick.org)
error)
though previously, when the bugging happened, "luarocks list" showed me
graphicsmagick
1.scm-0 (installed) - /home/ihor/torch/install/lib/luarocks/rocks
anyway.
This might be a worthy warning
npm WARN This failure might be due to the use of legacy binary "node"
Still get problems with
ihor@ihor-VirtualBox:~$ th -x
[gfx.js] server started on port 8000, graphics will be rendered into http://localhost:8000
sh: 1: node: not found
[gfx.js] clearing all cached graphics
(process:4116): GLib-CRITICAL **: g_slice_set_config: assertion 'sys_page_size == 0' failed
So it looks like it tries to find "node".
And still don't see anything initialized on my port.
Might be just a problem with virtualbox, though.
Got this while running 2_supervised with cuda option
/usr/local/bin/luajit: /usr/local/share/lua/5.1/nn/ClassNLLCriterion.lua:15: bad argument #3 to 'ClassNLLCriterion_updateOutput' (torch.CudaTensor expected, got number)
obj=torch.load('tr-berkeley-N5K-M56x56-lcn.ascii','ascii')
gives me :
/home/olivier/torch/install/share/lua/5.1/torch/File.lua:270: read error: read 1 blocks instead of 15680000 at /home/olivier/torch/pkg/torch/lib/TH/THDiskFile.c:310
stack traceback:
[C]: in function 'read'
/home/olivier/torch/install/share/lua/5.1/torch/File.lua:270: in function </home/olivier/torch/install/share/lua/5.1/torch/File.lua:190>
[C]: in function 'read'
/home/olivier/torch/install/share/lua/5.1/torch/File.lua:270: in function 'readObject'
/home/olivier/torch/install/share/lua/5.1/torch/File.lua:311: in function 'load'
[string "obj=torch.load('tr-berkeley-N5K-M56x56-lcn.as..."]:1: in main chunk
[C]: in function 'xpcall'
/home/olivier/torch/install/share/lua/5.1/itorch/main.lua:179: in function </home/olivier/torch/install/share/lua/5.1/itorch/main.lua:143>
/home/olivier/torch/install/share/lua/5.1/lzmq/poller.lua:75: in function 'poll'
...e/olivier/torch/install/share/lua/5.1/lzmq/impl/loop.lua:307: in function 'poll'
...e/olivier/torch/install/share/lua/5.1/lzmq/impl/loop.lua:325: in function 'sleep_ex'
...e/olivier/torch/install/share/lua/5.1/lzmq/impl/loop.lua:370: in function 'start'
/home/olivier/torch/install/share/lua/5.1/itorch/main.lua:350: in main chunk
[C]: in function 'require'
[string "arg={'/run/user/1000/jupyter/kernel-9964e02c-..."]:1: in main chunk
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.