char-cnn+torch+ubuntu14.04(RNN)
来源:互联网 发布:淘宝职称论文署名单位 编辑:程序博客网 时间:2024/05/23 10:47
一 搭建Torch 环境
1 在命令行依次执行下列命令:
# in a terminal, run the commandscurl -sk https://raw.githubusercontent.com/torch/ezinstall/master/install-deps | bashgit clone https://github.com/torch/distro.git ~/torch --recursivecd ~/torch; ./install.sh
2 执行下列命令,使得安装过程中被更改的PATH生效:
source ~/.bashrc
3 执行下列命令查看torch是否安装成功:
$ th ______ __ | Torch7 /_ __/__ ________/ / | Scientific computing for Lua. / / / _ \/ __/ __/ _ \ | /_/ \___/_/ \__/_//_/ | https://github.com/torch | http://torch.ch th> torch.Tensor{1,2,3} 1 2 3[torch.DoubleTensor of dimension 3]th>
注:(1)如果不使用torch,可以使用下列命令卸载:
rm -rf ~/torch(2) 可以使用luarocks命令安装其他的torch包:
$ luarocks install image$ luarocks list
二 运行char-cnn
1 执行下列命令安装必要的包:
$ luarocks install nngraph $ luarocks install optim
2 如果使用CUDA GPU加速,则在安装好cuda toolkit后,执行下列命令安装相应的包:
$ luarocks install cutorch$ luarocks install cunn
3 执行下列命令训练模型:
$ th train.lua -data_dir data/<code>tinyshakespeare</code> -gpuid -1其中(1)文本数据input.txt存放在
data/tinyshakepeare目录下
(2)-gpuid -1表示使用cpu进行训练,-gpuid 0表示用gpu训练(使用gpu训练确实比cpu快好多,推荐使用gpu)
4 上述训练在cv文件夹下生成类似
lm_lstm_epoch0.95_2.0681.t7
的checkpoint文件,其中2.0681表示validation loss,该值小,则效果好,最后生成samples时选用validation loss最小的checkpoint文件,生成samples文件的命令如下所示:
h sample.lua cv/lm_lstm_epoch18.91_1.3895.t7 -gpuid 0
参考资料:
char-cnn:
https://github.com/karpathy/char-rnn
Torch:
http://torch.ch/docs/getting-started.html
The Unreasonable Effectiveness of Recurrent Neural Networks:
http://karpathy.github.io/2015/05/21/rnn-effectiveness/
汪峰老师作词机终于填坑了
http://phunters.lofter.com/post/86d56_732209b
1 0
- char-cnn+torch+ubuntu14.04(RNN)
- char-cnn+torch+ubuntu16.04(RNN) 安装过程
- Ubuntu14.04 Torch Configuration
- ubuntu14.04 安装Torch
- torch安装(ubuntu14.04)
- CNN+RNN
- [torch] rnn training
- 【循环网络】Torch中的rnn
- DNN、CNN、RNN简析
- CNN RNN 杂想
- CNN、RNN与LSTM
- 【笔记】CNN RNN要点
- CNN、RNN、DNN区别
- CNN和RNN区别
- cnn+rnn+attention
- 浅谈CNN与RNN
- ubuntu14.04下torch的安装方法及配置
- torch学习(六) rnn package
- WexinPay for WooCommerce
- XML解析
- openGL学习笔记 简单概念
- 树 树的概念 树的存储结构
- POSIX线程-什么是线程
- char-cnn+torch+ubuntu14.04(RNN)
- 欢迎使用CSDN-markdown编辑器
- POSIX线程-为什么要用线程
- POSIX线程-基本操作
- Linux学习笔记(九)——Linux文件压缩与打包
- python写的一个邮件收发工具
- 黑马程序员——函数
- POSIX线程-互斥量
- ubuntu下使用NDK 生成so库文件时MK文件的编写