Ubuntu 18.04.4 LTS 安裝Torch步驟


Torch 官網

Torch: Torch website lua: lua website


安裝步驟

Torch can be installed to your home folder in ~/torch by running these three commands:

# in a terminal, run the commands WITHOUT sudo
# installs the basic package dependencies that LuaJIT and Torch require. 
git clone https://github.com/torch/distro.git ~/torch --recursive
cd ~/torch
# installs LuaJIT, LuaRocks, and then uses LuaRocks (the lua package manager) 
# to install core packages like torch, nn and paths, as well as a few other packages.
bash install-deps
./install.sh

[NOTE]


  • 在使用第一個命令克隆的時候會報以下類似的警告:

    Submodule 'pkg/sys' (https://github.com/torch/sys.git) registered for path 'pkg/sys'
    

    [處理辦法]忽略就行..大概意思就是子模塊將被下載后放在相應的位置處..

  • 在執行第三條命令之前需要修改 install-deps 文件

    1. Home -> Torch -> Open install-deps

    2. find the keyword python-software-properties and replace it with software-python-common, save and exit.

    3. install the software-python-common with the command

      sudo apt-get install software-properties-common
      
    4. run the command

      cd ~/torch; bash install-deps;
      
  • 執行以上命來之后,腳本后自動更新環境變量,你也可以手動進行更新:

    source ~/.bashrc
    

卸載Torch

If you ever need to uninstall torch, simply run the command:

rm -rf ~/torch

檢驗安裝是否成功

Once installed you can run torch with the command th from you prompt!

這樣你就可以在這個交互窗口內學習和使用Torch.


[補充] install torch with Lua 5.2 instead of LuaJIT

LuaJIT是Lua編程語言的實時編譯器,采用C語言寫的Lua代碼的解釋器。

執行以下命令.

git clone https://github.com/torch/distro.git ~/torch --recursive
cd ~/torch

# clean old torch installation
./clean.sh
# optional clean command (for older torch versions) 對於老版本的torch,可選清除命來.
# curl -s https://raw.githubusercontent.com/torch/ezinstall/master/clean-old.sh | bash

# https://github.com/torch/distro : set env to use lua
TORCH_LUA_VERSION=LUA52 ./install.sh
# New packages can be installed using Luarocks from the command-line:

# run luarocks WITHOUT sudo
$ luarocks install image
$ luarocks list



免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM