shibing624's picture
Update README.md
16d3497
---
language: zh
widget:
- text: "今天你的病好点了吗?"
- text: "苹果手机怎么卖?"
tags:
- Text Generation
- gpt2
- pytorch
license: "apache-2.0"
---
# GPT2 for Chinese Dialog Model(gpt2-dialogbot-base-chinese)
GPT2中文对话生成模型
`gpt2-dialogbot-base-chinese` evaluate couplet test data:
The overall performance of GPT2 on dialog **test**:
|input_text|target_text|
|:-- |:--- |
|今天你的病好点了吗?|好多了,谢谢你的关心|
在常见中文闲聊数据集(包含小黄鸡语料、豆瓣语料、电视剧对白语料、贴吧论坛回帖语料、微博语料、PTT八卦语料、青云语料等)上,基本能语义正确的回答问题。
GPT2对话模型的网络结构(原生GPT2):
![arch](gpt2-model.png)
## Usage
本项目开源在对话文本生成项目:[dialogbot](https://github.com/shibing624/dialogbot),可支持GPT2模型,通过如下命令调用:
Install package:
```shell
pip install -U dialogbot
```
```shell
>>> from dialogbot import GPTBot
>>> model = GPTBot("shibing624/gpt2-dialogbot-base-chinese")
>>> r = model.answer("今天你的病好点了吗?")
'好多了,谢谢你的关心'
```
模型文件组成:
```
gpt2-dialogbot-base-chinese
├── config.json
├── pytorch_model.bin
└── vocab.txt
```
### 训练数据集
#### 中文对话数据集
### 闲聊语料分享
|中文闲聊语料 | 数据集地址 |语料描述|
|---------|--------|--------|
|常见中文闲聊|[chinese_chatbot_corpus](https://github.com/codemayq/chinese_chatbot_corpus)|包含小黄鸡语料、豆瓣语料、电视剧对白语料、贴吧论坛回帖语料、微博语料、PTT八卦语料、青云语料等|
|50w中文闲聊语料 | [百度网盘【提取码:4g5e】](https://pan.baidu.com/s/1M87Zf9e8iBqqmfTkKBWBWA) 或 [GoogleDrive](https://drive.google.com/drive/folders/1QFRsftLNTR_D3T55mS_FocPEZI7khdST?usp=sharing) |包含50w个多轮对话的原始语料、预处理数据|
|100w中文闲聊语料 | [百度网盘【提取码:s908】](https://pan.baidu.com/s/1TvCQgJWuOoK2f5D95nH3xg) 或 [GoogleDrive](https://drive.google.com/drive/folders/1NU4KLDRxdOGINwxoHGWfVOfP0wL05gyj?usp=sharing)|包含100w个多轮对话的原始语料、预处理数据|
- [dialogbot](https://github.com/shibing624/dialogbot)
数据格式:
```text
谢谢你所做的一切
你开心就好
开心
嗯因为你的心里只有学习
某某某,还有你
这个某某某用的好
你们宿舍都是这么厉害的人吗
眼睛特别搞笑这土也不好捏但就是觉得挺可爱
特别可爱啊
```
如果需要训练GPT2模型,请参考[https://github.com/shibing624/dialogbot](https://github.com/shibing624/dialogbot)
## Citation
如果你在研究中使用了dialogbot,请按如下格式引用:
```latex
@software{dialogbot,
author = {Xu Ming},
title = {dialogbot: Dialogue Model Technology Tool},
year = {2021},
url = {https://github.com/shibing624/dialogbot},
}
```