{"id":13468119,"url":"https://github.com/wb14123/seq2seq-couplet","last_synced_at":"2026-01-30T06:40:46.716Z","repository":{"id":39452921,"uuid":"122696125","full_name":"wb14123/seq2seq-couplet","owner":"wb14123","description":"Play couplet with seq2seq model. 用深度学习对对联。","archived":false,"fork":false,"pushed_at":"2024-07-25T02:24:32.000Z","size":41,"stargazers_count":5485,"open_issues_count":11,"forks_count":1071,"subscribers_count":126,"default_branch":"master","last_synced_at":"2024-08-01T15:13:11.130Z","etag":null,"topics":["deep-learning","machine-learning","seq2seq"],"latest_commit_sha":null,"homepage":"https://ai.binwang.me/couplet","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wb14123.png","metadata":{"files":{"readme":"README.markdown","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-02-24T02:44:52.000Z","updated_at":"2024-08-01T15:13:11.130Z","dependencies_parsed_at":"2023-01-21T23:01:00.889Z","dependency_job_id":"c284f8d0-c04b-4cdb-b868-400cbc2b4561","html_url":"https://github.com/wb14123/seq2seq-couplet","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wb14123%2Fseq2seq-couplet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wb14123%2Fseq2seq-couplet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wb14123%2Fseq2seq-couplet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wb14123%2Fseq2seq-couplet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wb14123","download_url":"https://codeload.github.com/wb14123/seq2seq-couplet/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":222107298,"owners_count":16932453,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["deep-learning","machine-learning","seq2seq"],"created_at":"2024-07-31T15:01:05.841Z","updated_at":"2026-01-30T06:40:46.669Z","avatar_url":"https://github.com/wb14123.png","language":"Python","funding_links":[],"categories":["Python","Natural Language Processing"],"sub_categories":["Conversation \u0026 Translation"],"readme":"\nThis 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](https://ai.binwang.me/couplet).\n\nPre-requirements\n--------------\n\n* Tensorflow\n* Python 3.6\n* Dataset\n\n\nDataset\n-----------\n\nYou will need some data to run this program, the dataset can be downloaded from [this project](https://github.com/wb14123/couplet-dataset).\n\n** Note: If you are using your own dataset, you need to add `\u003cs\u003e` and `\u003c\\s\u003e` as the first two line into the vocabs file. **\n\nUsage\n------------\n\n### Train\n\nOpen `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:\n\n![loss graph](https://user-images.githubusercontent.com/1906051/36624881-50586e54-1950-11e8-8383-232763831cbc.png)\n\nIf you stoped the training and want to continue to train it. You can set `restore_model` to `True` and use `m.train(\u003cepoches\u003e, start=\u003cstart\u003e)`, which `start` is the steps you've already run.\n\nI've trained the model on a Nvidia GTX-1080 GPU for about 4 days.\n\n\n### Run the trained model\n\nOpen `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.\n\nOr build the Docker image with Dockerfile and run it with Docker. Remember to mount the correct model file paths into the Docker container.\n\n\nExamples\n-------------\n\nHere are some examples generated by this model:\n\n| 上联                        | 下联                |\n|-----------------------------|--------------------|\n| 殷勤怕负三春意                | 潇洒难书一字愁        |\n| 如此清秋何吝酒                | 这般明月不须钱        |\n| 天朗气清风和畅                | 云蒸霞蔚日光辉        |\n| 梦里不知身是客                | 醉时已觉酒为朋        |\n| 千秋月色君长看                | 一夜风声我自怜        |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwb14123%2Fseq2seq-couplet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwb14123%2Fseq2seq-couplet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwb14123%2Fseq2seq-couplet/lists"}