wb14123/seq2seq-couplet
wb14123/seq2seq-couplet has 5,478 GitHub stars and 1,048 forks. GitHot measured -2 stars in 24 hours and -4 in 7 days. Last checked 2026-11-13 10:14 UTC. Last push 2024-07-25.
seq2seq 모델과 딥러닝을 사용해 중국어 대련을 만듭니다.
측정된 스타 증가
- in 24h
- -2
- in 7 days
- -4
- in 15 days
- 기록 수집 중
- in 1 month
- 기록 수집 중
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
OriginalThis 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:
| 上联 | 下联 |
|---|---|
| 殷勤怕负三春意 | 潇洒难书一字愁 |
| 如此清秋何吝酒 | 这般明月不须钱 |
| 天朗气清风和畅 | 云蒸霞蔚日光辉 |
| 梦里不知身是客 | 醉时已觉酒为朋 |
| 千秋月色君长看 | 一夜风声我自怜 |
관련 프로젝트 살펴보기
tensorflow/tensorflow
모두를 위한 오픈소스 머신러닝 프레임워크
201,584 스타huggingface/transformers
🤗 Transformers: 텍스트, 비전, 오디오, 멀티모달 분야의 최첨단 머신러닝 모델을 위한 모델 정의 프레임워크로, 추론과 학습을 모두 지원합니다.
168,943 스타AUTOMATIC1111/stable-diffusion-webui
Stable Diffusion 웹 UI
165,303 스타Comfy-Org/ComfyUI
그래프와 노드로 구성된 인터페이스를 갖춘, 가장 강력하고 모듈성이 뛰어난 확산 모델 GUI, API, 백엔드입니다. 세계에서 가장 빠른 로컬 추론 엔진입니다.
146,622 스타