David Geronimo
David Geronimo

Reputation: 17

Lua version in ZeroBraneStudio vs Torch

I am using ZeroBrane Studio as IDE to code deep learning. I have realized that the models I save when programming in the IDE (using Lua 5.1 as interpreter) do not load well when executing the same loading from Torch7. The same happens when learning from torch (./th code.lua) and then trying to load them inside the IDE. I get something like:

/opt/zbstudio/bin/linux/x64/lua: /home/dg/torch/install/share/lua/5.1/torch/File.lua:294: unknown object

Does anybody know how to check the lua version that torch is using? Any idea on how to workaround this?

Thanks!

update: It seems that I am indeed using the same Lua version (5.1) in both Torch and ZeroBrane. I still get different behaviour (one successful and the other crashing) when passing through torch.load().

Upvotes: 1

Views: 798

Answers (3)

David Geronimo
David Geronimo

Reputation: 17

@siffiejoe: thanks for posing your question regarding versions, it gave me the correct directions to explore.

/opt/zbstudio/bin/linux/x64/lua version is LuaJIT 2.0.2
"lua" command alone points to /usr/bin/lua, and it is Lua 5.1.5
~/torch/install/share/lua/5.1 seemed to contain Lua 5.1
~/torch/install/bin/luajit is 2.1.0-alpha

So after realizing that terminal "th" is using LuaJit 2.1.0 all I had to do is create a user.lua in ZeroBrane and add the line "path.lua = "~/torch/install/bin/luajit". Now ZB is using the same luajit interpreter as th.

Thanks all for your suggestions.

Upvotes: 0

siffiejoe
siffiejoe

Reputation: 4271

Most command line tools on Linux understand the -v command line switch (for "version"). So do Lua and LuaJIT.

To figure out which interpreter is running a particular script, you can scan the arg table for the smallest (usually negative) index:

local exe, i = arg[ 0 ], -1
while arg[ i ] do
  exe, i = arg[ i ], i-1
end
print( exe )

Or (on Linux) you can look into the /proc file system while your script is running:

ls -l /proc/4425/exe

(substitute 4425 with real process ID).

Judging from the error message the interpreter used in ZeroBrane Studio seems to be /opt/zbstudio/bin/linux/x64/lua in your case.

Upvotes: 0

warspyking
warspyking

Reputation: 3113

To check the version of Lua that anything is running, you would usually print _VERSION. It's a global variable that stores the version of Lua (unless you overwrite it, of course).

print(_VERSION)

If this isn't available for some reason, they might state their version on their site (?)

Upvotes: 1

Related Questions