Coder Social home page Coder Social logo

ai-poet's Introduction

AI-poet

写诗机器人

给定开头和诗歌背景创作诗句

基于pytorch

环境要求

pytorch 0.2+

numpy

python2.7

visdom

训练

训练前应当打开visdom:

python -m visdom.server

执行:

python2 train.py

命令行参数:

参数名(均为可选参数) 默认值 含义
batch-size 64
epochs 20
lr 0.01
data-path 'tang.npz' 数据源路径
model-path 'checkpoint/' 存储模型位置
embedding-dim 128
hidden-dim 256
print-per-batch 20

生成

执行:

python2 gen.py --start-words='xxxxx' --background='xxxx,xxxx。'

参数名(均为可选参数) 默认值 含义
start-words '忽如一夜春风来' 诗句开头
background '北风卷地白草折,胡天八月即飞雪。' 诗歌背景
max-gen-len 200 诗歌最长生成长度
data-path 'tang.npz' 数据源路径
model-path 'checkpoint/tang_199.pth' 训练好的模型位置
embedding-dim 128 选择的模型的embedding dimension
hidden-dim 256 选择的模型的LSTM层的hidden dimension

备注

不支持cuda,需要使用GPU加速请自行改写代码

参考 && 数据源:

  1. https://github.com/chenyuntc/pytorch-book

ai-poet's People

Contributors

iznauy avatar

Watchers

 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.