1 Star 0 Fork 10

xjsdn / NLP

forked from 刘佳文 / NLP 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
BSD-3-Clause

NLP

介绍

NLP项目,主要包括atten-seq2seq和transformer模型,实现机器翻译以及对话系统。 目前机器翻译只有cpu环境下的小模型,对话系统完成了transformer的标准模型(具体见结果)。

软件架构

软件架构说明

安装教程

  1. pip install -r requirements.txt
  2. 可能安装完后会提示前面两个东西版本不符合,不用管他
  3. transformer标准模型,在dailydialog训练对话系统模型,链接:https://pan.xunlei.com/s/VN8UfYM4o2Ef4r5hAHYm8KmUA1?pwd=5rht# 提取码:5rht

使用说明

  1. 分对话系统和机器翻译两部分
  2. data为数据集
  3. model为训练的模型
  4. translation文件夹下又分了Seq2Seq和transformer两个模型,大家按需查看使用
  5. 以transformer文件夹为例,attention.py主要实现了注意力机制,transformer.py实现了transformer的主体架构,data.py为数据的预处理以及生成了词典、dataset、dataloader,readdata.py运行可以查看数据形状,train.py为训练模型,predict.py为预测,config.py为一些参数的定义。

结果

base transformer:
  1. 训练集loss 1.040, PPL 2.835
  2. 验证集loss 2.768, PPL 17.635
  3. BLEU1-4: [0.0773, 0.0376, 0.0104, 0.0053]
  4. distinct1-3: [0.02798, 0.15453, 0.36269]
schedule sampling tg=0.9, tr=0.95
  1. 训练集loss 0.930, PPL 2.538
  2. 验证集loss 3.289, PPL 29.728
  3. BLEU1-4: [0.0918, 0.0479, 0.0183, 0.0117]
  4. distinct1-3: [0.029054, 0.18474, 0.43019]
BSD 3-Clause License Copyright (c) 2022, 刘佳文 All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

简介

NLP项目,主要包括atten-seq2seq和transformer模型,实现机器翻译以及对话系统。 目前transformer只做了机器翻译。 展开 收起
Python
BSD-3-Clause
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
Python
1
https://gitee.com/xjsdn/nlp.git
git@gitee.com:xjsdn/nlp.git
xjsdn
nlp
NLP
master

搜索帮助