ubuntu下neural-style-master的demo

本教程详细介绍了如何安装Torch,并提供了在Linux和OS X系统上配置环境的步骤。包括安装基本依赖、LuaJIT和Luarocks,以及如何通过Luarocks安装核心包。还解决了在测试时引入lena图像时遇到的问题,提供了正确的引入方法。同时介绍了如何在CPU和GPU环境下运行seq2seq模型,并提供了解决模型中未知Torch类问题的方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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

转载于:https://www.cnblogs.com/XDJjy/p/4928420.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值