All Projects → youyuge34 → Poems_generator_keras

youyuge34 / Poems_generator_keras

唐诗,藏头诗,按需自动生成古诗,基于Keras、LSTM-RNN。文档齐全。

Projects that are alternatives of or similar to Poems generator keras

Evolutionary Computation Course
Jupyter/IPython notebooks about evolutionary computation.
Stars: ✭ 173 (-1.14%)
Mutual labels:  jupyter-notebook
Time series prediction
This is the code for "Time Series Prediction" By Siraj Raval on Youtube
Stars: ✭ 174 (-0.57%)
Mutual labels:  jupyter-notebook
Kipoi
Kipoi's model zoo API
Stars: ✭ 174 (-0.57%)
Mutual labels:  jupyter-notebook
Provingground
Proving Ground: Tools for Automated Mathematics
Stars: ✭ 173 (-1.14%)
Mutual labels:  jupyter-notebook
Pytorch sac
PyTorch implementation of Soft Actor-Critic (SAC)
Stars: ✭ 174 (-0.57%)
Mutual labels:  jupyter-notebook
Kdd18 Gluon
KDD18 Tutorial: Deep Learning and Natural Language Processing with Apache MXNet (Incubating) Gluon
Stars: ✭ 174 (-0.57%)
Mutual labels:  jupyter-notebook
Deep Crowd Counting crowdnet
An independent implementation of "CrowdNet: A Deep Convolutional Network for Dense Crowd Counting"
Stars: ✭ 173 (-1.14%)
Mutual labels:  jupyter-notebook
Clinicalbert
ClinicalBERT: Modeling Clinical Notes and Predicting Hospital Readmission (CHIL 2020 Workshop)
Stars: ✭ 175 (+0%)
Mutual labels:  jupyter-notebook
Introduction To Time Series Forecasting Python
Introduction to time series preprocessing and forecasting in Python using AR, MA, ARMA, ARIMA, SARIMA and Prophet model with forecast evaluation.
Stars: ✭ 173 (-1.14%)
Mutual labels:  jupyter-notebook
Prml
Python implementations (on jupyter notebook) of algorithms described in the book "PRML"
Stars: ✭ 174 (-0.57%)
Mutual labels:  jupyter-notebook
Captcha break
验证码识别
Stars: ✭ 2,268 (+1196%)
Mutual labels:  jupyter-notebook
Mpld3
mpld3 provides a custom stand-alone javascript library built on D3, which parses JSON representations of plots. The mpld3 python module provides a set of routines which parses matplotlib plots (using the mplexporter framework) and outputs the JSON description readable by mpld3.js.
Stars: ✭ 2,121 (+1112%)
Mutual labels:  jupyter-notebook
Machine Learning And Reinforcement Learning In Finance
Machine Learning and Reinforcement Learning in Finance New York University Tandon School of Engineering
Stars: ✭ 173 (-1.14%)
Mutual labels:  jupyter-notebook
Iocaml
An OCaml kernel for the IPython notebook
Stars: ✭ 173 (-1.14%)
Mutual labels:  jupyter-notebook
Deep Algotrading
A resource for learning about deep learning techniques from regression to LSTM and Reinforcement Learning using financial data and the fitness functions of algorithmic trading
Stars: ✭ 173 (-1.14%)
Mutual labels:  jupyter-notebook
Ipynb
Package / Module importer for importing code from Jupyter Notebook files (.ipynb)
Stars: ✭ 174 (-0.57%)
Mutual labels:  jupyter-notebook
Nlp Exercises
Stars: ✭ 174 (-0.57%)
Mutual labels:  jupyter-notebook
Home Credit Default Risk
2nd Place Solution 💰🥈
Stars: ✭ 175 (+0%)
Mutual labels:  jupyter-notebook
Captcha
Breaking captchas using torch
Stars: ✭ 174 (-0.57%)
Mutual labels:  jupyter-notebook
Qnn Mo Pynq
Stars: ✭ 173 (-1.14%)
Mutual labels:  jupyter-notebook

Poems_generator_Keras

 

  • 唐诗,古诗,五言绝句自动生成,基于Keras,LSTM-RNN。      
  • 附带训练好的模型文件,可直接上手使用。        
  • 功能:藏头诗,随机写诗,给定第一句诗/字进行作诗          

测试结果:

在GPU Tesla K80上,2s/epoch,一共有3w+个epoch。训练时的测试结果令人满意:

==================Epoch 4304=====================
县幽公事稀,上仙晓更高。风行随时朝,还云避倚里。
病客与僧闲,来王不鹤星。火气北所晚,边飞无已去。
玉律阳和变,下石凤明君。对动晨桂步,飞群安行金。
==================Epoch 4308=====================
绮阁云霞满,地国五自去。云人芳国思,云堂兵曲中。
帝城深处寺,此梦与云色。朝枝使天何,水天开光时。
石门千仞断,乡金在画使。天林东去结,北里石叶锦。
==================Epoch 4312=====================
王室今如毁,汉云树来寒。路平应人江,山不开云古。
扰扰走人寰,文尘李气奉。时秋田客岁,高斗不南中。
何以保孤危,都书丹道边。惜言为日芳,波垂日桃花。
==================Epoch 4316=====================
爱酒如偷蜜,心若大如去。入忆似烟春,如成台忆圣。
我爱窦高士,如箭变素外。明成丹泥为,今风酒影重。
画楼吹笛妓,何从出还玉。遍阴火川下,乘合未云虚。

环境配置

  • python3
  • tensorflow
  • Keras
  • h5py
  • Jupyter
  • numpy……

  食用指南

from config import Config
#加载模型(若无训练好的模型,会开始训练)
model = PoetryModel(Config)
print('model loaded')

#藏头诗
sen = model.predict_hide('争云日夏')
print(sen)

  输出结果:

争空谁上尽,云云中林翠。日落危西烟,夏更无长塞。

  其他方法调用请看notebook,里面都有。

如何使用训练好的模型:

  1. 我训练好了一个h5模型,点击页面中右侧的小箭头可下载,迅雷满速
  2. poetry_model.h5放入根目录,记得改一下self.loaded_model = True
  3. 注意,此模型只跑了4000+epoch,还有提升空间    

更新说明:

Version 1.1:

  • 代码大幅度重构,更加简洁
  • 添加多个模型方法,可按需要生成诗句
  • notebook中添加样例

Version 1.0:
    在ioiogoo的架构之上进行优化:

  • 改用Jupyter notebook
  • 数据只使用五言绝句,否则输出不稳定
  • 修复bugs
  • 精简代码
  • 训练时的测试数据会写入out/out.txt
  • 训练时的测试输入为随机一首诗的开头,确保输出好看
  • ………………
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].