Giter Site home page Giter Site logo

songci-rnn's Introduction

songci-rnn

Generating Songci (Poetry of the Song Dynasty) by machine. Based on QuanSongci and RNN.
Live Demo
If the sample result is shit, you can refresh the page to make it surprise you.


How to use

  1. Get torch-rnn. torch-rnn is based on Torch7, you should set up Torch environment first.
  2. Copy the songci.txt to torch-rnn/data/
  3. Enter torch-rnn directory
  4. You can train your own model or use my provided model. Run
    python scripts/preprocess.py --input_txt data/songci.txt --output_h5 songci.h5 --output_json songci.json
    
    # train the model
    th train.lua -input_h5 songci.h5 -input_json songci.json -gpu -1  # without gpu
    
    # sample text
    th sample.lua -checkpoint cv/checkpoint_yourcheckpoint.t7 -length 200 -gpu -1
    
    # or you can sample text from my trained model
     th sample.lua -checkpoint songci_epoch50_loss5.106.t7 -length 200 -gpu -1
    

吟·宋词

通过全宋词训练RNN,随机生成宋词
Live Demo
如果生成结果很烂,可尝试多刷新几次,总会惊艳到你。有些反正我是不相信这竟然是机器生成的(= =)


使用

  1. 下载 torch-rnn. torch-rnn 基于 Torch7, 首先先配置Torch环境
  2. 拷贝 songci.txttorch-rnn/data/
  3. 进入 torch-rnn 目录
  4. 你可以自己训练模型也可以用我提供的模型
    python scripts/preprocess.py --input_txt data/songci.txt --output_h5 songci.h5 --output_json songci.json
    
    # 训练
    th train.lua -input_h5 songci.h5 -input_json songci.json -gpu -1  # cpu模式
    
    # 生成文本
    th sample.lua -checkpoint cv/checkpoint_yourcheckpoint.t7 -length 200 -gpu -1
    
    # 用我提供的模型生成文本
     th sample.lua -checkpoint songci_epoch50_loss5.106.t7 -length 200 -gpu -1
    

If you have any problem, please contact [email protected] (ノ゚▽゚)ノ

songci-rnn's People

Contributors

hevlfreis avatar

Stargazers

chaiyinggg avatar

Watchers

James Cloos avatar chaiyinggg avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.