0
点赞
收藏
分享

微信扫一扫

推荐:常见NLP模型的代码实现(基于TensorFlow和PyTorch)


推荐github上的一个NLP代码教程:nlp-tutorial,教程中包含常见的NLP模型代码实现(基于TensorFlow和Pytorch),而且教程中的大多数NLP模型都使用少于100行代码。

教程说明

这是使用TensorFlow和Pytorch学习NLP(自然语言处理)的教程,把常用NLP模型用不到100行的代码实现了,教程里附论文下载,并且包含py和ipynb文件,经过测试全部通过。

仓库地址:

​​https://github.com/graykode/nlp-tutorial​​

里面有使用说明和样例(py和ipynb格式)。

注意:论文下载请“阅读原文”。

教程目录

1. Basic Embedding Model(基础嵌入模型)

1-1. NNLM(Neural Network Language Model)- Predict Next Word

  • 论文下载

A Neural Probabilistic LanguageModel(2003)

  • 代码实现

 NNLM_Tensor.ipynb, NNLM_Torch.ipynb

1-2. Word2Vec(Skip-gram) - EmbeddingWords and Show Graph

  •  论文下载

Distributed Representations of Wordsand Phrases and their Compositionality(2013)

  • 代码实现

Word2Vec_Tensor(NCE_loss).ipynb,Word2Vec_Tensor(Softmax).ipynb,Word2Vec_Torch(Softmax).ipynb

1-3. FastText(Application Level)- Sentence Classification

  • 论文下载

Bag of Tricks for Efficient Text Classification(2016)

  •  代码实现

FastText.ipynb

2. CNN(卷积神经网络)

2-1. TextCNN - BinarySentiment Classification

  • 论文下载

Convolutional Neural Networks for SentenceClassification(2014)

  • 代码实现

TextCNN_Tensor.ipynb, TextCNN_Torch.ipynb

2-2. DCNN(Dynamic Convolutional Neural Network)

3. RNN(循环神经网络)

3-1. TextRNN - Predict NextStep

  • 论文下载

Finding Structure in Time(1990)

  • 代码实现

TextRNN_Tensor.ipynb, TextRNN_Torch.ipynb

3-2. TextLSTM - Autocomplete

  • 论文下载

LONG SHORT-TERM MEMORY(1997)

  • 代码实现

TextLSTM_Tensor.ipynb, TextLSTM_Torch.ipynb

3-3. Bi-LSTM - Predict NextWord in Long Sentence

  • 代码实现

Bi_LSTM_Tensor.ipynb, Bi_LSTM_Torch.ipynb

4. Attention Mechanism(注意力机制)

4-1. Seq2Seq - Change Word

  •  论文下载

Learning Phrase Representations using RNN Encoder–Decoder for Statistical MachineTranslation(2014)

  • 代码实现

Seq2Seq_Tensor.ipynb, Seq2Seq_Torch.ipynb

4-2. Seq2Seq with Attention - Translate

  • 论文下载

NeuralMachine Translation by Jointly Learning to Align and Translate(2014)

  • 代码实现

Seq2Seq(Attention)_Tensor.ipynb,Seq2Seq(Attention)_Torch.ipynb

4-3. Bi-LSTM with Attention - BinarySentiment Classification

  • 代码实现

Bi_LSTM(Attention)_Tensor.ipynb,Bi_LSTM(Attention)_Torch.ipynb

5. Model based on Transformer(Transformer模型)

5-1. The Transformer - Translate

  • 论文下载

Attention Is All You Need(2017)

  • 代码实现

Transformer_Torch.ipynb, Transformer(Greedy_decoder)_Torch.ipynb

5-2. BERT - ClassificationNext Sentence & Predict Masked Tokens

  • 论文下载

BERT: Pre-training of Deep Bidirectional Transformers for LanguageUnderstanding(2018)

  • 代码实现
    BERT_Torch.ipynb

部分内容截图

推荐:常见NLP模型的代码实现(基于TensorFlow和PyTorch)_github

推荐:常见NLP模型的代码实现(基于TensorFlow和PyTorch)_机器学习_02

推荐:常见NLP模型的代码实现(基于TensorFlow和PyTorch)_机器学习_03

推荐:常见NLP模型的代码实现(基于TensorFlow和PyTorch)_github_04

TextCNN的两种实现方式(使用TensorFlow和Pytorch)

总结

推荐github上的一个NLP代码教程:nlp-tutorial,一个使用TensorFlow和Pytorch学习NLP(自然语言处理)的教程,教程中的大多数NLP模型都使用少于100行代码实现。

仓库地址:

​​https://github.com/graykode/nlp-tutorial​​

里面有使用说明和样例(py和ipynb格式)。

仓库作者:Tae Hwan Jung(Jeff Jung)

注意:论文下载请“阅读原文”。

本站简介↓↓↓ 

“机器学习初学者”是帮助人工智能爱好者入门的个人公众号(创始人:黄海广)

初学者入门的道路上,最需要的是“雪中送炭”,而不是“锦上添花”。


举报

相关推荐

0 条评论