Lecture 9
1
Transformers for TTS
People before 2017
People after 2017
Pre-requisites
2
TTS tasks
3
Motivation: more data
4
We want:
Data: sources
5
Main sources:
Data: pipeline
6
Conclusion: As we apply a lot of networks to our data, we will have a lot of errors. That’s why we need datasets to be big.
Data: datasets
Previous TTS datasets:
Current datasets:
7
Questions ?
8
Tacotron2 disadvantages
9
Tacotron is not suitable here…
Post Tacotron2 models
10
Flow based models
Transformer based models
Diffusion based models
- VITS, VITS2, so-VITS
- Grad-TTS
- ResGrad
- GuidedTTS 1,2
- StyleTTS 1,2
- Encodec, Descript, Soundstorm
- Vall-E, MQTTS
- AudioLM, Spear-TTS
- SpeechGPT, NaturalSpeech 1,2
Good for prosody-sensitive applications
Good for applications like conversion
Good for big noisy datasets
Motivation
11
Tacotron 2
Our LLM bros
Recap: encoder-only transformer (like BERT)
12
Encoder-only transformer
<bos>
I
a
cat
!
saw
I
saw
a
cat
!
<eos>
<eos>
<bos>
<msk>
<msk>
Recap: decoder-only transformer (like GPT)
13
Decoder-only transformer
<bos>
I
a
cat
!
saw
I
saw
a
cat
!
<eos>
Recap: decoder-only, teacher-forcing
14
Decoder-only transformer
<bos>
I
a
cat
!
saw
I
saw
a
rat
!
<eos>
Previously on speech_course …
15
Encoder
Decoder
Input wav
Restored wav
Quantizer encode
Quantizer decode
Codecs sequence
Consider they are almost identical
Recap: namings
16
Time
Index
Codec
Token
Layer
Questions ?
17
Pipeline
18
Seq2Seq
Encoder
Decoder
text
Discrete tokens
1. Encoder-decoder unsupervised training
2. Seq2seq (phonemes to tokens) supervised training
Previous lecture
Difference with NLP
19
Vall-E (microsoft, Jan 2023)
20
Vall-e: encodec
21
Input wav
Restored wav
Vall-e: encodec
22
Input wav
Restored wav
Vall-e: encodec
23
Input wav
Restored wav
Vall-E: Train AR stage
24
Decoder-only autoregressive model (like GPT)
Training
Phonemized text
<EOS>
Audio codes
<EOS>
Input
Output
AR = autoregressive
Vall-E: Train AR stage
25
Decoder-only autoregressive model (like GPT)
Training
Phonemized text
<EOS>
Vall-E: Train AR stage
26
Decoder-only autoregressive model (like GPT)
Training
Phonemized text
<EOS>
Vall-E: Train AR stage
27
Decoder-only autoregressive model (like GPT)
Training
Phonemized text
<EOS>
Vall-E: Train AR stage
28
Decoder-only autoregressive model (like GPT)
Training
Phonemized text
<EOS>
Vall-E: Train AR stage
29
Decoder-only autoregressive model (like GPT)
Training
Phonemized text
<EOS>
Vall-E: Train NAR stage
30
Encoder-only model (like BERT)
Training
Phonemized text
Reference audio
Sample random index in [2, 8]
j
NAR = non autoregressive
Vall-E: AR inference
31
Neural codec language model
Training
Phonemized text
<EOS>
Audio codes
<EOS>
Inference
Neural codec language model
Prompt text
<EOS>
Prompt codes
<EOS>
Reference text
Synthesized codes
Input
Output
Input
Output
Vall-E: inference AR & NAR stages
32
Time
Codes
AR (autoregressive)
NAR (non-autoregressive)
Questions ?
33
MQTTS (ByteDance, Feb 2023)
34
MQTTS: Architecture
35
Biometry model
Encoder
Decoder
Single attention
h
ɛ
l
ʊ
…
13
47
52
60
32
01
68
89
53
47
42
86
29
01
75
89
…
13
47
52
60
32
01
68
89
29
01
75
89
…
53
47
42
86
eos
eos
eos
eos
bos
bos
bos
bos
MQTTS: transducer
36
Big decoder
13
47
52
60
32
01
68
89
53
47
42
86
29
01
75
89
…
13
47
52
60
32
01
68
89
29
01
75
89
…
53
47
42
86
eos
eos
eos
eos
Sub-decoder
e0
e1
e2
e3
en
Decoder
MQTTS: Inference
37
…
Decoder
Cross-Attention and softmax
13
47
52
60
Embeddings from encoder
Training
MQTTS: Inference
38
…
Decoder
Cross-Attention and softmax
13
47
52
60
32
01
68
89
Embeddings from encoder
Training
MQTTS: Inference
39
…
Decoder
Cross-Attention and softmax
13
47
52
60
32
01
68
89
29
01
75
89
Embeddings from encoder
Training
MQTTS: Inference
40
…
Decoder
Cross-Attention and softmax
13
47
52
60
32
01
68
89
29
01
75
89
53
47
42
86
Embeddings from encoder
…
Training
MQTTS: Inference
41
…
Decoder
Cross-Attention and softmax
13
47
52
60
Embeddings from encoder
Inference
MQTTS: Inference
42
…
Decoder
Cross-Attention and softmax
13
47
52
60
32
01
68
89
Embeddings from encoder
Inference
When we spot that attention for first element is smaller than 1/N, we move the span
MQTTS: Inference
43
…
Decoder
Cross-Attention and softmax
13
47
52
60
32
01
68
89
29
01
75
89
Embeddings from encoder
Inference
MQTTS: Inference
44
…
Decoder
Cross-Attention and softmax
13
47
52
60
32
01
68
89
29
01
75
89
53
47
42
86
Embeddings from encoder
Inference
MQTTS: Inference
45
…
Decoder
Cross-Attention and softmax
13
47
52
60
32
01
68
89
29
01
75
89
53
47
42
86
Embeddings from encoder
…
Inference
Questions ?
46
Coffee break
47
AudioLM (Google, Sep 2022)
48
W2V-BERT: recap
49
Latent Features Encoder
(Convolutional network with striding)
z0
z1
z2
z3
zT-1
zT
…
Context Network
(Transformer encoder)
c0
c1
c2
c3
cT-1
cT
…
Time masking
(BERT like)
Quantization module
(Gumbel softmax trick)
Contrastive loss
(distinguish current masked positions label among others)
Waveform
Masking N% of latent vectors
(paper proposed 50%)
Masked latent
feature vector
Quantized target vectors
Quantized (audio) token IDs
Masked Language Model
loss
MLM Context Network
(Transformer encoder)
Architecture overview
Stolen slide from ASR II presentation
AudioLM: semantic and acoustic tokens
50
Soundstream | W2V-BERT |
Small and Fast, 31M params | Big and slow; 0.6B params model + kMeans clustering |
Reconstruction loss | Contrastive and MLM objective |
Acoustic tokens for good quality audio reconstruction | Semantic tokens with linguistic information |
Needed for high-quality audio synthesis | Needed to model long-term structure |
1s of audio -> 75 x 16 tokens; codebook_size=1024 | 1s audio -> 25 tokens, n_tokens=1024 |
AudioLM: pipeline
51
…
…
4
12
Coarse acoustic tokens
Fine acoustic tokens
AudioLM: demo
52
Questions ?
53
AudioLM(5/4)
54
Thoughts
- It is weird, that we can predict fine tokens only with coarse ones. If so, why does decoder learn this
- Continuations are logically reasonable !
AudioLM(5/4)
55
Thoughts
- It is weird, that we can predict fine tokens only with coarse ones. If so, why does decoder learn this
- Continuations are logically reasonable !
W2V-BERT
56
Spear-TTS (Google, Feb 2023)
57
Spear-TTS: pipeline
58
Audio 60kh
SoundStream
W2V-BERT
Audio 60kh
Problem: Few parallel data
Problem: 1-to-many mapping
AudioLM
G2P
Spear-TTS: reading
59
Encoder
Decoder
Cross-attention
Phonemes from G2P
Semantic tokens from W2V-BERT
Spear-TTS: reading
60
4. Pretrain model on synthesized data
3. Synthesize texts for big dataset
2. Train ASR model (semantic_tokens -> text)
5. Finetune model on parallel data
SPEAR-TTS: speaking
61
Speaker and prosody are inherited from the prompt
Speaker and prosody can very because of sampling
Unconditional inference
Conditional inference
Spear-TTS: what for…
62
SPEAR-TTS(5/4+): part1
63
Audio 60kh
SoundStream
W2V-BERT
Audio 60kh
Problem: Few parallel data
Problem: 1-to-many mapping
Questions ?
64
SpeechGPT (Fudan university, may 2023)
65
SpeechGPT
66
SpeechGPT: training
67
1. Modality adaptation
Decoder-only pretrained LLama
<bos>
I
a
cat
!
saw
<bos>
25
53
34
03
64
74
HuBERT
SpeechGPT: training
2. Cross-model instruction finetuning
68
SpeechGPT: training
3. Chain-of-Modality Instruction Fine-Tuning
69
SpeechGPT: result
70
SpeechGPT(3+/5)
71
Three steps training
- Expand the vocabulary of LLM
- Take speech only dataset
- Train on NTP for audio units only2 .
2. Cross-modal Instruction Fine-Tuning
- We take ASR and TTS datasets with speech-text pairs
- We take GPT-4 and create 100 prompt for ASR and TTS part
- We compose
3. Chain-of-Modality Instruction Fine-Tuning
- Efficient fine tuning using LoRA method
- Take dialogue dataset, using TTS and ASR generate quadruplets (SpeechI, TextI, TextR, SpeechR)
- Sample from dataset a pair and train on it
Questions ?
72