GithubHelp home page GithubHelp logo

charrnn's Introduction

CharRNN


文本自动生成项目Char-RNN

语言



项目简介


最近刚刚学习完RNN和LSTM、GRU,对LSTM结构不是很理解,所以上网查看资料,刚好看到一位大神写的一篇博客, 顿时觉得茅塞顿开,看到最后,建议立刻上手一个简单的项目加深自己的理解。马不停蹄,我也立刻尝试了他推荐的文本生成项目, 所以此项目也主要是参照该位大神的项目, 在其中加入了部分的个人理解和修改,在此表示感谢!

项目实现: 五字唐诗和周杰伦歌词的生成,有相关训练集的还可以进行小说的生成。

项目结构


主要分为modeltrainsample模块。
model部分包含了模型的主要结构,train部分主要是导入模型结构,训练模型以及保存模型,sample部分就是直接导入最后的模型,然后根据用户输入的初始文本, 开始作诗或者写歌。

数据准备: 把训练数据(古诗,歌词)读取为长文本,从头开始,按固定长度,顺次取定长的序列。对应标签序列为该序列后一个时间长度的序列,序列最后一位为序列第一个字。
如:空山新雨后 对应 山新雨后空

模型结构: 模型主要使用了多层LSTM结构,每训练一个batch,便把最终状态作为下一次训练的初始状态输入。

示例


示例1

示例2:

charrnn's People

Contributors

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