- Notifications
You must be signed in to change notification settings - Fork87
基于Pytorch的中文聊天机器人 集成BeamSearch算法
License
NotificationsYou must be signed in to change notification settings
yanwii/seq2seq
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Pytorch 厉害了!
Requirements:
Python3
Pytorch
Jieba分词
python2.7 pip2 install http://download.pytorch.org/whl/cu80/torch-0.2.0.post3-cp27-cp27mu-manylinux1_x86_64.whl pip2 install torchvision python3.5 pip3 install http://download.pytorch.org/whl/cu80/torch-0.2.0.post3-cp35-cp35m-manylinux1_x86_64.whl pip3 install torchvision python3.6 pip3 install http://download.pytorch.org/whl/cu80/torch-0.2.0.post3-cp36-cp36m-manylinux1_x86_64.whl pip3 install torchvision
很经典的贪心算法,在很多领域都有应用。
# 准备数据 python3 preprocessing.py # 训练 python3 seq2seq.py train # 预测 python3 seq2seq.py predict # 重新训练 python3 seq2seq.py retrain
me > 我是谁 drop [3, 1], 1 drop [1, 6, 1], 2 drop [7, 6, 1], 3 drop [4, 5, 6, 1], 4 drop [7, 6, 8, 1], 5 ai > __UNK__ -1.92623626371 ai > -1.41548742168 ai > 关你 -1.83084125204 ai > 我是你 0.0647218796512 ai > 关你屁事 -0.311924366579
修复 ValueError: Expected 2 or 4 dimensions (got 1)