百科.dev
全部条目AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
S

seq2seq-couplet

> 编程语言
开源

使用 seq2seq 模型播放对联。

5.5K stars0 点赞0 次浏览
访问官网GitHub

工具介绍

使用 seq2seq 模型播放对联。

This is a project use seq2seq model to play couplets (对对联)。 This project is written with Tensorflow. You can try the demo at https://ai.binwang.me/couplet.

Pre-requirements

  • Tensorflow
  • Python 3.6
  • Dataset

Dataset

You will need some data to run this program, the dataset can be downloaded from this project.

** Note: If you are using your own dataset, you need to add <s> and <\s> as the first two line into the vocabs file. **

Usage

Train

Open couplet.py and config the file locations and hyperparams. Then run python couplet.py to train the model. You can see the training loss and bleu score at Tensorbloard. You may need to re-config learning_rate when you find the loss stops descresing. Here is an example of the loss graph:

If you stoped the training and want to continue to train it. You can set restore_model to True and use m.train(<epoches>, start=<start>), which start is the steps you've already run.

I've trained the model on a Nvidia GTX-1080 GPU for about 4 days.

Run the trained model

Open server.py and config the vocab_file and model_dir params. Then run python server.py will start a web service that can play couplet.

Or build the Docker image with Dockerfile and run it with Docker. Remember to mount the correct model file paths into the Docker container.

Examples

Here are some examples generated by this model:

上联 下联 殷勤怕负三春意 潇洒难书一字愁 如此清秋何吝酒 这般明月不须钱 天朗气清风和畅 云蒸霞蔚日光辉 梦里不知身是客 醉时已觉酒为朋 千秋月色君长看 一夜风声我自怜

GitHub Issues· 0 开放

在 GitHub 查看全部

暂无开放 Issues,或尚未同步最近议题。

核心特点

  • •Python
  • •deep-learning
  • •machine-learning
  • •seq2seq

> 标签

Pythondeep-learningmachine-learningseq2seq

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言