9 ms·
Torch7 – Scientific computing for LuaJIT
- ot 12y ago[Note: this is a repost from https://news.ycombinator.com/item?id=7927077 https://news.ycombinator.com/item?id=7927077. The original set off the voting ring detector and was demoted] I came across about Torch in this FB comment [1] by Yann LeCun: I have moved to Torch7. My NYU lab uses Torch7, Facebook AI Research uses Torch7, DeepMind and other folks at Google use Torch7. Apparently it is used in many deep learning labs. I think that in Toronto they mostly used Matlab and Python, does anybody know if this is still true? [1] https://www.facebook.com/yann.lecun/posts/10152077631217143?comment_id=10152089275552143&offset=0&total_comments=6 https://www.facebook.com/yann.lecun/posts/10152077631217143?...
- smhx 12y agoI am one of the maintainers. From information first-hand, Torch is used by: - Facebook - Google DeepMind and slowly Google Brain is moving as well. - Certain people at IBM - NYU - IDIAP - LISA LAB (not exclusively, but some students started using it) - Purdue e-lab - Several smaller companies (10-100 companies) There will definitely be several commonly asked questions, and this is my personal perspective on them. Why torch/lua, why not python+?* No reason. Just because. Mostly because LuaJIT is awesome (with it's quirks) and LuaJIT is extremely portable. (we embed torch routinely in tiny devices, afaik not practically possible with python). Is Torch better than Theano/etc.etc.? Better and worse. Every framework has it’s oddities. I like the super-simple design and the compactness of traversing from high-level easy-to-use API to bare-metal C/assembly. Also, torch’s ecosystem was grown not with exclusively lab experiments in mind, with Yann’s strong robotics research, packages were developed with practicality in mind all the time. Custom chips are being developed for convnets (TeraDeep) and they use Torch. Where’s the doxx??? If there’s documentation, I’ve tried to make people aware of it, mostly by consolidating everything torch to this one page: https://github.com/torch/torch7/wiki/Cheatsheet https://github.com/torch/torch7/wiki/Cheatsheet What about Julia? I like Julia a lot, and it’s definitely cool, but the packages for NN and GPUs aren’t very strong, so advantages over Julia are simply code that’s already written. If there are any more questions, feel free to ask them here or just open an issue on the github package. Thanks for reading. Edit: Apologize for the formatting, not very good at hackernews
- pavanky 12y agoHi, I am the lead engineer at ArrayFire[1]. Is there anyway I can get in touch with you ? [1]http://www.arrayfire.com/docs/index.htm http://www.arrayfire.com/docs/index.htm
- psandersen 12y agoArrayFire looks very interesting, as a novice a drop in enhancement of the nn (or nnx for dropout) package for torch would be very useful.
- pavanky 12y agoWe are getting there. In the mean time we have an example on how you can go about building one yourself. You can see it here: https://github.com/arrayfire/arrayfire_examples/blob/master/machine_learning/neural_network.cpp https://github.com/arrayfire/arrayfire_examples/blob/master/...
- psandersen 12y agoThanks for the response, currently I'm doing R&D with easier to use high level representations and if it proves fruitful will be looking at getting the most cost effective speedups in about 6 months. Whats the license for the free edition? I would be sticking to open source code until we secure capital, but would be very interested in your commercial services down the line.
- ludamad 12y agoIt may seem obvious, but I feel like the page you linked could use an occurrence of the word 'C++'. The code snippet was obvious to me, but just a thought.
- pavanky 12y agoThanks for the feedback! While the code snippet is from C++, we have language wrappers for Java, R and Fortran. We'll try to be more clear about this in our documentation.
- mturmon 12y agoThat comment from LeCun is very interesting, because this means he moved from his own language, Lush, which he maintained for many years, to Torch7. And LeCun has very high standards for expressiveness and efficiency.
- smhx 12y agoOh, dont get me started about Lush :), this is my personal opinion, but I tried to use lush for a bit, and I ran away as fast as I can. However, in retrospect, that's probably because it was the first functional programming language that I was introduced to. Also, torch has a great set of people building the ecosystem, lots of communication and collaboration online (github, forums, across labs) which lush lacked.
- ganwar 12y agoToronto and Montreal are main Python oriented labs.
- aton 12y agoWhat are the advantages of using Torch7 over Julia?
- bufo 12y agoJulia doesn't yet have strong support for running stuff on GPUs.
- fyolnish 12y agoTorch/LuaJIT does?
- justincormack 12y agoLuaJIT certainly doesn't at this point; not sure whether torch uses some libraries that do...
- ihnorton 12y agoSupport is, indeed, nascent; but it is coming along well: https://github.com/JuliaGPU https://github.com/JuliaGPU
- otoburb 12y agoI thought LuaJIT and other Lua runtimes are great for scripting and embedded environments, while Julia focused primarily on being a MATLAB replacement (i.e. desktop environments). EDIT: Based on comments in the thread, seems both could do the same job but Torch7 has libraries that make running on GPUs easier vs. Julia.
- joelthelion 12y agoLooks cool. I couldn't find any real documentation, though. Did I miss it?
- tristanz 12y agoThere is a good tutorial here: http://code.cogbits.com/wiki/doku.php?id=start http://code.cogbits.com/wiki/doku.php?id=start
- benjaminva 12y agoI haven't used Torch7 yet, but from heavy usage I can recommend http://www.nongnu.org/gsl-shell/ http://www.nongnu.org/gsl-shell/. GSL-Shell combines Lua + Luajit + GSL-Library (GNU Science Library) + additional syntactic sugar that helps with matrix/vector calculations. I use it for all kinds of linear algebra projects and gsl-shell does an excellent job.
- fit2rule 12y agoI'd love to try this out, but it seems that it uses some luarocks that are unavailable (sundown, cwrap) .. or .. at least, my attempt to do a standard install with the instructions as given has resulted in luarocks not finding any of the required rocks .. anyone know what might be causing this? (EDIT: Never mind I figured it out - if you have a luarocks installed previously, you must do: $ mv /usr/local/etc/luarocks/config-5.1.lua /usr/local/etc/luarocks/config-5.1-old.lua $ mv /usr/local/etc/luarocks/config.lua /usr/local/etc/luarocks/config-5.1.lua
- conistonwater 12y agoI don't understand: how is this better than/different from python (with numpy, scipy, theano and FFI)? Is this a language preference thing where people just want to avoid python?
- fchollet 12y agoIt is essentially a Lua equivalent to Theano. A significant difference, though, is that it makes running your NNs on GPU extremely easy. Also, it is endorsed by the main deep convnets research groups (Facebook, Google).
- deanjones 12y agoWhat specifically do you find not-so-easy about running Theano (or rather, a NN library built on top of Theano) on GPUs?
- benjaminva 12y agoThanks to Luajit, the code you are writing will be compiled to efficient byte code which runs very fast. It's because Lua as a language is simple enough to produce light bytecode that can run in the CPUs cache. Numpy will always do the job, but when speed is really critical, you might want to look into it.
- ludamad 12y agoSpecifically, LuaJIT has a very well-designed bytecode optimized for decoding and with specialization for types. The bytecode dispatch is hand-written in assembly which exploits this. And this is all even if your code never sees a JIT -- LuaJIT JIT'd numerical code is competitive in microbenchmarks.
- deanjones 12y agoI'm not an expert in LuaJIT, but it sounds unlikely that the performance characteristics of torch7 are due to the efficiency of Lua bytecode. The speed with which you can train NNs will be dominated by the performance of the linear algebra libraries which are utilised by the numerical optimisation algorithms (SGD, L-BFGS and the like). Almost everyone ends up using some variant of the BLAS libraries for this.
- cr4zy 12y agoI found https://github.com/BVLC/caffe https://github.com/BVLC/caffe to be 20 to 40x faster for image classification when comparing with Overfeat, which uses Torch - YMMV (The type of BLAS you use makes a gigantic difference. MKL was 2x faster than ATLAS and 5x faster than OpenBLAS). Caffe also has a more active community and cleaner code IMO.
- smhx 12y agocaffe definitely grew in popularity very quickly, and it does a narrow set of tasks very well, but I dont agree that the code is cleaner (in fact I think the opposite), and I dont see the design to be particularly broad-minded (i.e. generic neural networks, or a general scientific computing framework).
- Udo 12y agoIt seems to be written mostly in C, so I wonder how difficult it would be to port this library into an interpreted Lua 5.2 environment. Has anyone tried that yet?
- smhx 12y agoIt should be mostly compatible already, but torch9 (the next version which is getting ready) should be fully compatible I think.
- scythe 12y agoWow, this looks awesome (I usually use C). I had added Lua to a previous project which had been entirely C and it simplified the "outer bits" drastically, as well as being relatively painless to set up. How is the support for complex numbers?
- smhx 12y agoOne thing that isn't really supported yet :-( We have support for doing complex FFTs etc. in the signal package, but otherwise, it is non-existent.