Exploring Sequence-to-Sequence Architectures: From Machine Translation to Decoders
1. Machine Translation Basics
In the realm of machine translation, we often start by creating a translator object. We first format the source and target characters. For instance, we select a mini - batch of 32 samples, convert lists of character strings to lists of tensors, and pad them to get tensors.
src_batch = pad_sequence(seqs2tensors(
train_src_seqs[:32], token2idx),
batch_first=True, padding_value=0)
tgt_batch = pad_sequence(seqs2tensors(
train_tgt_seqs[:32], token2idx),
batch_first=True, padding_value=0)
We then create padding masks to remove padding symbols from the attention:
超级会员免费看
订阅专栏 解锁全文
1091

被折叠的 条评论
为什么被折叠?



