Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v2.0.0-alpha1 release #803

Merged
merged 107 commits into from
May 8, 2021
Merged
Changes from 1 commit
Commits
Show all changes
107 commits
Select commit Hold shift + click to select a range
dcf2150
fix typo in ndarray.md
xyw5vplus1 Mar 10, 2021
48f46d1
rebase (#692)
goldmermaid Mar 19, 2021
e71b41f
Update softmax-regression-concise.md
astonzhang Mar 19, 2021
261fc60
rebase (#690)
goldmermaid Mar 19, 2021
8736e46
Update mlp.md
astonzhang Mar 19, 2021
ca58c67
Update Jenkinsfile
mli Mar 19, 2021
7deda48
Update README.md
astonzhang Mar 23, 2021
2bcc398
fix typo. (#702)
Sliverwing Mar 24, 2021
ffb7f99
minor (#703)
goldmermaid Mar 24, 2021
dd8924e
typo (#705)
goldmermaid Mar 24, 2021
4ae3eea
fix typo and change one sentence in ndarray.md (#707)
thebesttv Mar 26, 2021
bc9d49d
Update index.md (#704)
zppet Mar 26, 2021
05852d2
fix 4.4.1.2. Model Complexity translation issues (#706)
WilliamWuLH Mar 26, 2021
d275241
nvcc程序ubuntu安装命令 (#701)
dxzhan Mar 26, 2021
666328a
Update index.md
astonzhang Mar 27, 2021
c4e6685
update translations in probability.md (#710)
thebesttv Mar 29, 2021
4e82fc6
fix typo and translation issues in kaggle-house-price.md (#709)
WilliamWuLH Mar 29, 2021
b7c810e
revise (#708)
goldmermaid Mar 29, 2021
a048729
Update index.md (#711)
ShixiangWang Mar 29, 2021
0f3eaed
unrendered slides rebase (#712)
goldmermaid Mar 29, 2021
257c9ac
Update optimization-intro.md
astonzhang Mar 29, 2021
f69c972
Retrigger slides (#713)
goldmermaid Mar 31, 2021
3a90849
update translations in softmax-regression.md
thebesttv Apr 1, 2021
e8e8cac
Merge pull request #691 from xyw5vplus1/master
xiaotinghe Apr 1, 2021
ac34a81
Merge pull request #716 from thebesttv/master
xiaotinghe Apr 1, 2021
19881b5
Correct some translation errors. (#717)
zhuyuanxiang Apr 4, 2021
248d5e3
Correct incorrect reference information in chapter_introduction/index.md
Apr 6, 2021
e6c0e45
typo
goldmermaid Apr 7, 2021
1858c22
Merge pull request #719 from liu-mengyang/master
xiaotinghe Apr 7, 2021
573202e
Merge pull request #722 from goldmermaid/typos
xiaotinghe Apr 7, 2021
8964b7a
Fix: typo (#733)
aekst Apr 10, 2021
9fa8743
add my name in preface/index.md (#721)
zhuyuanxiang Apr 11, 2021
4e8fbf8
update translations in mlp.md (#734)
thebesttv Apr 11, 2021
a9a0597
clarify ex3.2 (#720)
tian3rd Apr 12, 2021
fad4586
fix typo and translation issues in transformer.md (#732)
zhuyuanxiang Apr 12, 2021
893f503
add my name in preface/index.md and update mlp.md (#735)
thebesttv Apr 12, 2021
860f056
fix typo and translation issues in alexnet.md (#736)
WilliamWuLH Apr 12, 2021
250f3cd
fix typo in calculus.md (#740)
liu-mengyang Apr 13, 2021
9fe4290
Translation issue in chp #5 computation GPU (#738)
zppet Apr 13, 2021
dafe60d
[slides] kaggle (#742)
goldmermaid Apr 15, 2021
4bd2c89
add ch12 first 3 sections
astonzhang Apr 15, 2021
2a3161c
[slides] dl computation (#749)
mli Apr 16, 2021
21caeb2
translations issue in chapter_preliminaries/probability (#751)
npudqsz Apr 18, 2021
b6278c9
fix grammar problem in index.md (#750)
luzixiao Apr 18, 2021
e942baf
Update index.md (#747)
nickeaglenny Apr 18, 2021
c848c64
fix typo in vgg.md (#745)
WilliamWuLH Apr 18, 2021
24a5695
[slides] fix linear reg slides bug
Apr 19, 2021
3be2ac0
+ch9 (#755)
xiaotinghe Apr 19, 2021
19550e7
translation issue in chapter_linear-networks/linear_regression_scratc…
npudqsz Apr 19, 2021
00d9a06
[slides] kaggle-house-price (#743)
goldmermaid Apr 19, 2021
fd98cb8
chapter_recurrent-modern/gru (#724)
xiaotinghe Apr 20, 2021
b2d5799
chapter_recurrent-modern/lstm (#725)
xiaotinghe Apr 20, 2021
915c22d
chapter_recurrent-modern/bi-rnn (#726)
xiaotinghe Apr 20, 2021
52f2877
chapter_recurrent-modern/deep-rnn (#731)
xiaotinghe Apr 20, 2021
7431b20
d2l (#757)
xiaotinghe Apr 20, 2021
ba34cd7
fix translation in chapter_linear-networks/image-classification (#756)
npudqsz Apr 20, 2021
c2ad179
fix typo in resnet.md (#758)
WilliamWuLH Apr 20, 2021
3ca9c2a
chapter_recurrent-modern/beam-search (#730)
xiaotinghe Apr 20, 2021
110133f
translation issue in chapter_linear-networks/linear-regression (#752)
npudqsz Apr 20, 2021
b4522da
chapter_recurrent-modern/seq2seq (#729)
xiaotinghe Apr 20, 2021
1955446
chapter_recurrent-modern/machine-translation-and-dataset (#727)
xiaotinghe Apr 20, 2021
7de7cef
chapter_recurrent-modern/encoder-decoder (#728)
xiaotinghe Apr 20, 2021
6c4029e
[slides] CNN (#753)
goldmermaid Apr 21, 2021
1650462
translation issue in autograd.md (#761)
npudqsz Apr 21, 2021
f25cb68
translation issue in chapter_linear-networks/softmax-regression-scrat…
npudqsz Apr 21, 2021
a6d31a2
add ch12
astonzhang Apr 23, 2021
66dd24a
translation issue in mlp.md (#762)
npudqsz Apr 23, 2021
a5479de
Update lookup-api.md (#763)
LenovoLRSH Apr 23, 2021
74d5091
update translations in underfit-overfit.md (#746)
thebesttv Apr 26, 2021
f92e3e5
fix typo in sequence.md (#766)
WilliamWuLH Apr 26, 2021
3ab4585
Update index.md (#768)
PEGASUS1993 Apr 26, 2021
27db816
fix errors in 11. Optimization Algorithms (#776)
zhuyuanxiang Apr 27, 2021
f24541f
fix errors in 9. Modern Recurrent Neural Networks (#775)
zhuyuanxiang Apr 27, 2021
474b5d0
Update index.md
astonzhang Apr 27, 2021
cfc13b9
english name of terms in underfit_overfit (#777)
npudqsz Apr 28, 2021
e618763
revise ch12 imgs
astonzhang Apr 29, 2021
4451279
Chapter optimization/optimization intro (#780)
zhuyuanxiang Apr 30, 2021
9b5f533
Chapter recurrent neural networks/text preprocessing (#782)
zhuyuanxiang May 1, 2021
9d0caa6
add terminology for 8. Recurrent Neural Networks (#784)
zhuyuanxiang May 3, 2021
0d61c07
add ch13.1 ch13.2
astonzhang May 3, 2021
e558594
add ch13.13 13.14
astonzhang May 5, 2021
225e6bd
Update index.md (#786)
LenovoLRSH May 5, 2021
d511b06
润色翻译 (#785)
LenovoLRSH May 5, 2021
4ff3143
Chapter recurrent neural networks/language models and dataset (#783)
zhuyuanxiang May 5, 2021
0f77f19
Chapter_recurrent-modern/seq2seq.md (#764)
zhuyuanxiang May 5, 2021
21265ee
fix errors in recurrent-modern/encoder-decoder.md (#765)
zhuyuanxiang May 5, 2021
7698c20
Chapter recurrent modern/machine translation and dataset (#767)
zhuyuanxiang May 5, 2021
6e1fbc4
Chapter recurrent modern/beam search (#769)
zhuyuanxiang May 5, 2021
d3c04cd
Chapter recurrent neural networks/sequence (#781)
zhuyuanxiang May 5, 2021
ef4688f
chapter_recurrent-modern/index (#787)
xiaotinghe May 6, 2021
0b52a1e
chapter_computational-performance/index (#792)
xiaotinghe May 7, 2021
6fa3b69
chapter_computational-performance/hybridize (#793)
xiaotinghe May 7, 2021
5434ee1
chapter_computational-performance/async-computation (#794)
xiaotinghe May 7, 2021
d9cf60a
chapter_computational-performance/hardware (#796)
xiaotinghe May 7, 2021
160c68c
chapter_computational-performance/multiple-gpus-concise (#800)
xiaotinghe May 7, 2021
04349d4
chapter_computational-performance/parameterserver (#799)
xiaotinghe May 7, 2021
9758a91
chapter_computational-performance/multiple-gpus (#797)
xiaotinghe May 7, 2021
72eae5a
chapter_computational-performance/auto-parallelism (#795)
xiaotinghe May 7, 2021
0e45022
Update multiple-gpus.md
astonzhang May 7, 2021
d58f821
add ch12 (#801)
xiaotinghe May 7, 2021
cc786e5
fix ch12 ref (#802)
xiaotinghe May 7, 2021
af91607
fix translate (#791)
LenovoLRSH May 7, 2021
dee730d
Update frontpage.html
astonzhang May 7, 2021
dab13ab
Update frontpage.html
astonzhang May 7, 2021
bf1ea23
Update build.yml
astonzhang May 7, 2021
e3d093b
bump to 2.0.0-alpha1
astonzhang May 8, 2021
52ff6ee
forum link (#805)
xiaotinghe May 8, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
chapter_recurrent-modern/encoder-decoder (#728)
* chapter_recurrent-modern/encoder-decoder

* Update encoder-decoder.md

Co-authored-by: goldmermaid <goldpiggy@berkeley.edu>
  • Loading branch information
xiaotinghe and goldmermaid authored Apr 20, 2021
commit 7de7cef4193ec797fa7d3623e4f2662df0729826
40 changes: 20 additions & 20 deletions chapter_recurrent-modern/encoder-decoder.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
# 编码器解码器架构
# 编码器-解码器结构
:label:`sec_encoder-decoder`

正如我们在 :numref:`sec_machine_translation` 中所讨论的那样,机器翻译是序列转导模型的主要问题领域,其输入和输出都是可变长度序列。为了处理这种类型的输入和输出,我们可以设计一个包含两个主要组件的架构。第一个组件是 **编码器**(encoder):它采用可变长度序列作为输入,然后将其转换为具有固定形状的状态。第二个组件是 **解码器**(decoder):它将固定形状的编码状态映射到可变长度序列。这被称为 **编码器-解码器**(encoder-decoder) 体系结构,在 :numref:`fig_encoder_decoder` 中进行了描述
正如我们在:numref:`sec_machine_translation`中所讨论的,机器翻译是序列转换模型的一个核心问题,其输入和输出都是可变长度序列。为了处理这种类型的输入和输出,我们可以设计一个包含两个主要组件的结构。第一个组件是一个*编码器*(encoder):它接受一个可变长度的序列作为输入,并将其转换为具有固定形状的编码状态。第二个组件是*解码器*(decoder):它将固定形状的编码状态映射到可变长度序列。这被称为*编码器-解码器*(encoder-decoder)结构。如:numref:`fig_encoder_decoder`所示

![The encoder-decoder architecture.](../img/encoder-decoder.svg)
![编码器-解码器结构](../img/encoder-decoder.svg)
:label:`fig_encoder_decoder`

让我们以英语到法语的机器翻译为例。给定英语输入序列:“They”“are”“watching”“.” 这种编码器解码器架构首先将可变长度输入编码为一个状态,然后解码状态,然后通过令牌生成翻译的序列标记作为输出:“Ils”、“regardent”、“.”。由于编码器解码器体系结构构成了后续章节中不同序列转导模型的基础,因此本节将此架构转换为稍后实现的接口
让我们以英语到法语的机器翻译为例。给定一个英文的输入序列:“They”“are”“watching”“.”,这种编码器-解码器结构首先将可变长度的输入编码成一个状态,然后对该状态进行解码,一个标记一个标记地生成翻译后的序列令牌作为输出:“Ils”、“regordent”、“.”。由于编码器-解码器结构构成了后续章节中不同序列转换模型的基础,因此本节将把该结构转换为稍后将实现的接口

## 编码器

在编码器界面中,我们只需指定编码器采用可变长度序列作为输入 `X`。该实现将由继承此基础 `Encoder` 类的任何模型提供
在编码器接口中,我们只指定编码器采用可变长度序列作为输入`X`。实现将由任何继承这个`Encoder`基类的模型提供

```{.python .input}
from mxnet.gluon import nn

#@save
class Encoder(nn.Block):
"""The base encoder interface for the encoder-decoder architecture."""
"""编码器-解码器结构的基本编码器接口。"""
def __init__(self, **kwargs):
super(Encoder, self).__init__(**kwargs)

Expand All @@ -31,7 +31,7 @@ from torch import nn

#@save
class Encoder(nn.Module):
"""The base encoder interface for the encoder-decoder architecture."""
"""编码器-解码器结构的基本编码器接口。"""
def __init__(self, **kwargs):
super(Encoder, self).__init__(**kwargs)

Expand All @@ -41,12 +41,12 @@ class Encoder(nn.Module):

## 解码器

在下面的解码器界面中,我们添加了一个额外的 `init_state` 函数,将编码器输出 (`enc_outputs`) 转换为编码状态。请注意,此步骤可能需要额外的输入,例如输入的有效长度,:numref:`subsec_mt_data_loading` 中对此进行了解释。要通过令牌生成可变长度序列令牌,每次解码器都可能在当前时间步将输入(例如,上一个时间步生成的令牌)和编码状态映射到输出令牌时
在下面的解码器接口中,我们添加了一个额外的`init_state`函数来将编码器输出(`enc_outputs`转换为编码状态。请注意,此步骤可能需要额外的输入,例如输入的有效长度,这在:numref:`subsec_mt_data_loading`中进行了解释。为了逐个标记生成可变长度标记序列,每次解码器可将输入(例如,在前一时间步生成的标记)和编码状态映射到当前时间步的输出标记

```{.python .input}
#@save
class Decoder(nn.Block):
"""The base decoder interface for the encoder-decoder architecture."""
"""编码器-解码器结构的基本解码器接口。"""
def __init__(self, **kwargs):
super(Decoder, self).__init__(**kwargs)

Expand All @@ -61,7 +61,7 @@ class Decoder(nn.Block):
#@tab pytorch
#@save
class Decoder(nn.Module):
"""The base decoder interface for the encoder-decoder architecture."""
"""编码器-解码器结构的基本解码器接口。"""
def __init__(self, **kwargs):
super(Decoder, self).__init__(**kwargs)

Expand All @@ -72,14 +72,14 @@ class Decoder(nn.Module):
raise NotImplementedError
```

## 将编码器和解码器放在一起
## 把编码器和解码器合并

最后,编码器解码器架构包含编码器和解码器,并可选择附加参数。在向前传播中,编码器的输出用于产生编码状态,解码器将进一步使用此状态作为其输入之一
最后,编码器-解码器结构包含编码器和解码器,并包含可选的额外的参数。在前向传播中,编码器的输出产生“编码状态”,解码器将使用该状态作为其输入之一

```{.python .input}
#@save
class EncoderDecoder(nn.Block):
"""The base class for the encoder-decoder architecture."""
"""编码器-解码器结构的基类。"""
def __init__(self, encoder, decoder, **kwargs):
super(EncoderDecoder, self).__init__(**kwargs)
self.encoder = encoder
Expand All @@ -95,7 +95,7 @@ class EncoderDecoder(nn.Block):
#@tab pytorch
#@save
class EncoderDecoder(nn.Module):
"""The base class for the encoder-decoder architecture."""
"""编码器-解码器结构的基类。"""
def __init__(self, encoder, decoder, **kwargs):
super(EncoderDecoder, self).__init__(**kwargs)
self.encoder = encoder
Expand All @@ -107,18 +107,18 @@ class EncoderDecoder(nn.Module):
return self.decoder(dec_X, dec_state)
```

编码器解码器架构中的 “状态” 一词可能激发了你使用带状态的神经网络来实现这种架构。在下一节中,我们将了解如何应用 RNN 来设计基于此编码器解码器架构的序列转导模型
编码器-解码器体系结构中的术语“状态”可能启发你使用具有状态的神经网络来实现该结构。在下一节中,我们将看到如何应用循环神经网络来设计基于这种编码器-解码器结构的序列转换模型

## 摘要
## 小结

* 编码器解码器架构可以处理同时属于可变长度序列的输入和输出,因此适用于机器翻译等序列转导问题
* 编码器采用可变长度序列作为输入,并将其转换为具有固定形状的状态
* 编码器-解码器结构可以处理可变长度序列的输入和输出,因此适用于机器翻译等序列转换问题
* 编码器以可变长度序列作为输入,将其转换为具有固定形状的状态
* 解码器将固定形状的编码状态映射到可变长度序列。

## 练习

1. 假设我们使用神经网络来实现编码器解码器架构。编码器和解码器必须是同一类型的神经网络吗?
1. 除了机器翻译之外,你能想到另一个可以应用编码器-解码器架构的应用程序吗
1. 假设我们使用神经网络来实现编解码结构。编码器和解码器必须是同一类型的神经网络吗?
1. 除了机器翻译,你能想到另一个可以应用编码器-解码器结构的应用吗

:begin_tab:`mxnet`
[Discussions](https://discuss.d2l.ai/t/341)
Expand Down