1 - Sequence to Sequence Learning with Neural Networks
In this series we'll be building a machine learning model to go from once sequence to another, using PyTorch and TorchText. This will be done on German to English translations, but the models can be applied to any problem that involves going from one sequence to another, such as summarization, i.e. going from a sequence to a shorter sequence in the same language.
在这一系列,我们将使用Pytorch和TorchText来构建序列机器学习模型。这将完成德语和英语的翻译,模型可以应用于涉及从一个序列到另一个序列的任何问题,例如摘要,即从同一语言的序列到较短的序列。
In this first notebook, we'll start simple to understand the general concepts by implementing the model from the Sequence to Sequence Learning with Neural Networks paper.
Introduction
The most common sequence-to-sequence (seq2seq) models are encoder-decoder models, which commonly use a recurrent neural network (RNN) to encode the source (input) sentence into a single vector. In this notebook, we'll refer to this single vector as a context vector. We can think of the context vector as being an abstract representation of the entire input sentence. This vector is then decoded by a second RNN which learns to output the target (output) sentence by generating it one word at a time.
最常见的序列对序列的模型即编码解码模型,通常使用递归神经网络(RNN)将源(输入)语句编码为单个向量。我们将这个向量称为上下文向量。我们可以将上下文向量视为整个输入句子的抽象表示。 然后,该向量由第二个RNN解码,该第二个RNN通过一次生成一个单词来学习输出目标(输出)语句。