未提供项目描述
项目描述
“像树懒一样放松,让DeText为你做理解”
DeText:深度神经文本理解框架
DeText是一个用于 NLP 相关排名、分类和语言生成任务的深度文本理解框架。它利用深度神经网络的语义匹配来理解搜索和推荐系统中的成员意图。
作为一个通用的 NLP 框架,DeText 可以应用于许多任务,包括搜索和推荐排名、多类分类和查询理解任务。
更多详细信息可以在LinkedIn 工程博客文章中找到。
强调
- 由最先进的深度神经网络提供支持的自然语言理解
- 深度模型的自动特征提取
- 端到端培训
- 排名源和目标之间的交互建模
- 具有很大灵活性的通用框架
- 可定制的模型架构
- 多文本编码器支持
- 多种数据输入类型支持
- 各种优化选择
- 标准训练流控制
- 便于使用
- 基于配置的建模(例如,通过命令行进行的所有配置)
通用模型架构
DeText 支持包含以下组件的通用模型架构:
-
词嵌入层。它通过n矩阵将单词序列转换为ad。
-
用于文本编码层的 CNN/BERT/LSTM。它将词嵌入矩阵作为输入,并将文本数据映射到固定长度的嵌入中。
-
交互层。它基于文本嵌入生成深度特征。选项包括连接、余弦相似度等。
-
广泛和深度特征处理。我们以广泛而深入的方式将传统特征与交互特征(深度特征)结合起来。
-
MLP层。MLP层是结合宽特征和深特征。
所有参数都被联合更新以优化训练目标。
模型可配置
DeText 为客户为自己的用例构建定制网络提供了极大的灵活性:
-
LTR/分类层:内部 LTR 损失实现,或 tf-ranking LTR 损失,多类分类支持。
-
MLP 层:可自定义的层数和维度数。
-
交互层:支持 Cosine Similarity、Hadamard Product 和 Concatenation。
-
文本嵌入层:支持 CNN、BERT、LSTM,在过滤器、层、维度等方面具有自定义参数。
-
连续特征归一化:按元素重新缩放,值归一化。
-
分类特征处理:建模为实体嵌入。
所有这些都可以通过 DeText 模板中的超参数进行自定义。请注意,DeText 框架支持 tf-ranking,即用户可以选择 DeText 中定义的 LTR loss 和 metrics。
用户指南
开发环境搭建
- 创建你的 virtualenv(Python 版本 >= 3.7)
VENV_DIR = <your venv dir> python3 -m venv $VENV_DIR # Make sure your python version >= 3.7 source $VENV_DIR/bin/activate # Enter the virtual environment
- 升级 pip 和 setuptools 版本
pip3 install -U pip pip3 install -U setuptools
- 运行 DeText 的设置:
pip install . -e
- 通过 pytest 验证环境设置。如果所有测试都通过,则环境设置正确
pytest
- 请参阅培训手册 ( TRAINING.md ) 以查找有关自定义模型的信息:
- 训练数据格式和准备
- 自定义和训练 DeText 模型的关键参数
- 有关完全自定义的所有 DeText 训练参数的详细信息
- 使用 DeText 训练模型(例如run_detext.sh)
教程
如果你想简单地尝试一下这个库,你可以参考下面的 notebooks 进行教程
-
text_classification_demo.ipynb
本笔记本展示了如何使用 DeText 在公共查询意图分类数据集上训练多类文本分类模型。包括数据准备、模型训练、模型推理的详细说明。
-
本笔记本展示了如何使用 DeText 在公共查询自动完成数据集上训练文本排名模型。包括数据准备、模型训练、模型推理示例的详细步骤。
引文
如果对您的研究有帮助,请在您的出版物中引用 DeText:
@manual{guo-liu20,
author = {Weiwei Guo and
Xiaowei Liu and
Sida Wang and
Huiji Gao and
Bo Long},
title = {DeText: A Deep NLP Framework for Intelligent Text Understanding},
url = {https://engineering.linkedin.com/blog/2020/open-sourcing-detext},
year = {2020}
}
@inproceedings{guo-gao19,
author = {Weiwei Guo and
Huiji Gao and
Jun Shi and
Bo Long},
title = {Deep Natural Language Processing for Search Systems},
booktitle = {ACM SIGIR 2019},
year = {2019}
}
@inproceedings{guo-gao19,
author = {Weiwei Guo and
Huiji Gao and
Jun Shi and
Bo Long and
Liang Zhang and
Bee-Chung Chen and
Deepak Agarwal},
title = {Deep Natural Language Processing for Search and Recommender Systems},
booktitle = {ACM SIGKDD 2019},
year = {2019}
}
@inproceedings{guo-liu20,
author = {Weiwei Guo and
Xiaowei Liu and
Sida Wang and
Huiji Gao and
Ananth Sankar and
Zimeng Yang and
Qi Guo and
Liang Zhang and
Bo Long and
Bee-Chung Chen and
Deepak Agarwal},
title = {DeText: A Deep Text Ranking Framework with BERT},
booktitle = {ACM CIKM 2020},
year = {2020}
}
@inproceedings{jia-long20,
author = {Jun Jia and
Bo Long and
Huiji Gao and
Weiwei Guo and
Jun Shi and
Xiaowei Liu and
Mingzhou Zhou and
Zhoutong Fu and
Sida Wang and
Sandeep Kumar Jha},
title = {Deep Learning for Search and Recommender Systems in Practice},
booktitle = {ACM SIGKDD 2020},
year = {2020}
}
@inproceedings{wang-guo20,
author = {Sida Wang and
Weiwei Guo and
Huiji Gao and
Bo Long},
title = {Efficient Neural Query Auto Completion},
booktitle = {ACM CIKM 2020},
year = {2020}
}
@inproceedings{liu-guo20,
author = {Xiaowei Liu and
Weiwei Guo and
Huiji Gao and
Bo Long},
title = {Deep Search Query Intent Understanding},
booktitle = {arXiv:2008.06759},
year = {2020}
}