Giter Site home page Giter Site logo

chinese_poem_writer's Introduction

Chinese poem writer

Introduction

We built a Chinese poem writer based on Temporal Convolutional Networks (TCN). This paper recently indicates that a simple TCN architecture outperforms RNNs across a diverse range of tasks and datasets, while demonstrating longer effective memory. Therefore, we built this Chinese poem writer using TCN.

Dependencies

Python3.x (Tested with 3.5)
PyTorch (Tested with 0.4.0)

Installation

To use this code, please do:

  1. Clone the repo:
    git clone https://github.com/jfzhang95/Chinese_Poem_Writer
    cd Chinese_Poem_Writer
  2. To try the demo code, please run:
    python main.py -m fast

Training

To train this Chinese poems writer, you can run:

python train.py

For more details, please see in train.py.

Usage

We built three poem generator modes:

  1. fast - it can generate each word only based on the last word.
  2. context - it can generate each word based on the entire previous context.
  3. head - it can generate Acrostic based on user inputs.

To change generator mode, you should change "fast" to "context" or "head" behind:

python main.py -m fast

Results

python main.py -m fast

fast

python main.py -m context

context

python main.py -m head

head

Upload generated poem into diyiziti, we can get more artistic result!

4

TODO

  • Basic model and function
  • Write a script to upload generated poem automatically
  • Training our model with more and better data

We thank the authors of pytorch-tcn for making their PyTorch implementation of TCN available!

chinese_poem_writer's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  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.