1.Installing Torch
参考官网:http://torch.ch/docs/getting-started.html
git clone https://github.com/torch/distro.git ~/torch --recursive
cd ~/torch; bash install-deps;
./install.sh #
The first script installs the basic package dependencies that LuaJIT and Torch require.
The second script 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
#
# On Linux with bash
source ~/.bashrc
# On Linux with zsh
source ~/.zshrc
# On OSX or in Linux with none of the above.
source ~/.profile #
The script adds torch to your PATH variable. You just have to source it once to refresh your env variables. The installation script will detect what is your current shell and modify the path in the correct configuration file.
#
$ luarocks install image
$ luarocks list #
New packages can be installed using Luarocks from the command-line:
#
>>>th 使用该命令启动torch
使用os.exit()退出touch 或者CTRL + C
当测试的时候, 想引入lena的图像就会出错。解决办法:sudo apt-get install ipython-notebook
输入如下三个命令:
>require "image"
>i = image.lena()
>image.display(i)
If you want to display images with th
, you should use other display utilities such as gfx.go
Or, you can use qlua
.
解决办法为使用qlua开启torch:
2.Torch中的seq2seq
https://github.com/macournoyer/neuralconvo
cpu + gpu 环境,运行:
th -i eval.lua
出现unknown Torch class <torch.CudaTensor>
用: th -i eval.lua --cuda
- movie_lines.txt
- contains the actual text of each utterance
- fields:
- lineID
行号ID
- characterID (who uttered this phrase)
角色ID
- movieID
电影
- character name
角色名
- text of the utterance
对话的文本
- movie_conversations.txt
- the structure of the conversations
- fields
- characterID of the first character involved in the conversation
对话中第一个角色ID
- characterID of the second character involved in the conversation
对话中第二个角色ID
- movieID of the movie in which the conversation occurred
对话对应的电影ID
- list of the utterances that make the conversation, in chronological
按时间顺序对话文本
order: ['lineID1','lineID2',É,'lineIDN']
has to be matched with movie_lines.txt to reconstruct the actual content
https://github.com/nicolas-ivanov/debug_seq2seq