Skip to content

Latest commit

 

History

History
181 lines (88 loc) · 5.27 KB

route.md

File metadata and controls

181 lines (88 loc) · 5.27 KB

NLP学习路线

⌚️: 2021-07-21

📚参考


NLP学习路线是参考王树森视频整理的,以NLP(Natural Language Processing)为例,介绍了从RNN->LSTM->Attention->Self-Attention->Transformer->BERT、GPT、...等内容,然后再简单介绍ViT(Vision Transformer).

1. 数据处理

参考NLP项目流程中的课时1和课时2.

  1. Tokenization(分词)
  2. Build Dictionary(建立字典)
  3. One-hot encoding(热编码)
  4. Word Embedding(嵌入式编码)

2. RNN

image-20211213173439148

有很多text, speech, time series的数据,无法使用FC, CNN(当时)来处理,所以人们设计出RNN来处理时间序列数据。

但是RNN不能记忆长时间内容。

3. LSTM

image-20211213173903960

RNN不能记忆长时间内容,所以有了LSTM模型,但是LSTM只是长短记忆模型,,太长的序列时间也是不可以的。

3. Effective RNNs

为了提高RNN的性能,人们提出了很改进方法。

3.1 Stacked RNN

image-20211214105046938

3.2 Bidirectional RNN

image-20211214105203786

Yt会遗忘X1的内容,所以有了双向RNN,Y1会遗忘Xt内容,两者互补,效果会好很多。

4. Text Generation

image-20211214105624723

5. Seq2Seq

image-20211214112416202

image-20211214112630455

image-20211214112654642

image-20211214112712843

image-20211214112735321

image-20211214112912296

image-20211214112939028

如何提高Seq2Seq的性能

  • Bi-LSTM instead of LSTM (Encoder only!)
  • Word-Level Tokenization
  • Multi-Task Learning
  • Attention! (Next lecture.)

Seq2Seq的缺点:

  • 最后的状态不能记忆长时间内容

6. Attention

我认为Attention机制实际上是一种相当普适的方法,它能够直接嵌入原网络中加强对中心特征的选择。

image-20211213174245983

image-20211214113457104

6.1 Seq2Seq Model with Attention

  • • Attention tremendously improves Seq2Seq model.
  • • With attention, Seq2Seq model does not forget source input.
  • • With attention, the decoder knows where to focus.
  • • Downside: much more computation.

image-20211214113804856

image-20211214113822716

image-20211214113850546

image-20211214113928504

image-20211214130222258

image-20211214130427355

image-20211214131452343

image-20211214131513858

image-20211214131602901

image-20211214131809080

6.2 Self-Attention

image-20211214132340282

image-20211214134912401

image-20211214134938208

其中,h0是全0向量。

image-20211214135414378

image-20211214135435882

image-20211214135502278

image-20211214135522007

7. Transformer

image-20210721201512490

8. BERT

Bidirectional Encoder Representations from Transformers.用来预训练Transformer中的Encoder模型。

image-20210721203146931

9. GPT

image-20210721203426655

ELMO, Bert, GPT李宏毅视频

10. ViT

王树森ViT视频