5.8 KiB
5.8 KiB
Note
本文档由 WeHub 基于上游 README 翻译整理,属于社区翻译,非官方中文文档。
English · 原始项目 · 上游 README
原作者、版权与许可证归属以原始项目及本仓库 LICENSE 文件为准。
nlp-tutorial
nlp-tutorial 是一份面向学习 NLP(自然语言处理,Natural Language Processing)者的教程,使用 Pytorch 实现。NLP 中的大多数模型均用不到 100 行代码实现。(注释和空行除外)
- [08-14-2020] 旧版 TensorFlow v1 代码已归档至 archive 文件夹。为便于初学者阅读,仅支持 PyTorch 1.0 及以上版本。
课程大纲 -(示例用途)
1. 基础嵌入模型(Embedding Model)
- 1-1. NNLM(神经网络语言模型,Neural Network Language Model) - 预测下一个词(Predict Next Word)
- 论文 - A Neural Probabilistic Language Model(2003)
- Colab - NNLM.ipynb
- 1-2. Word2Vec(Skip-gram) - 词嵌入与图形展示(Embedding Words and Show Graph)
- 1-3. FastText(应用层,Application Level) - 句子分类(Sentence Classification)
2. CNN(卷积神经网络,Convolutional Neural Network)
- 2-1. TextCNN - 二分类情感分析(Binary Sentiment Classification)
3. RNN(循环神经网络,Recurrent Neural Network)
- 3-1. TextRNN - 预测下一步(Predict Next Step)
- 论文 - Finding Structure in Time(1990)
- Colab - TextRNN.ipynb
- 3-2. TextLSTM - 自动补全(Autocomplete)
- 论文 - LONG SHORT-TERM MEMORY(1997)
- Colab - TextLSTM.ipynb
- 3-3. Bi-LSTM - 在长句中预测下一个词(Predict Next Word in Long Sentence)
- Colab - Bi_LSTM.ipynb
4. 注意力机制(Attention Mechanism)
- 4-1. Seq2Seq - 词语替换(Change Word)
- 4-2. Seq2Seq with Attention - 机器翻译(Translate)
- 4-3. Bi-LSTM with Attention - 二分类情感分析(Binary Sentiment Classification)
- Colab - Bi_LSTM(Attention).ipynb
5. 基于 Transformer 的模型
- 5-1. The Transformer - 机器翻译(Translate)
- 5-2. BERT - 下一句分类与掩码词预测(Classification Next Sentence & Predict Masked Tokens)
依赖项
- Python 3.5+
- Pytorch 1.0.0+
作者
- Tae Hwan Jung(Jeff Jung) @graykode
- 作者邮箱:nlkey2022@gmail.com
- 感谢 mojitok 担任 NLP 研究实习生。