首页 > 学院 > 开发设计 > 正文

mac 安装 neuraltalk2 无gpu

2019-11-06 07:38:17
字体:
来源:转载
供稿:网友

网上有一些安装的说明,不过都或多或少有些遗漏,特此在这里总结一些,也许有一些步骤也是多余的,不过应该不少

先上一个成果

th eval.lua -model model_id1-501-1448236541.t7_cpu.t7 -image_folder ./images/ -gpuid -1  #gpuid<0表示cpu运行

具体步骤

1.下载

git clone --recursive https://github.com/karpathy/neuraltalk2 #代码

2.安装torch

curl -s https://raw.githubusercontent.com/torch/ezinstall/master/install-deps | bashgit clone https://github.com/torch/distro.git ~/torch --recursivecd ~/torch; ./install.sh添加torch的环境变量,将以下内容写到~/.PRofile中去

source /Users/myusername/torch/install/bin/torch-activate  #myusername是你的用户名保存完成后执行

source ~/.profile完成以上两步就算完成torch了,可以执行以下两个命令来试试

luarocks install image  #测试luarocks命令是否OKth			#测试th命令是否OK3.安装neuraltalk2的环境依赖

sudo ~/torch/install/bin/luarocks install nnsudo ~/torch/install/bin/luarocks install nngraphsudo ~/torch/install/bin/luarocks install image
brew install protobufsudo ~/torch/install/bin/luarocks install loadcaffe
brew tap homebrew/science从HDF官网(https://support.hdfgroup.org/HDF5/)上下载hdf5-1.8.17.tar.gz简要安装步骤如下:(详细步骤:hdf5-1.8.17/release_docs/INSTALL)$ gunzip < hdf5-X.Y.Z.tar.gz | tar xf -   #解压缩$ cd hdf5-X.Y.Z$ ./configure --prefix=/usr/local/hdf5  #安装路径$ make$ make check                # run test suite.$ make install$ make check-install        # verify installation.如果在上面安装过程中,有报ffi.lua不能使用hdf5-1.10.x的问题,可以去lua对应位置加上一个条件,支持1.10.x就ok了

4.模型下载http://cs.stanford.edu/people/karpathy/neuraltalk2/checkpoint_v1.zip    #带gpu的模型

http://cs.stanford.edu/people/karpathy/neuraltalk2/checkpoint_v1_cpu.zip  非gpu模型将checkpoint_v1.zip解压到neuraltalk2目录下5.准备图片

cd neuraltalk2mkdir images #将图片放到此目录下6.生成图片描述
th eval.lua -model model_id1-501-1448236541.t7_cpu.t7 -image_folder ./images/ -gpuid -1 #没有gpu的读者运行此命令cd vispython -m SimpleHTTPServer #启动后访问http://localhost:8000 

访问结果在最开始的地方感谢以下文章的支持

https://ask.julyedu.com/question/7413

http://blog.topspeedsnail.com/archives/594http://www.th7.cn/system/lin/201611/189996.shtml


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表