Giter Club home page Giter Club logo

poetry-generation's Introduction

LSTM 唐诗生成

深度神经网络学习打卡,基于五言绝句训练集,训练一个可以创作唐诗的机器模型

执行环境

  • ubuntu16.04
  • python3
  • pytorch 1.7

训练

Geforce 1080 8G, 20epoch,耗时6h,如果GPU内存强悍的话可以调大--batch-size

python run.py --mode train --max-epochs=20 --batch-size=32

生成

给定-txt提示词,即可自动生成唐诗(由于训练数据是5言,推荐预测时也输入5个字)

python run.py --mode test --txt 秋色见浮生

当做首句效果如下:

秋色见浮生,江汉欲周风。
戎装名可得,卫霍莫为荣。
百战攻干铸,中园待紫罗。
不知桃李月,空有竹门头。

藏头诗效果如下:

秋风不敢言,春瓮蔼无踪。
色补衣冠落,香惊蝶朵轻。
见人栖咽处,吹角起烟霞。
浮世嫌人到,孤坟谒子郎。
生憎不得意,胜意自呜咽。

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.