Neural Speech Synthesis with Transformer Network | AGIDaily
AGI Daily
资讯日报词条论文人物新创
返回论文列表

暂无章节

返回论文列表
目录

Neural Speech Synthesis with Transformer Network

收录于 AAAI 2019 会议论文被引 1,103 次
打开论文来源

Neural Speech Synthesis with Transformer Network

Naihan Li,∗1,4^{*1,4}∗1,4 Shujie Liu,2^22 Yanqing Liu,3^33 Sheng Zhao,3^33 Ming Liu1,4^{1,4}1,4

1^11University of Electronic Science and Technology of China
2^22Microsoft Research Asia
3^33Microsoft STC Asia
4^44CETC Big Data Research Institute Co.,Ltd, Guizhou, China

lnhzsbls1994@163.com
shujliu, yanqliu, szhao@microsoft.com
csmliu@uestc.edu.cn

∗^*∗Work done during internship at Microsoft STC Asia.

Abstract

摘要

Although end-to-end neural text-to-speech (TTS) methods (such as Tacotron2) are proposed and achieve state-of-the-art performance, they still suffer from two problems: 1) low efficiency during training and inference; 2) hard to model long dependency using current recurrent neural networks (RNNs). Inspired by the success of Transformer network in neural machine translation (NMT), in this paper, we introduce and adapt the multi-head attention mechanism to replace the RNN structures and also the original attention mechanism in Tacotron2. With the help of multi-head self-attention, the hidden states in the encoder and decoder are constructed in parallel, which improves training efficiency. Meanwhile, any two inputs at different times are connected directly by a self-attention mechanism, which solves the long range dependency problem effectively. Using phoneme sequences as input, our Transformer TTS network generates mel spectrograms, followed by a WaveNet vocoder to output the final audio results. Experiments are conducted to test the efficiency and performance of our new network. For the efficiency, our Transformer TTS network can speed up the training about 4.25 times faster compared with Tacotron2. For the performance, rigorous human tests show that our proposed model achieves state-of-the-art performance (outperforms Tacotron2 with a gap of 0.048) and is very close to human quality (4.39 vs 4.44 in MOS).

尽管端到端神经文本转语音(TTS)方法(例如 Tacotron2)已被提出,并达到当时最好的水平,它们仍有两个问题:1)训练和推理效率偏低;2)用当时的循环神经网络(RNN)难以建模长程依赖。受 Transformer 网络在神经机器翻译(NMT)中成功的启发,本文引入并改写多头注意力机制,用来替换 Tacotron2 中的 RNN 结构以及原来的注意力机制。借助多头自注意力,编码器和解码器中的隐状态可以并行构造,从而提高训练效率。同时,不同时刻的任意两个输入都由自注意力直接相连,从而有效解决长程依赖问题。我们的 Transformer TTS 网络以音素序列为输入,生成梅尔频谱,再经 WaveNet 声码器输出最终音频。实验用于检验新网络的效率与表现。效率方面,与 Tacotron2 相比,Transformer TTS 可将训练加速约 4.25 倍。表现方面,严格的人工测听表明,所提模型达到当时最好水平(以 0.048 的差距超过 Tacotron2),并非常接近真人音质(MOS 为 4.39 对 4.44)。

1 Introduction

1 引言

Text to speech (TTS) is a very important task for user interaction, aiming to synthesize intelligible and natural audios which are indistinguishable from human recordings. Traditional TTS systems have two components: front-end and back-end. Front-end is responsible for text analysis and linguistic feature extraction, such as word segmentation, part of speech tagging, multi-word disambiguation and prosodic structure prediction; back-end is built for speech synthesis based on linguistic features from front-end, such as speech acoustic parameter modeling, prosody modeling and speech generation. In the past decades, concatenative and parametric speech synthesis systems were mainstream techniques. However, both of them have complex pipelines, and defining good linguistic features is often time-consuming and language specific, which requires a lot of resource and manpower. Besides, synthesized audios often have glitches or instability in prosody and pronunciation compared to human speech, and thus sound unnatural.

文本转语音(TTS)是用户交互中非常重要的一项任务,目标是合成清晰、自然、与真人录音难以区分的音频。传统 TTS 系统有前端和后端两个部分。前端负责文本分析和语言学特征提取,例如分词、词性标注、多词歧义消解和韵律结构预测;后端则基于前端给出的语言学特征做语音合成,例如声学参数建模、韵律建模和语音生成。过去几十年里,拼接式和参数式语音合成是主流技术。不过两者都有复杂的流水线,而且定义好的语言学特征往往既费时又依赖具体语言,需要大量资源和人力。此外,合成音频在韵律和发音上常常出现毛刺或不稳定,听起来不如真人自然。

Recently, with the rapid development of neural networks, end-to-end generative text-to-speech models, such as Tacotron (Wang et al. 2017) and Tacotron2 (Shen et al. 2017), are proposed to simplify traditional speech synthesis pipeline by replacing the production of these linguistic and acoustic features with a single neural network. Tacotron and Tacotron2 first generate mel spectrograms directly from texts, then synthesize the audio results by a vocoder such as Griffin Lim algorithm (Griffin and Lim 1984) or WaveNet (Van Den Oord et al. 2016). With the end-to-end neural network, quality of synthesized audios is greatly improved and even comparable with human recordings on some datasets. The end-to-end neural TTS models contain two components, an encoder and a decoder. Given the input sequence (of words or phonemes), the encoder tries to map them into a semantic space and generates a sequence of encoder hidden states, and the decoder, taking these hidden states as context information with an attention mechanism, constructs the decoder hidden states then outputs the mel frames. For both encoder and decoder, recurrent neural networks (RNNs) are usually leveraged, such as LSTM (Hochreiter and Schmidhuber 1997) and GRU (Cho et al. 2014).

近年来,随着神经网络迅速发展,Tacotron(Wang et al. 2017)和 Tacotron2(Shen et al. 2017)这类端到端生成式文本转语音模型被提出,用单个神经网络取代语言学与声学特征的逐步生成,从而简化传统语音合成流水线。Tacotron 和 Tacotron2 先从文本直接生成梅尔频谱,再用 Griffin Lim 算法(Griffin and Lim 1984)或 WaveNet(Van Den Oord et al. 2016)等声码器合成音频。借助端到端神经网络,合成音质大幅提高,在某些数据集上甚至可与真人录音相比。端到端神经 TTS 模型包含编码器和解码器两部分。给定输入序列(单词或音素),编码器试图把它们映射到语义空间并生成一串编码器隐状态;解码器则通过注意力机制把这些隐状态当作上下文,构造解码器隐状态,再输出梅尔帧。编码器和解码器通常都使用循环神经网络(RNN),例如 LSTM(Hochreiter and Schmidhuber 1997)和 GRU(Cho et al. 2014)。

However, RNNs can only consume the input and generate the output sequentially, since the previous hidden state and the current input are both required to build the current hidden state. The characteristic of sequential process limits the parallelization capability in both the training and inference process. For the same reason, for a certain frame, information from many steps ahead may has been biased after multiple recurrent processing. To deal with these two problems, Transformer (Vaswani et al. 2017) is proposed to replace the RNNs in NMT models.

然而,RNN 只能按顺序消费输入并生成输出,因为构造当前隐状态同时需要上一步隐状态和当前输入。这种逐步处理限制了训练和推理中的并行能力。出于同样原因,对某一帧来说,来自许多步之前的信息在多次递归处理后可能已经发生偏差。原文作 “may has been biased”。为应对这两个问题,Transformer(Vaswani et al. 2017)被提出,用来替换 NMT 模型中的 RNN。

Inspired by this idea, in this paper, we combine the advantages of Tacotron2 and Transformer to propose a novel end-to-end TTS model, in which the multi-head attention mechanism is introduced to replace the RNN structures in the encoder and decoder, as well as the vanilla attention network. The self-attention mechanism unties the sequential dependency on the last previous hidden state to improve the parallelization capability and relieve the long distance dependency problem. Compared with the vanilla attention between the encoder and decoder, the multi-head attention can build the context vector from different aspects using different attention heads. With the phoneme sequences as input, our novel Transformer TTS network generates mel spectrograms, and employs WaveNet as vocoder to synthesize audios. We conduct experiments with 25-hour professional speech dataset, and the audio quality is evaluated by human testers. Evaluation results show that our proposed model outperforms the original Tacotron2 with a gap of 0.048 in CMOS, and achieves a similar performance (4.39 in MOS) with human recording (4.44 in MOS). Besides, our Transformer TTS model can speed up the training process about 4.25 times compared with Tacotron2. Audio samples can be accessed on https://neuraltts.github.io/transformertts/

受这一思路启发,本文结合 Tacotron2 与 Transformer 的长处,提出一种新的端到端 TTS 模型:用多头注意力机制替换编码器和解码器中的 RNN 结构,以及原来的普通注意力网络。自注意力解除了对上一步隐状态的顺序依赖,从而提高并行能力,并缓解长距离依赖问题。与编码器、解码器之间的普通注意力相比,多头注意力可以用不同的注意力头从不同侧面构造上下文向量。我们的 Transformer TTS 网络以音素序列为输入,生成梅尔频谱,并用 WaveNet 作为声码器合成音频。实验在 25 小时专业语音数据上进行,音质由人工测听评估。结果显示,所提模型在 CMOS 上以 0.048 的差距超过原来的 Tacotron2,并取得与真人录音相近的表现(MOS 为 4.39,录音为 4.44)。此外,与 Tacotron2 相比,Transformer TTS 可将训练过程加速约 4.25 倍。音频样例见 https://neuraltts.github.io/transformertts/

2 Background

2 背景

In this section, we first introduce the sequence-to-sequence model, followed by a brief description about Tacotron2 and Transformer, which are two preliminaries in our work.

本节先介绍序列到序列模型,再简要说明 Tacotron2 和 Transformer,二者是本工作的两个前提。

2.1 Sequence to Sequence Model

2.1 序列到序列模型

A sequence-to-sequence model (Sutskever, Vinyals, and Le 2014; Bahdanau, Cho, and Bengio 2014) converts an input sequence (x1,x2,...,xT)(x_1, x_2, ..., x_T)(x1​,x2​,...,xT​) into an output sequence (y1,y2,...,yT′)(y_1, y_2, ..., y_{T'})(y1​,y2​,...,yT′​), and each predicted yty_tyt​ is conditioned on all previously predicted outputs y1,...,yt−1y_1, ..., y_{t-1}y1​,...,yt−1​. In most cases, these two sequences are of different lengths (T≠T′T \neq T'T=T′). In NMT, this conversion translates the input sentence in one language into the output sentence in another language, based on a conditional probability p(y1,...,yT′∣x1,...,xT)p(y_1, ..., y_{T'}|x_1, ..., x_T)p(y1​,...,yT′​∣x1​,...,xT​):

序列到序列模型(Sutskever, Vinyals, and Le 2014; Bahdanau, Cho, and Bengio 2014)把输入序列 (x1,x2,...,xT)(x_1, x_2, ..., x_T)(x1​,x2​,...,xT​) 转换成输出序列 (y1,y2,...,yT′)(y_1, y_2, ..., y_{T'})(y1​,y2​,...,yT′​),并且每个预测的 yty_tyt​ 都以先前全部预测输出 y1,...,yt−1y_1, ..., y_{t-1}y1​,...,yt−1​ 为条件。多数情况下这两个序列长度不同(T≠T′T \neq T'T=T′)。在 NMT 中,这一转换是把一种语言的输入句子译成另一种语言的输出句子,依据的是条件概率 p(y1,...,yT′∣x1,...,xT)p(y_1, ..., y_{T'}|x_1, ..., x_T)p(y1​,...,yT′​∣x1​,...,xT​):

ht=encoder(ht−1,xt)\eqno(1)h_t = \mathrm{encoder}(h_{t-1}, x_t) \eqno{(1)}ht​=encoder(ht−1​,xt​)\eqno(1)

st=decoder(st−1,yt−1,ct)\eqno(2)s_t = \mathrm{decoder}(s_{t-1}, y_{t-1}, c_t) \eqno{(2)}st​=decoder(st−1​,yt−1​,ct​)\eqno(2)

where ctc_tct​ is the context vector calculated by an attention mechanism:

其中 ctc_tct​ 是由注意力机制算出的上下文向量:

ct=attention(st−1,h)\eqno(3)c_t = \mathrm{attention}(s_{t-1}, h) \eqno{(3)}ct​=attention(st−1​,h)\eqno(3)

thus p(y1,...,yT′∣x1,...,xT)p(y_1, ..., y_{T'}|x_1, ..., x_T)p(y1​,...,yT′​∣x1​,...,xT​) can be computed by

于是 p(y1,...,yT′∣x1,...,xT)p(y_1, ..., y_{T'}|x_1, ..., x_T)p(y1​,...,yT′​∣x1​,...,xT​) 可由下式计算

p(y1,...,yT′∣x1,...,xT)=∏t=1T′p(yt∣y<t,x)\eqno(4)p(y_1, ..., y_{T'}|x_1, ..., x_T) = \prod_{t=1}^{T'} p(y_t|y_{<t}, x) \eqno{(4)}p(y1​,...,yT′​∣x1​,...,xT​)=t=1∏T′​p(yt​∣y<t​,x)\eqno(4)

and

以及

p(yt∣y<t,x)=softmax(f(st))\eqno(5)p(y_t|y_{<t}, x) = \mathrm{softmax}(f(s_t)) \eqno{(5)}p(yt​∣y<t​,x)=softmax(f(st​))\eqno(5)

where f(⋅)f(\cdot)f(⋅) is a fully connected layer. For translation tasks, this softmax function is among all dimensions of f(st)f(s_t)f(st​) and calculates the probability of each word in the vocabulary. However, in the TTS task, the softmax function is not required and the hidden states sss calculated by decoder are consumed directly by a linear projection to obtain the desired spectrogram frames.

其中 f(⋅)f(\cdot)f(⋅) 是全连接层。在翻译任务中,这个 softmax 作用在 f(st)f(s_t)f(st​) 的各个维上,计算词表中每个词的概率。但在 TTS 任务中不需要 softmax,解码器算出的隐状态 sss 会直接经线性投影得到所需的频谱帧。

2.2 Tacotron2

Tacotron2 is a neural network architecture for speech synthesis directly from text, as shown in Fig. 1. The embedding sequence of input is firstly processed with a 3-layer CNN to extract a longer-term context, and then fed into the encoder, which is a bi-directional LSTM. The previous mel spectrogram frame (the predicted one in inference, or the golden one in training time), is first processed with a 2-layer fully connected network (decoder pre-net), whose output is concatenated with the previous context vector, followed by a 2-layer LSTM. The output is used to calculate the new context vector at this time step, which is concatenated with the output of the 2-layer LSTM to predict the mel spectrogram and stop token with two different linear projections respectively. Finally the predicted mel spectrogram is fed into a 5-layer CNN with residual connections to refine the mel spectrogram.

Tacotron2 是一种直接由文本合成语音的神经网络架构,如图 1 所示。输入的嵌入序列先经过三层 CNN,以提取更长程的上下文,再送入作为编码器的双向 LSTM。上一帧梅尔频谱(推理时为预测帧,训练时为真值帧)先经过两层全连接网络(解码器预网络),其输出与上一时刻的上下文向量拼接,再进入两层 LSTM。该输出用来计算当前步的新上下文向量,再与两层 LSTM 的输出拼接,分别通过两个不同的线性投影预测梅尔频谱和停止符。最后,预测的梅尔频谱再送入带残差连接的五层 CNN,用于细化频谱。

System architecture of Tacotron2

Figure 1: System architecture of Tacotron2.

图 1:Tacotron2 的系统架构。

2.3 Transformer for NMT

2.3 用于 NMT 的 Transformer

Transformer (Vaswani et al. 2017), shown in Fig. 2, is a sequence to sequence network, based solely on attention mechanisms and dispensing with recurrences and convolutions entirely. In recent works, Transformer has shown extraordinary results, which outperforms many RNN-based models in NMT. It consists of two components: an encoder and a decoder, both are built by stacks of several identity blocks. Each encoder block contains two subnetworks: a multi-head attention and a feed forward network, while each decoder block contains an extra masked multi-head attention comparing to the encoder block. Both encoder and decoder blocks have residual connections and layer normalizations.

Transformer(Vaswani et al. 2017)如图 2 所示,是一种完全基于注意力机制、不再使用循环和卷积的序列到序列网络。在近期工作中,Transformer 表现突出,在 NMT 中超过许多基于 RNN 的模型。它由编码器和解码器两部分组成,二者都由若干相同块堆叠而成。每个编码器块包含两个子网络:多头注意力和前馈网络;每个解码器块则比编码器块多一个带掩码的多头注意力。编码器块和解码器块都带有残差连接和层归一化。

System architecture of the Transformer network

Figure 2: System architecture of Transformer.

图 2:Transformer 的系统架构。

3 Neural TTS with Transformer

3 基于 Transformer 的神经 TTS

Compared to RNN-based models, using Transformer in neural TTS has two advantages. First it enables parallel training by removing recurrent connections, as frames of an input sequence for decoder can be provided in parallel. The second one is that self attention provides an opportunity for injecting global context of the whole sequence into each input frame, building long range dependencies directly. Transformer shortens the length of paths forward and backward signals have to traverse between any combination of positions in the input and output sequences down to 1. This helps a lot in a neural TTS model, such as the prosody of synthesized waves, which not only depends on several words in the neighborhood, but also sentence level semantics.

与基于 RNN 的模型相比,在神经 TTS 中使用 Transformer 有两点好处。第一,去掉循环连接后可以并行训练,因为解码器输入序列的各帧可以一并提供。第二,自注意力可以把整段序列的全局上下文注入每一输入帧,从而直接建立长程依赖。Transformer 把输入、输出序列中任意位置组合之间前向和反向信号必须经过的路径长度缩短为 1。这对神经 TTS 很有帮助,例如合成波形的韵律不仅取决于邻近的几个词,还取决于句子级语义。

In this section we will introduce the architecture of our Transformer TTS model, and analyze the function of each part. The overall structure diagram is shown in Fig. 3.

本节将介绍 Transformer TTS 模型的架构,并分析各部分的作用。总体结构如图 3 所示。

3.1 Text-to-Phoneme Converter

3.1 文本转音素转换器

English pronunciation has certain regularities, for example, there are two kinds of syllables in English: open and closed. The letter “a” is often pronounced as /eɪ/ when it’s in an open syllable, while it is pronounced as /æ/ or /a:/ in closed syllables. We can rely on the neural network to learn such a regularity in the training process. However, it is difficult to learn all the regularities when, which is often the case, the training data is not sufficient enough, and some exceptions have too few occurrences for neural networks to learn. So we make a rule system and implement it as a text-to-phoneme converter, which can cover the vast majority of cases.

英语发音有一定规律,例如英语音节分为开音节和闭音节两种。字母 “a” 在开音节中常读作 /eɪ/,在闭音节中则读作 /æ/ 或 /a:/。我们可以指望神经网络在训练中学到这类规律。不过,在训练数据往往不够充分、某些例外出现次数又太少时,要学全全部规律并不容易。因此我们做了一套规则系统,并实现为文本转音素转换器,以覆盖绝大多数情形。

3.2 Scaled Positional Encoding

3.2 带缩放的位置编码

Transformer contains no recurrence and no convolution so that if we shuffle the input sequence of encoder or decoder, we will get the same output. To take the order of the sequence into consideration, information about the relative or absolute position of frames is injected by triangle positional embeddings, shown in Eq. 7:

Transformer 既没有循环也没有卷积,因此若打乱编码器或解码器的输入序列,仍会得到相同输出。为了把序列顺序考虑进来,帧的相对或绝对位置信息由三角位置嵌入注入,如式 7 所示:

PE(pos,2i)=sin⁡(pos100002i/dmodel)\eqno(6)PE_{(pos, 2i)} = \sin\left(\frac{pos}{10000^{2i/d_{model}}}\right) \eqno{(6)}PE(pos,2i)​=sin(100002i/dmodel​pos​)\eqno(6)

PE(pos,2i+1)=cos⁡(pos100002i/dmodel)\eqno(7)PE_{(pos, 2i+1)} = \cos\left(\frac{pos}{10000^{2i/d_{model}}}\right) \eqno{(7)}PE(pos,2i+1)​=cos(100002i/dmodel​pos​)\eqno(7)

where pospospos is the time step index, 2i2i2i and 2i+12i+12i+1 is the channel index and dmodeld_{model}dmodel​ is the vector dimension of each frame. In NMT, the embeddings for both source and target language are from language spaces, so the scales of these embeddings are similar. This condition doesn’t hold in the TTS scenarioe, since the source domain is of texts while the target domain is of mel spectrograms, hence using fixed positional embeddings may impose heavy constraints on both the encoder and decoder pre-nets (which will be described in Sec. 3.3 and 3.4). We employ these triangle positional embeddings with a trainable weight, so that these embedding can adaptively fit the scales of both encoder and decoder prenets’ output, as shown in Eq. 8:

其中 pospospos 是时间步索引,2i2i2i 和 2i+12i+12i+1 是通道索引,dmodeld_{model}dmodel​ 是每帧向量的维数。在 NMT 中,源语言和目标语言的嵌入都来自语言空间,因而尺度相近。这一条件在 TTS 情形下并不成立(原文作 “scenarioe”),因为源域是文本、目标域是梅尔频谱,使用固定的位置嵌入可能对编码器和解码器预网络都加上过强约束(见第 3.3 和 3.4 节)。我们给这些三角位置嵌入配上一个可训练权重,使其能自适应地拟合编码器、解码器预网络输出的尺度,如式 8 所示:

xi=prenet(phonemei)+αPE(i)\eqno(8)x_i = \mathrm{prenet}(\mathrm{phoneme}_i) + \alpha PE(i) \eqno{(8)}xi​=prenet(phonemei​)+αPE(i)\eqno(8)

where α\alphaα is the trainable weight.

其中 α\alphaα 是可训练权重。

3.3 Encoder Pre-net

3.3 编码器预网络

In Tacotron2, a 3-layer CNN is applied to the input text embeddings, which can model the longer-term context in the input character sequence. In our Transformer TTS model, we input the phoneme sequence into the same network, which is called “encoder pre-net”. Each phoneme has a trainable embedding of 512 dims, and the output of each convolution layer has 512 channels, followed by a batch normalization and ReLU activation, and a dropout layer as well. In addition, we add a linear projection after the final ReLU activation, since the output range of ReLU is [0,+∞)[0, +\infty)[0,+∞), while each dimension of these triangle positional embeddings is in [−1,1][-1, 1][−1,1]. Adding 0-centered positional information onto non-negative embeddings will result in a fluctuation not centered on the origin and harm model performance, which will be demonstrated in our experiment. Hence we add a linear projection for center consistency.

在 Tacotron2 中,输入文本嵌入会先经过三层 CNN,用来建模字符序列中更长程的上下文。在我们的 Transformer TTS 模型里,把音素序列送入同一网络,称为“编码器预网络”。每个音素有 512 维的可训练嵌入,每一卷积层输出 512 个通道,随后是批归一化、ReLU 激活以及 dropout。此外,我们在最后的 ReLU 激活后再加一层线性投影,因为 ReLU 的输出范围是 [0,+∞)[0, +\infty)[0,+∞),而这些三角位置嵌入的每一维都在 [−1,1][-1, 1][−1,1] 内。把以 0 为中心的位置信息加到非负嵌入上,会导致波动不以原点为中心,从而损害模型表现,这一点将在实验中说明。因此我们加入线性投影,以使中心一致。

3.4 Decoder Pre-net

3.4 解码器预网络

The mel spectrogram is first consumed by a neural network composed of two fully connected layers (each has 256 hidden units) with ReLU activation, named “decoder pre-net”, and it plays an important role in the TTS system. Phonemes has trainable embeddings thus their subspace is adaptive, while that of mel spectrograms is fixed. We infer that decoder pre-net is responsible for projecting mel spectrograms into the same subspace as phoneme embeddings, so that the similarity of a ⟨\langle⟨phoneme, mel frame⟩\rangle⟩ pair can be measured, thus the attention mechanism can work. Besides, 2 fully connected layers without non-linear activation are also tried but no reasonable attention matrix aligning the hidden states of encoder and decoder can be generated. In our other experiment, hidden size is enlarged from 256 to 512, however that doesn’t generate significant improvement but needs more steps to converge. Accordingly, we conjecture that mel spectrograms have a compact and low dimensional subspace that 256 hidden units are good enough to fit. This conjecture can also be evidenced in our experiment, which is shown in Sec. 4.6, that the final positional embedding scale of decoder is smaller than that of encoder. An additional linear projection is also added like encoder pre-net not only for center consistency but also obtain the same dimension as the triangle positional embeddings.

梅尔频谱先由一个由两层全连接(每层 256 个隐藏单元)并带 ReLU 激活的网络处理,称为“解码器预网络”,它在 TTS 系统中作用重要。音素具有可训练嵌入,因而其子空间是自适应的(原文作 “Phonemes has”),梅尔频谱的子空间则是固定的。我们推断,解码器预网络负责把梅尔频谱投影到与音素嵌入相同的子空间,以便度量 ⟨\langle⟨音素,梅尔帧⟩\rangle⟩ 对的相似度,注意力机制才能工作。此外,也曾试过两层没有非线性激活的全连接,但无法得到合理的、能对齐编码器与解码器隐状态的注意力矩阵。在另一实验中,隐藏维从 256 扩大到 512,并未带来明显提升,却需要更多步才能收敛。据此我们推测,梅尔频谱具有紧凑、低维的子空间,256 个隐藏单元已足够拟合。这一推测也可由实验支持:如第 4.6 节所示,解码器最终的位置嵌入尺度小于编码器。与编码器预网络类似,这里也加了一层额外的线性投影,既为了中心一致,也为了得到与三角位置嵌入相同的维数。

System architecture of the proposed Transformer TTS model

Figure 3: System architecture of our model.

图 3:本文模型的系统架构。

3.5 Encoder

3.5 编码器

In Tacotron2, the encoder is a bi-directional RNN. We replace it with Transformer encoder which is described in Sec. 2.3. Comparing to original bi-directional RNN, multi-head attention splits one attention into several subspaces so that it can model the frame relationship in multiple different aspects, and it directly builds the long-time dependency between any two frames thus each of them considers global context of the whole sequence. This is crucial for synthesized audio prosody especially when the sentence is long, as generated samples sound more smooth and natural in our experiments. In addition, employing multi-head attention instead of original bi-directional RNN can enable parallel computing to improve training speed.

在 Tacotron2 中,编码器是双向 RNN。我们把它替换为第 2.3 节所述的 Transformer 编码器。与原来的双向 RNN 相比,多头注意力把一次注意力分到若干子空间,从而可以从多个不同侧面建模帧之间的关系,并直接建立任意两帧之间的长时间依赖,使每一帧都能考虑整段序列的全局上下文。这对合成音频的韵律很关键,尤其是句子较长时;在我们的实验中,生成的样本听起来更平滑、更自然。此外,用多头注意力代替原来的双向 RNN,还能并行计算,从而提高训练速度。

3.6 Decoder

3.6 解码器

In Tacotron2, the decoder is a 2-layer RNN with location-sensitive attention (Chorowski et al. 2015). We replace it with Transformer decoder which is described in Sec. 2.3. Employing Transformer decoder makes two main differences, adding self-attention, which can bring similar advantages described in Sec. 3.5, and using multi-head attention instead of the location-sensitive attention. The multi-head attention can integrate the encoder hidden states in multiple perspectives and generate better context vectors. Taking attention matrix of previous decoder time steps into consideration, location-sensitive attention used in Tacotron2 can encourage the model to generate consistent attention results. We try to modify the dot product based multi-head attention to be location sensitive, but that doubles the training time and easily run out of memory.

在 Tacotron2 中,解码器是带位置敏感注意力(Chorowski et al. 2015)的两层 RNN。我们把它替换为第 2.3 节所述的 Transformer 解码器。改用 Transformer 解码器主要有两点不同:一是加入自注意力,可带来第 3.5 节所述的类似好处;二是用多头注意力替换位置敏感注意力。多头注意力能从多个视角整合编码器隐状态,并生成更好的上下文向量。Tacotron2 所用的位置敏感注意力会把先前解码时间步的注意力矩阵考虑进来,从而促使模型产生前后一致的注意力结果。我们曾尝试把基于点积的多头注意力改成位置敏感,但这会使训练时间翻倍,并且容易耗尽显存。

3.7 Mel Linear, Stop Linear and Post-net

3.7 梅尔线性层、停止线性层与后网络

Same as Tacotron2, we use two different linear projections to predict the mel spectrogram and the stop token respectively, and use a 5-layer CNN to produce a residual to refine the reconstruction of mel spectrogram. It’s worth mentioning that, for the stop linear, there is only one positive sample in the end of each sequence which means “stop”, while hundreds of negative samples for other frames. This imbalance may result in unstoppable inference. We impose a positive weight (5.0 ∼\sim∼ 8.0) on the tail positive stop token when calculating binary cross entropy loss, and this problem was efficiently solved.

与 Tacotron2 相同,我们用两个不同的线性投影分别预测梅尔频谱和停止符,并用五层 CNN 产生残差,以细化梅尔频谱的重建。值得一提的是,对停止线性层而言,每条序列末尾只有一个表示“停止”的正样本,其余帧则有数百个负样本。这种不平衡可能导致推理无法停止。我们在计算二元交叉熵损失时,给末尾的正停止符加上 5.0 到 8.0 的正权重,该问题便得到有效解决。

4 Experiment

4 实验

In this section, we conduct experiments to test our proposed Transformer TTS model with 25-hour professional speech pairs, and the audio quality is evaluated by human testers in MOS and CMOS.

本节用 25 小时专业语音对来检验所提出的 Transformer TTS 模型,音质由人工测听者以 MOS 和 CMOS 评估。

4.1 Training Setup

4.1 训练设置

We use 4 Nvidia Tesla P100 to train our model with an internal US English female dataset, which contains 25-hour professional speech (17584 ⟨\langle⟨text, wave⟩\rangle⟩ pairs, with a few too long waves removed). 50ms silence at head and 100ms silence at tail are kept for each wave. Since the lengths of training samples vary greatly, fixed batch size will either run out of memory when long samples are added into a batch with a large size or waste the parallel computing power if the batch is small and into which short samples are divided. Therefore, we use the dynamic batch size where the maximum total number of mel spectrogram frames is fixed and one batch should contain as many samples as possible. Thus there are on average 16 samples in single batch per GPU. We try training on a single GPU, but the procedures are quiet instable or even failed, by which synthesized audios were like raving and incomprehensible. Even if training doesn’t fail, synthesized waves are of bad quality and weird prosody, or even have some severe problems like missing phonemes. Thus we enable multi-GPU training to enlarge the batch size, which effectively solves those problems.

我们用 4 块 Nvidia Tesla P100,在内部美式英语女声数据集上训练模型。该数据集含 25 小时专业语音(17584 对 ⟨\langle⟨文本,波形⟩\rangle⟩,并去掉了少量过长的波形)。每条波形保留开头 50 毫秒和末尾 100 毫秒的静音。由于训练样本长度差异很大,固定批量要么会在大批量中加入长样本时耗尽显存,要么会在批量较小、短样本被分进去时浪费并行算力。因此我们采用动态批量:梅尔频谱帧数的上限固定,并在一批中尽可能多放样本。这样平均每块 GPU 单批约有 16 条样本。我们也试过单卡训练,但过程相当不稳定(原文作 “quiet instable”),甚至会失败,合成音频像谵语一样难以听懂。即便训练没有失败,合成波形音质也差,韵律怪异,甚至出现漏音素等严重问题。因此我们启用多 GPU 训练以加大批量,从而有效解决了这些问题。

4.2 Text-to-Phoneme Conversion and Pre-process

4.2 文本转音素与预处理

Tacotron2 uses character sequences as input, while our model is trained on pre-normalized phoneme sequences. Word and syllable boundaries, punctuations are also included as special markers. The process pipeline to get training phoneme sequences contains sentence separation, text normalization, word segmentation and finally obtaining pronunciation. By text-to-phoneme conversion, mispronunciation problems are greatly reduced especially for those pronunciations that are rarely occurred in our training set.

Tacotron2 以字符序列为输入,而我们的模型在预先规范化的音素序列上训练。词和音节边界、标点也被作为特殊标记纳入。得到训练用音素序列的流程包括分句、文本规范化、分词,最后得到读音。通过文本转音素,错误发音问题大为减少,尤其是在训练集中很少出现的读音上。

4.3 WaveNet Settings

4.3 WaveNet 设置

We train a WaveNet conditioned on mel spectrogram with the same internal US English female dataset, and use it as the vocoder for all models in this paper. The sample rate of ground truth audios is 16000 and frame rate (frames per second) of ground truth mel spectrogram is 80. Our autoregressive WaveNet contains 2 QRNN layers and 20 dilated layers, and the sizes of all residual channels and dilation channels are all 256. Each frame of QRNN’s final output is copied 200 times to have the same spatial resolution as audio samples and be conditions of 20 dilated layers.

我们在同一内部美式英语女声数据集上训练以梅尔频谱为条件的 WaveNet,并把它作为本文所有模型的声码器。真值音频的采样率为 16000,真值梅尔频谱的帧率(每秒帧数)为 80。我们的自回归 WaveNet 包含 2 层 QRNN 和 20 层膨胀卷积,所有残差通道和膨胀通道的大小都是 256。QRNN 最终输出的每一帧被复制 200 次,以获得与音频采样相同的空间分辨率,并作为 20 层膨胀卷积的条件。

4.4 Training Time Comparison

4.4 训练时间对比

Our model can be trained in parallel since there is no recurrent connection between frames. In our experiment, time consume in a single training step for our model is ∼\sim∼0.4s, which is 4.25 times faster than that of Tacotron2 (∼\sim∼1.7s) with equal batch size (16 samples per batch). However, since the parameter quantity of our model is almost twice than Tacotron2, it still takes ∼\sim∼3 days to converge comparing to ∼\sim∼4.5 days of that for Tacotron2.

由于帧与帧之间没有循环连接,我们的模型可以并行训练。实验中,本模型单步训练耗时约 0.4 秒,在同等批量(每批 16 条样本)下比 Tacotron2(约 1.7 秒)快 4.25 倍。不过,由于本模型参数量几乎是 Tacotron2 的两倍,收敛仍大约需要 3 天,而 Tacotron2 约需 4.5 天。

4.5 Evaluation

4.5 评测

We randomly select 38 fixed examples with various lengths (no overlap with training set) from our internal dataset as the evaluation set. We evaluate mean option score (MOS) on these 38 sentences generated by different models (include recordings), in which case we can keep the text content consistent and exclude other interference factors hence only examine audio quality. For higher result accuracy, we split the whole MOS test into several small tests, each containing one group from our best model, one group from a comparative model and one group of recordings. Those MOS tests are rigorous and reliable, as each audio is listened to by at least 20 testers, who are all native English speakers (comparing to Tacotron2’s 8 testers in Shen et al.(2017)), and each tester listens less than 30 audios.

我们从内部数据集中随机抽出 38 条长度各异、与训练集无重叠的固定样例作为评测集。在这些由不同模型(含录音)生成的 38 句上评估平均意见分(MOS;原文将 opinion 写作 option)。这样可以保持文本内容一致、排除其他干扰,从而只考察音质。为提高结果精度,整场 MOS 测试被拆成若干小测试,每场包含一组我们最好模型的样本、一组对比模型的样本和一组录音。这些 MOS 测试严格且可靠:每条音频至少由 20 名测听者收听,且均为英语母语者(相比之下,Shen et al.(2017)中 Tacotron2 为 8 名测听者),每人收听不超过 30 条音频。

System MOS CMOS
Tacotron2 4.39 ± 0.05 0
Our Model 4.39 ± 0.05 0.048
Ground Truth 4.44 ± 0.05 -

Table 1: MOS comparison among our model, our Tacotron2 and recordings.

System MOS CMOS
Tacotron2 4.39 ± 0.05 0
Our Model 4.39 ± 0.05 0.048
Ground Truth 4.44 ± 0.05 -

表 1:本模型、我们的 Tacotron2 与录音的 MOS 对比。

Mel spectrogram comparison among the proposed model, Tacotron2, and a 3-layer variant

Figure 4: Mel spectrogram comparison. Our model (6-layer) does better in reconstructing details as marked in red rectangles, while Tacotron2 and our 3-layer model blur the texture especially in high frequency region. Best viewed in color.

图 4:梅尔频谱对比。本模型(6 层)在红框标出的细节重建上更好,而 Tacotron2 和我们的 3 层模型会模糊纹理,尤其是在高频区域。建议看彩色图。

We train a Tacotron2 model with our internal US English female dataset as the baseline (also use phonemes as input), and gain equal MOS with our model. Therefore we test the comparison mean option score (CMOS) between samples generated by Tacotron2 and our model for a finer contrast. In the comparison mean option score (CMOS) test, testers listen to two audios (generated by Tacotron2 and our model with the same text) each time and evaluates how the latter feels comparing to the former using a score in [−3,3][-3, 3][−3,3] with intervals of 1. The order of the two audios changes randomly so testers don’t know their sources. Our model wins by a gap of 0.048, and detailed results are shown in Table 1.

我们在同一内部美式英语女声数据集上训练 Tacotron2 作为基线(同样以音素为输入),得到的 MOS 与本模型相同。因此进一步测试 Tacotron2 与本模型所生成样本的比较平均意见分(CMOS;原文同样写作 option),以便更细致地对比。在 CMOS 测试中,测听者每次听两条由同一文本分别经 Tacotron2 和本模型生成的音频,并用 [−3,3][-3, 3][−3,3]、间隔为 1 的分数评价后者相对于前者听起来如何。两条音频的顺序随机变化,测听者不知道来源。本模型以 0.048 的差距取胜,详细结果见表 1。

We also select mel spectrograms generated by our model and Tacotron2 respectively with the same text, and compare them together with ground truth, as shown in column 1,2 and 3 of Fig. 4. As we can see, our model does better in reconstructing details as marked in red rectangles, while Tacotron2 left out the detailed texture in high frequency region.

我们还选出本模型和 Tacotron2 在同一文本上生成的梅尔频谱,并与真值一起比较,如图 4 第 1、2、3 列所示。可以看到,本模型在红框标出的细节重建上更好,而 Tacotron2 丢掉了高频区域的细致纹理。

4.6 Ablation Studies

4.6 消融实验

In this section, we study the detail modification of network architecture, and conduct several experiments to show our improvements.

本节研究网络架构的细节改动,并用若干实验展示这些改进。

Re-centering Pre-net’s Output

预网络输出的重新居中

As described in Sec. 3.3 and 3.4, we re-project both the encoder and decoder prenets’ outputs for consistent center with positional embeddings. In contrast, we add no linear projection in encoder pre-net and add a fully connected layer with ReLU activation in decoder pre-net. The results imply that center-consistent positional embedding performs slightly better, as shown in Table 2.

如第 3.3 和 3.4 节所述,我们对编码器和解码器预网络的输出重新投影,使其与位置嵌入中心一致。对照设置是:编码器预网络不加线性投影,解码器预网络则加带 ReLU 激活的全连接层。结果表明,中心一致的位置嵌入略好,见表 2。

Re-center MOS
No 4.32 ± 0.05
Yes 4.36 ± 0.05
Ground Truth 4.43 ± 0.05

Table 2: MOS comparison of whether re-centering pre-net’s output.

Re-center MOS
No 4.32 ± 0.05
Yes 4.36 ± 0.05
Ground Truth 4.43 ± 0.05

表 2:是否对预网络输出重新居中的 MOS 对比。

Learned positional encoding scales of the encoder and decoder

Figure 5: PE scale of encoder and decoder.

图 5:编码器与解码器的位置编码尺度。

Different Positional Encoding Methods

不同的位置编码方法

We inject positional information into both encoder’s and decoder’s input sequences as Eq. 8. Fig. 5 shows that the final positional embedding scales of encoder and decoder are different, and Table 3 shows model with trainable scale performs slightly better. We think that the trainable scale relaxes the constraint on encoder and decoder pre-nets, making positional information more adaptive for different embedding spaces.

我们按式 8 把位置信息注入编码器和解码器的输入序列。图 5 显示,编码器与解码器最终的位置嵌入尺度不同;表 3 则表明,带可训练尺度的模型略好。我们认为,可训练尺度放松了对编码器、解码器预网络的约束,使位置信息更能适配不同的嵌入空间。

PE Type MOS
Original 4.37 ± 0.05
Scaled 4.40 ± 0.05
Ground Truth 4.41 ± 0.04

Table 3: MOS comparison of scaled and original PE.

PE Type MOS
Original 4.37 ± 0.05
Scaled 4.40 ± 0.05
Ground Truth 4.41 ± 0.04

表 3:缩放位置编码与原始位置编码的 MOS 对比。

We also try adding absolute position embeddings (each position has a trainable embedding) to the sequence, which also works but has some severe problems such as missing phonemes when the sequences became long. That’s because long sample is relatively rare in the training set, so the embeddings for large indexes can hardly be trained and thus the position information won’t be accurate for rear frames in a long sample.

我们也试过给序列加上绝对位置嵌入(每个位置有一个可训练嵌入)。这种方法也能工作,但在序列变长时会出现漏音素等严重问题。这是因为长样本在训练集中相对少见,大索引对应的嵌入几乎得不到训练,因而长样本后部各帧的位置信息并不准确。

Model with Different Hyper-Parameter

不同超参数的模型

Both the encoder and decoder of the original Transformer is composed of 6 layers, and each multi-head attention has 8 heads. We compare performance and training speed with different layer and head numbers, as shown in Table 4, 5 and 6. We find that reducing layers and heads both improve the training speed, but on the other hand, harm model performance in different degrees.

原始 Transformer 的编码器和解码器都由 6 层组成,每个多头注意力有 8 个头。我们比较了不同层数和头数下的表现与训练速度,见表 4、5 和 6。我们发现,减少层数和头数都能提高训练速度,但另一方面也会在不同程度上损害模型表现。

Layer Number MOS
3-layer 4.33 ± 0.06
6-layer 4.41 ± 0.05
Ground Truth 4.44 ± 0.05

Table 4: Ablation studies in different layer numbers.

Layer Number MOS
3-layer 4.33 ± 0.06
6-layer 4.41 ± 0.05
Ground Truth 4.44 ± 0.05

表 4:不同层数的消融实验。

Head Number MOS
4-head 4.39 ± 0.05
8-head 4.44 ± 0.05
Ground Truth 4.47 ± 0.05

Table 5: Ablation studies in different head numbers.

Head Number MOS
4-head 4.39 ± 0.05
8-head 4.44 ± 0.05
Ground Truth 4.47 ± 0.05

表 5:不同头数的消融实验。

We notice that in both the 3-layer and 6-layer model, only alignments from certain heads of the beginning 2 layers’ are interpretable diagonal lines, which shows the approximate correspondence between input and output sequence, while those of the following layers are disorganized. Even so, more layers can still lower the loss, refine the synthesized mel spectrogram and improve audio quality. The reason is that with residual connection between different layers, our model fits target transformation in a Taylor-expansion way: the starting terms account most as low ordering ones, while the subsequential ones can refine the function. Hence adding more layer makes the synthesized wave more natural, since it does better in processing spectrogram details (shown in column 4, Fig. 4). Fewer heads can slightly reduce training time cost since there are less production per layer, but also harm the performance.

我们注意到,在 3 层和 6 层模型中,只有前两层里某些头的对齐是可解释的对角线,显示出输入与输出序列的大致对应,而后面几层的对齐则显得杂乱。即便如此,增加层数仍能降低损失、细化合成的梅尔频谱并提高音质。原因在于,层与层之间的残差连接使模型以类似泰勒展开的方式拟合目标变换:起始几项作为低阶项承担主要作用,后续项则可以细化该函数。因此再加层会使合成波形更自然,因为它能更好地处理频谱细节(见图 4 第 4 列)。减少头数可以略微降低训练耗时,因为每层的计算量更少,但也会损害表现。

3-layer 6-layer
4-head 0.44
8-head 0.29 0.50

Table 6: Comparison of time consuming (in second) per training step of different layer and head numbers.

3-layer 6-layer
4-head 0.44
8-head 0.29 0.50

表 6:不同层数和头数下每训练步耗时(秒)的对比。

5 Related Work

5 相关工作

Traditional speech synthesis methods can be categorized into two classes: concatenative systems and parametric systems. Concatenative TTS systems (Hunt and Black 1996; Black and Taylor 1997) split original waves into small units, and stitch them by some algorithms such as Viterbi (Viterbi 1967) followed by signal process methods (Charpentier and Stella 1986; Verhelst and Roelands 1993) to generate new waves. Parametric TTS systems (Tokuda et al. 2000; Zen, Tokuda, and Black 2009; Ze, Senior, and Schuster 2013; Tokuda et al. 2013) convert speech waves into spectrograms, and acoustic parameters, such as fundamental frequency and duration, are used to synthesize new audio results.

传统语音合成方法可分为两类:拼接系统和参数系统。拼接式 TTS(Hunt and Black 1996; Black and Taylor 1997)把原始波形切成小单元,再用 Viterbi(Viterbi 1967)一类算法拼接,并辅以信号处理方法(Charpentier and Stella 1986; Verhelst and Roelands 1993)生成新波形。参数式 TTS(Tokuda et al. 2000; Zen, Tokuda, and Black 2009; Ze, Senior, and Schuster 2013; Tokuda et al. 2013)把语音波形转换成频谱,再用基频、时长等声学参数合成新的音频结果。

Traditional speech synthesis methods require extensive domain expertise and may contain brittle design choices. Char2Wav (Sotelo et al. 2017) integrates the front-end and the back-end as one seq2seq (Sutskever, Vinyals, and Le 2014; Bahdanau, Cho, and Bengio 2014) model and learns the whole process in an end-to-end way, predicting acoustic parameters followed by a SampleRNN (Mehri et al. 2016) as the vocoder. However, acoustic parameters are still intermediate for audios, thus Char2Wav is not a really end-to-end TTS model, and their seq2seq and SampleRNN models need to be separately pre-trained, while Tacotron, proposed by Wang et al.(2017), is an end-to-end generative text-to-speech model, which can be trained by ⟨\langle⟨text, spectrogram⟩\rangle⟩ pairs directly from scratch, and synthesizes speech audios with generated spectrograms by Griffin Lim algorithm (Griffin and Lim 1984). Based on Tacotron, Tacotron2 (Shen et al. 2017), a unified and entirely neural model, generates mel spectrograms by a Tacotron-style neural network and then synthesizes speech audios by a modified WaveNet (Van Den Oord et al. 2016). WaveNet is an autoregressive generative model for waveform synthesis, composed of stacks of dilated convolutional layers and processes raw audios of very high temporal resolution (e.g., 24,000 sample rate), while suffering from very large time cost in inference. This problem is solved by Parallel WaveNet (Oord et al. 2017), based on the inverse autoregressive flow (IAF) (Kingma et al. 2016) and reaches 1000×1000\times1000× real time. Recently, ClariNet (Ping, Peng, and Chen 2018), a fully convolutional text-to-wave neural architecture, is proposed to enable the fast end-to-end training from scratch. Moreover, VoiceLoop (Taigman et al. 2018) is an alternative neural TTS method mimicking a person’s voice based on samples captured in-the-wild, such as audios of public speeches, and even with an inaccurate automatic transcripts.

传统语音合成方法需要大量领域经验,还可能包含脆弱的设计选择。Char2Wav(Sotelo et al. 2017)把前端和后端集成成一个 seq2seq 模型(Sutskever, Vinyals, and Le 2014; Bahdanau, Cho, and Bengio 2014),以端到端方式学习全过程:先预测声学参数,再用 SampleRNN(Mehri et al. 2016)作为声码器。不过声学参数对音频而言仍是中间量,因此 Char2Wav 还不是真正的端到端 TTS 模型,而且其 seq2seq 与 SampleRNN 需要分别预训练。相比之下,Wang et al.(2017)提出的 Tacotron 是端到端生成式文本转语音模型,可以直接用 ⟨\langle⟨文本,频谱⟩\rangle⟩ 对从零训练,并用 Griffin Lim 算法(Griffin and Lim 1984)由生成的频谱合成语音。在 Tacotron 基础上,Tacotron2(Shen et al. 2017)是一个统一、完全神经的模型:先由 Tacotron 风格的网络生成梅尔频谱,再用改进的 WaveNet(Van Den Oord et al. 2016)合成语音。WaveNet 是用于波形合成的自回归生成模型,由多层膨胀卷积堆叠而成,处理时间分辨率很高的原始音频(例如采样率 24000),但推理耗时很大。Parallel WaveNet(Oord et al. 2017)基于逆自回归流(IAF)(Kingma et al. 2016)解决了这一问题,可达到实时的 1000 倍。最近,ClariNet(Ping, Peng, and Chen 2018)作为一种全卷积的文本到波形神经架构被提出,以支持从零开始的快速端到端训练。此外,VoiceLoop(Taigman et al. 2018)是另一种神经 TTS 方法,可依据公开演讲等野外采集的样本模仿某人的声音,即便自动转写并不准确也能使用。

On the other hand, Transformer (Vaswani et al. 2017) is proposed for neural machine translation (NMT) and achieves state-of-the-art result. Previous NMT models are dominated by RNN-based (Bahdanau, Cho, and Bengio 2014) or CNN-based (e.g. ConvS2S (Gehring et al. 2017), ByteNet (Kalchbrenner et al. 2016)) neural networks. For RNN-based models, both training and inference are sequential for each sample, while CNN-based models enable parallel training. Both RNN and CNN based models are difficult to learn dependencies between distant positions since RNNs have to traverse a long path and CNN has to stack many convolutional layers to get a large receptive field, while Transformer solves this using self attention in both its encoder and decoder. The ability of self-attention is also proved in SAGAN (Zhang et al. 2018), where original GANs without self-attention fail to capture geometric or structural patterns that occur consistently in some classes (for example, dogs are often drawn without clearly defined separate feet). By adding self-attention, these failure cases are greatly reduced. Besides, multi-head attention is proposed to obtain different relations in multi-subspaces. Recently, Transformer has been applied in automatic speech recognition (ASR) (Zhou et al. 2018a; 2018b), proving its ability in acoustic modeling other than natural language process.

另一方面,Transformer(Vaswani et al. 2017)为神经机器翻译(NMT)而提出,并达到当时最好结果。此前的 NMT 模型主要由基于 RNN(Bahdanau, Cho, and Bengio 2014)或基于 CNN(例如 ConvS2S(Gehring et al. 2017)、ByteNet(Kalchbrenner et al. 2016))的网络主导。对基于 RNN 的模型而言,每个样本的训练和推理都是逐步的;基于 CNN 的模型则可以并行训练。RNN 和 CNN 模型都难以学习远距离位置之间的依赖,因为 RNN 必须走过很长的路径,CNN 则要堆很多卷积层才能得到大感受野;Transformer 则在编码器和解码器中都用自注意力解决了这一点。自注意力的能力也在 SAGAN(Zhang et al. 2018)中得到验证:没有自注意力的原来的 GAN 难以捕捉某些类别中反复出现的几何或结构模式(例如狗常常被画成没有清晰分开的脚)。加入自注意力后,这类失败情形大大减少。此外,多头注意力被提出,以便在多个子空间中得到不同关系。最近,Transformer 也被用于自动语音识别(ASR)(Zhou et al. 2018a; 2018b),表明它在声学建模上同样有能力,而不仅限于自然语言处理。

6 Conclusion and Future Work

6 结论与未来工作

We propose a neural TTS model based on Tacotron2 and Transformer, and make some modification to adapt Transformer to neural TTS task. Our model generates audio samples of which quality is very closed to human recording, and enables parallel training and learning long-distance dependency so that the training is sped up and the audio prosody is much more smooth. We find that batch size is crucial for training stability, and more layers can refine the detail of generated mel spectrograms especially for high frequency regions thus improve model performance.

我们提出一种基于 Tacotron2 和 Transformer 的神经 TTS 模型,并做了一些改动,以使 Transformer 适配神经 TTS 任务。本模型生成的音频样本音质非常接近真人录音(原文作 “very closed to”),并且能够并行训练、学习长距离依赖,从而加快训练,也使音频韵律更加平滑。我们发现批量对训练稳定性至关重要,而增加层数可以细化生成梅尔频谱的细节,尤其是高频区域,从而提高模型表现。

Even thought Transformer has enabled parallel training, autoregressive model still suffers from two problems, which are slow inference and exploration bias. Slow inference is due to the dependency of previous frames when infer current frame, so that the inference is sequential, while exploration bias comes from the autoregressive error accumulation. We may solve them both at once by building a non-autoregressive model, which is also our current research in progress.

尽管 Transformer 已经使并行训练成为可能(原文作 “Even thought”),自回归模型仍有两个问题:推理偏慢,以及探索偏差。推理偏慢是因为推断当前帧时仍依赖先前帧,因而推理仍是逐步的;探索偏差则来自自回归误差的累积。我们可以通过构建非自回归模型一并解决这两个问题,这也是当时正在进行的研究。

7 Acknowledgments

7 致谢

This work is supported in part by National Science Foundation of China under Grant No.61572113, and the Fundamental Research Funds for the Central Universities under Grants No.ZYGX2015J155, ZYGX2016J084, ZYGX2016J195.

本工作部分得到国家自然科学基金(批准号 61572113)以及中央高校基本科研业务费(批准号 ZYGX2015J155、ZYGX2016J084、ZYGX2016J195)的资助。

References

参考文献

Bahdanau, D.; Cho, K.; and Bengio, Y. 2014. Neural machine translation by jointly learning to align and translate. arXiv preprint arXiv:1409.0473.

Black, A. W., and Taylor, P. 1997. Automatically clustering similar units for unit selection in speech synthesis. In Fifth European Conference on Speech Communication and Technology.

Charpentier, F., and Stella, M. 1986. Diphone synthesis using an overlap-add technique for speech waveforms concatenation. In Acoustics, Speech, and Signal Processing, IEEE International Conference on ICASSP’86., volume 11, 2015–2018. IEEE.

Cho, K.; Van Merrienboer, B.; Gulcehre, C.; Bahdanau, D.; Bougares, F.; Schwenk, H.; and Bengio, Y. 2014. Learning phrase representations using rnn encoder-decoder for statistical machine translation. Computer Science.

Chorowski, J. K.; Bahdanau, D.; Serdyuk, D.; Cho, K.; and Bengio, Y. 2015. Attention-based models for speech recognition. In Advances in neural information processing systems, 577–585.

Gehring, J.; Auli, M.; Grangier, D.; Yarats, D.; and Dauphin, Y. N. 2017. Convolutional sequence to sequence learning. arXiv preprint arXiv:1705.03122.

Griffin, D., and Lim, J. 1984. Signal estimation from modified short-time fourier transform. IEEE Transactions on Acoustics, Speech, and Signal Processing 32(2):236–243.

Hochreiter, S., and Schmidhuber, J. 1997. Long short-term memory. Neural computation 9(8):1735–1780.

Hunt, A. J., and Black, A. W. 1996. Unit selection in a concatenative speech synthesis system using a large speech database. In Acoustics, Speech, and Signal Processing, 1996. ICASSP-96. Conference Proceedings., 1996 IEEE International Conference on, volume 1, 373–376. IEEE.

Kalchbrenner, N.; Espeholt, L.; Simonyan, K.; Oord, A. v. d.; Graves, A.; and Kavukcuoglu, K. 2016. Neural machine translation in linear time. arXiv preprint arXiv:1610.10099.

Kingma, D. P.; Salimans, T.; Jozefowicz, R.; Chen, X.; Sutskever, I.; and Welling, M. 2016. Improved variational inference with inverse autoregressive flow. In Advances in Neural Information Processing Systems, 4743–4751.

Mehri, S.; Kumar, K.; Gulrajani, I.; Kumar, R.; Jain, S.; Sotelo, J.; Courville, A.; and Bengio, Y. 2016. Samplernn: An unconditional end-to-end neural audio generation model. arXiv preprint arXiv:1612.07837.

Oord, A. v. d.; Li, Y.; Babuschkin, I.; Simonyan, K.; Vinyals, O.; Kavukcuoglu, K.; Driessche, G. v. d.; Lockhart, E.; Cobo, L. C.; Stimberg, F.; et al. 2017. Parallel wavenet: Fast high-fidelity speech synthesis. arXiv preprint arXiv:1711.10433.

Ping, W.; Peng, K.; and Chen, J. 2018. Clarinet: Parallel wave generation in end-to-end text-to-speech. arXiv preprint arXiv:1807.07281.

Shen, J.; Pang, R.; Weiss, R. J.; Schuster, M.; Jaitly, N.; Yang, Z.; Chen, Z.; Zhang, Y.; Wang, Y.; Skerry-Ryan, R.; et al. 2017. Natural tts synthesis by conditioning wavenet on mel spectrogram predictions. arXiv preprint arXiv:1712.05884.

Sotelo, J.; Mehri, S.; Kumar, K.; Santos, J. F.; Kastner, K.; Courville, A.; and Bengio, Y. 2017. Char2wav: End-to-end speech synthesis. ICLR 2017 workshop.

Sutskever, I.; Vinyals, O.; and Le, Q. V. 2014. Sequence to sequence learning with neural networks. In Advances in neural information processing systems, 3104–3112.

Taigman, Y.; Wolf, L.; Polyak, A.; and Nachmani, E. 2018. Voiceloop: Voice fitting and synthesis via a phonological loop. In International Conference on Learning Representations.

Tokuda, K.; Yoshimura, T.; Masuko, T.; Kobayashi, T.; and Kitamura, T. 2000. Speech parameter generation algorithms for hmm-based speech synthesis. In Acoustics, Speech, and Signal Processing, 2000. ICASSP’00. Proceedings. 2000 IEEE International Conference on, volume 3, 1315–1318. IEEE.

Tokuda, K.; Nankaku, Y.; Toda, T.; Zen, H.; Yamagishi, J.; and Oura, K. 2013. Speech synthesis based on hidden markov models. Proceedings of the IEEE 101(5):1234–1252.

Van Den Oord, A.; Dieleman, S.; Zen, H.; Simonyan, K.; Vinyals, O.; Graves, A.; Kalchbrenner, N.; Senior, A. W.; and Kavukcuoglu, K. 2016. Wavenet: A generative model for raw audio. In SSW, 125.

Vaswani, A.; Shazeer, N.; Parmar, N.; Uszkoreit, J.; Jones, L.; Gomez, A. N.; Kaiser, Ł.; and Polosukhin, I. 2017. Attention is all you need. In Advances in Neural Information Processing Systems, 5998–6008.

Verhelst, W., and Roelands, M. 1993. An overlap-add technique based on waveform similarity (wsola) for high quality time-scale modification of speech. In Acoustics, Speech, and Signal Processing, 1993. ICASSP-93., 1993 IEEE International Conference on, volume 2, 554–557. IEEE.

Viterbi, A. 1967. Error bounds for convolutional codes and an asymptotically optimum decoding algorithm. IEEE transactions on Information Theory 13(2):260–269.

Wang, Y.; Skerry-Ryan, R.; Stanton, D.; Wu, Y.; Weiss, R. J.; Jaitly, N.; Yang, Z.; Xiao, Y.; Chen, Z.; Bengio, S.; et al. 2017. Tacotron: A fully end-to-end text-to-speech synthesis model. arXiv preprint.

Ze, H.; Senior, A.; and Schuster, M. 2013. Statistical parametric speech synthesis using deep neural networks. In Acoustics, Speech and Signal Processing (ICASSP), 2013 IEEE International Conference on, 7962–7966. IEEE.

Zen, H.; Tokuda, K.; and Black, A. W. 2009. Statistical parametric speech synthesis. Speech Communication 51(11):1039–1064.

Zhang, H.; Goodfellow, I.; Metaxas, D.; and Odena, A. 2018. Self-attention generative adversarial networks. arXiv preprint arXiv:1805.08318.

Zhou, S.; Dong, L.; Xu, S.; and Xu, B. 2018a. A comparison of modeling units in sequence-to-sequence speech recognition with the transformer on mandarin chinese. arXiv preprint arXiv:1805.06239.

Zhou, S.; Dong, L.; Xu, S.; and Xu, B. 2018b. Syllable-based sequence-to-sequence speech recognition with the transformer in mandarin chinese. arXiv preprint arXiv:1804.10752.