Skip to content

基于seq2seq的闲聊系统。利用PyTorch框架搭建神经网络,编码器采用双向GRU模型,解码器采用融合注意力机制的GRU模型,训练出支持多轮对话的聊天机器人。

Notifications You must be signed in to change notification settings

XuekaiChen/ChatRobot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

基于seq2seq的闲聊系统

效果:

> hello?
Bot: hello .
> where am I?
Bot: you re in a hospital .
> who are you?
Bot: i m a lawyer .
> how are you doing?
Bot: i m fine .
> are you my friend?
Bot: no .
> you're under arrest
Bot: i m trying to help you !
> i'm just kidding
Bot: i m sorry .
> where are you from?
Bot: san francisco .
> it's time for me to leave
Bot: i know .
> goodbye
Bot: goodbye .

1. 准备数据

通常情况下,多轮对话的场景不多,因此项目考虑使用康奈尔电影对话语料库Cornell Movie-Dialogs Corpus 数据集进行模型的训练。下载完数据后,在根目录下创建一个data文件夹,将解压后的Cornell Movie-Dialogs Corpus文件夹放在里面。

2. 数据预处理

preprocessing.ipynb交互式查看处理状态,其代码在utils/file_utils.py中也有

3. 模型训练和评估

运行main.py函数,可适当调整args中的参数值,如max_length,learning_rate等

About

基于seq2seq的闲聊系统。利用PyTorch框架搭建神经网络,编码器采用双向GRU模型,解码器采用融合注意力机制的GRU模型,训练出支持多轮对话的聊天机器人。

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published