torch / torch7

http://torch.ch
Other
8.98k stars 2.38k forks source link

Decision to move to Python -- Why? #1226

Open zerothi opened 4 years ago

zerothi commented 4 years ago

Dear torch dev's

I have tried searching around for figuring out why you discontinued the Lua interface and moved to Python.

In particular this has my interest since we also have a Lua interface, but are struggling a bit with end-users adapting it.

So any thoughts on your switch that might be useful for the community who are in the (maybe?) same position as you were would be extremely helpful. Arguments, pros-cons, why Python, etc.. ;)

Hope you'll take the time to answer!

Thanks!

4mig4 commented 3 years ago

Python is much slower so I also do not understand the impetus here.

yash-fn commented 3 years ago

Could just be popularity of python for data science. Ultimately any successful product has to go where the customers are right? Could be learning lua just to use a framework is an overhead people don't want to do.

tastyminerals commented 3 years ago

PyTorch is written in C/C++ not Python, it is as fast as it can be. Python is used to call the C/C++ functions and it is just ffi overhead which for Python is a bit slower than for Lua. But at the end of the day it is about convenience and adoption. Python has tons of libraries it is much easier to integrate into the existing tech stack without writing tons of boilerplate. It is also widespread in academia. Lua although technically an awesome language is much more specialised and requires effort to learn.

Another thing, luajit which is actively used in Torch7 to interface with C is stuck with Lua 5.1 while the language progresses further. Lua 5.3 is not compatible with luajit anymore and never will. This means that you can only use Lua 5.1 with Torch. After luajit maintainer decided to do other things in life, the Lua world was split in halves: with luajit and 5.1 and without, with newer Lua but much slower.