Get Lua running with Torch on Windows 10 (with lim

2019-08-02 19:37发布

Setting up Deep Learning Framework [Lua, Torch]:

I need to set up Lua running with Torch on Windows 10 and the ZeroBrane IDE, with limited possibilities of installing Software and restricted download rights.

It took me so Long, so I thought I might share a recipe for you guys. I would be glad if it helped you.

1条回答
放荡不羁爱自由
2楼-- · 2019-08-02 20:12

SETTING UP

  1. (Admin) Download/Install tdm64/gcc/5.1.0-2.exe Compiler
  2. (Admin) Download/Install ZeroBrane (Lua IDE)
  3. Download lua/5.3.4.tar.gz (https://www.lua.org/download.html)
  4. Write batch file build.cmd
@echo off
setlocal
:: you may change the following variable's value
:: to suit the downloaded version
set lua_version=5.3.4
set work_dir=%~dp0
:: Removes trailing backslash
:: to enhance readability in the following steps
set work_dir=%work_dir:~0,-1%
set lua_install_dir=%work_dir%\lua
set compiler_bin_dir=%work_dir%\tdm-gcc\bin
set lua_build_dir=%work_dir%\lua-%lua_version%
set path=%compiler_bin_dir%;%path%

cd /D %lua_build_dir%
mingw32-make PLAT=mingw

echo.
echo **** COMPILATION TERMINATED ****
echo.
echo **** BUILDING BINARY DISTRIBUTION ****
echo.

:: create a clean "binary" installation
mkdir %lua_install_dir%
mkdir %lua_install_dir%\doc
mkdir %lua_install_dir%\bin
mkdir %lua_install_dir%\include

copy %lua_build_dir%\doc\*.* %lua_install_dir%\doc\*.*
copy %lua_build_dir%\src\*.exe %lua_install_dir%\bin\*.*
copy %lua_build_dir%\src\*.dll %lua_install_dir%\bin\*.*
copy %lua_build_dir%\src\luaconf.h %lua_install_dir%\include\*.*
copy %lua_build_dir%\src\lua.h %lua_install_dir%\include\*.*
copy %lua_build_dir%\src\lualib.h %lua_install_dir%\include\*.*
copy %lua_build_dir%\src\lauxlib.h %lua_install_dir%\include\*.*
copy %lua_build_dir%\src\lua.hpp %lua_install_dir%\include\*.*

echo.
echo **** BINARY DISTRIBUTION BUILT ****
echo.

%lua_install_dir%\bin\lua.exe -e"print [[Hello!]];print[[Simple Lua test successful!!!]]"

echo.

pause

SETTING UP TORCH UNDER LUA ON WINDOWS

--- Quick and dirty ---

  1. Download and unzip the desired binary build from: https://github.com/hiili/WindowsTorch
  2. Generate user.lua file in C:\Users\Name.zbstudio:

    path.lua = [[C:\app\tools\torch\bin\luajit.exe]]
    
  3. Move the C:\app\tools\torch\lua folder to C:\app\tools\torch\bin

--- Untested alternatives ---

Not tested, but I encourage you: https://github.com/torch/torch7/wiki/Windows#cmder Maybe second best option is to build a virtual environment with linux

Note: More information on Torch can be found here https://github.com/soumith/cvpr2015/blob/master/cvpr-torch.pdf


GET STARTED WITH LUA AND TORCH

http://torch.ch/docs/tutorials.html I recommend Torch Video Tutorials to get the basics straight (https://github.com/Atcold/torch-Video-Tutorials)

This is a Torch Cheetsheet for further reading (https://github.com/torch/torch7/wiki/Cheatsheet): - Newbies - Installing and Running Torch - Installing Packages - Tutorials, Demos by Category - Loading popular datasets - List of Packages by Category

查看更多
登录 后发表回答