All Projects → L1aoXingyu → Char Rnn Pytorch

L1aoXingyu / Char Rnn Pytorch

使用PyTorch实现Char RNN生成古诗和周杰伦的歌词

Projects that are alternatives of or similar to Char Rnn Pytorch

Attentive Neural Processes
implementing "recurrent attentive neural processes" to forecast power usage (w. LSTM baseline, MCDropout)
Stars: ✭ 33 (-71.05%)
Mutual labels:  jupyter-notebook, rnn
Bitcoin Price Prediction Using Lstm
Bitcoin price Prediction ( Time Series ) using LSTM Recurrent neural network
Stars: ✭ 67 (-41.23%)
Mutual labels:  jupyter-notebook, rnn
Neural Networks
All about Neural Networks!
Stars: ✭ 34 (-70.18%)
Mutual labels:  jupyter-notebook, rnn
Stockpriceprediction
Stock Price Prediction using Machine Learning Techniques
Stars: ✭ 700 (+514.04%)
Mutual labels:  jupyter-notebook, rnn
Pytorch Pos Tagging
A tutorial on how to implement models for part-of-speech tagging using PyTorch and TorchText.
Stars: ✭ 96 (-15.79%)
Mutual labels:  jupyter-notebook, rnn
Tensorflow cookbook
Code for Tensorflow Machine Learning Cookbook
Stars: ✭ 5,984 (+5149.12%)
Mutual labels:  jupyter-notebook, rnn
Tensorflow Tutorials For Time Series
TensorFlow Tutorial for Time Series Prediction
Stars: ✭ 1,067 (+835.96%)
Mutual labels:  jupyter-notebook, rnn
Headlines
Automatically generate headlines to short articles
Stars: ✭ 516 (+352.63%)
Mutual labels:  jupyter-notebook, rnn
Speech Emotion Recognition
Detecting emotions using MFCC features of human speech using Deep Learning
Stars: ✭ 89 (-21.93%)
Mutual labels:  jupyter-notebook, rnn
Lstm chem
Implementation of the paper - Generative Recurrent Networks for De Novo Drug Design.
Stars: ✭ 87 (-23.68%)
Mutual labels:  jupyter-notebook, rnn
Telemanom
A framework for using LSTMs to detect anomalies in multivariate time series data. Includes spacecraft anomaly data and experiments from the Mars Science Laboratory and SMAP missions.
Stars: ✭ 589 (+416.67%)
Mutual labels:  jupyter-notebook, rnn
Codesearchnet
Datasets, tools, and benchmarks for representation learning of code.
Stars: ✭ 1,378 (+1108.77%)
Mutual labels:  jupyter-notebook, rnn
Video Classification
Tutorial for video classification/ action recognition using 3D CNN/ CNN+RNN on UCF101
Stars: ✭ 543 (+376.32%)
Mutual labels:  jupyter-notebook, rnn
Lstm Sentiment Analysis
Sentiment Analysis with LSTMs in Tensorflow
Stars: ✭ 886 (+677.19%)
Mutual labels:  jupyter-notebook, rnn
Deeplearning
深度学习入门教程, 优秀文章, Deep Learning Tutorial
Stars: ✭ 6,783 (+5850%)
Mutual labels:  jupyter-notebook, rnn
Rnn Notebooks
RNN(SimpleRNN, LSTM, GRU) Tensorflow2.0 & Keras Notebooks (Workshop materials)
Stars: ✭ 48 (-57.89%)
Mutual labels:  jupyter-notebook, rnn
Easy Deep Learning With Keras
Keras tutorial for beginners (using TF backend)
Stars: ✭ 367 (+221.93%)
Mutual labels:  jupyter-notebook, rnn
Tsai
Time series Timeseries Deep Learning Pytorch fastai - State-of-the-art Deep Learning with Time Series and Sequences in Pytorch / fastai
Stars: ✭ 407 (+257.02%)
Mutual labels:  jupyter-notebook, rnn
Machine Learning
My Attempt(s) In The World Of ML/DL....
Stars: ✭ 78 (-31.58%)
Mutual labels:  jupyter-notebook, rnn
Pytorch Learners Tutorial
PyTorch tutorial for learners
Stars: ✭ 97 (-14.91%)
Mutual labels:  jupyter-notebook, rnn

Char-RNN-PyTorch

使用字符级别的RNN进行文本生成,使用PyTorch框架。Gluon实现

Requirements

PyTorch 0.3

MxTorch

tensorboardX

按照 pytorch 官网安装 pytorch,将 mxtorch 下载下来,放到根目录,安装 tensorboardX 实现 tensorboard 可视化

\Char-RNN-PyTorch
	\mxtorch
	\data
	\dataset
	\models
	config.py
	main.py

训练模型

所有的配置文件都放在 config.py 里面,通过下面的代码来训练模型

python main.py train

也可以在终端修改配置

python main.py train \
	--txt='./dataset/poetry.txt' \ # 训练用的txt文本
	--batch=128  \ # batch_size
	--max_epoch=300 \ 
	--len=30 \ # 输入RNN的序列长度
	--max_vocab=5000 \ # 最大的字符数量
	--embed_dim=512 \ # 词向量的维度
	--hidden_size=512 \ # 网络的输出维度
	--num_layers=2 \ # RNN的层数
	--dropout=0.5

如果希望使用训练好的网络进行文本生成,使用下面的代码

python main.py predict \
	--begin='天青色等烟雨' \ # 生成文本的开始,可以是一个字符,也可以一段话
	--predict_len=100 \ # 希望生成文本的长度
	--load_model='./checkpoints/CharRNN_best_model.pth' # 读取训练模型的位置

Result

如果使用古诗的数据集进行训练,可以得到下面的结果

天青色等烟雨翩 黄望堪魄弦夜 逐奏文明际天月辉 豪天明月天趣 天外何山重满 遥天明上天  心空游无拂天外空寂室叨

如果使用周杰伦的歌词作为训练集,可以得到下面的结果

这感觉得可能 我这玻童来 城堡药比生对这些年风天 脚剧飘逐在尘里里步的路 麦缘日下一经经 听觉得远回白择
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].