티스토리 뷰
반응형
DiffVoice: Text-to-Speech with Latent Diffusion
- Text-to-Speech 모델의 성능 향상을 위해 latent diffusion을 활용할 수 있음
- DiffVoice
- Adversarial training을 활용한 variational autoencoder를 통해 speech signal을 phoneme-rate representation으로 encode
- Diffusion model을 통한 latent representation과 duration의 joint modelling
- 논문 (ICASSP 2023) : Paper Link
1. Introduction
- Diffusion model은 합성 작업에서 뛰어난 성능을 보이고 있음
- Text-to-Speech (TTS)에서는 acoustic model에 적용되어 text input이 주어졌을 때, log mel-spectrogram을 생성함
- 이때 diffusion model을 사용하여
에 대한 data densityx0∈Rd 를 직접 modelling하는 것은 여러 문제점이 있음p(x0) - Intermediate latent variable
가xt 와 같은 shape을 가지도록 제한됨x0
- Diffusion sampling은 score estimator 에 대한 반복적인 평가를 필요로 하기 때문sθ(xt,t) - Diffusion model은
의 모든 mode를 capture 하려고 하므로, imperceptible detail에 대해 많은 modelling capacity를 소비함p(x0)
- Intermediate latent variable
- Latent Diffusion Model은 위 문제점들을 완화할 수 있음
- Encoder 을 적용하여 data를 latent codefϕ(⋅) 로 encoding 한 다음,z0=fϕ(x0)
- Diffusion model로 latent density 를 modelling하여 decoder로pϕ(z0) 를 생성 가능gψ(z0)
-> 그래서 Latent Diffusion Model을 기반으로한 diffusion TTS model인 DiffVoice를 제안
- DiffVoice
- VAE-GAN 기반의 autoencoder를 활용하여 time에 따른 down-sampling을 지원
- 이를 통해 mel-spectrogram 을 latent codey∈RN×Dmel 로 encodingz0∈RM×Dlatent
- : frame 수,N : phoneme 수M - Dynamic-rate down-sampling을 통해 latent space에서 single diffusion model을 사용하여 phoneme duration과 mel-spectrogram을 joint modelling
- 이때 phoneme duration이 다른 factor들과 함께 joint modelling되므로 generic inverse problem solving algorithm을 DiffVoice에 결합할 수 있음
- VAE-GAN 기반의 autoencoder를 활용하여 time에 따른 down-sampling을 지원
< Overall of DiffVoice >
- Adversarial training을 통해 speech signal을 phoneme-rate representation으로 encode
- Latent Diffusion Model을 활용하여 latent representation과 phoneme duration 간의 joint modelling을 지원
- 결과적으로 우수한 TTS 품질을 달성하고 zero-shot 문제로의 확장이 가능
2. DiffVoice
이 log mel-spectrogram이라고 하자.y∈RN×Dmel
- : frame 수,N : mel filter-bank sizeDmel
- 이때 은w∈ΣM 가 모든 phoneme의 집합이라고 했을 때, 해당하는 phoneme sequenceΣ
- Dynamic Down-Sampling of Speech
- DiffVoice는 Variational AutoEncoder (VAE)를 사용하여 speech를 compact latent space로 encoding 함
- DiffVoice는
와w 사이의 alignment를 얻기 위해 phoneme sequence에 대해 학습된 CTC based ASR model을 활용y
- Minimal-CTC를 사용하여 각 phoneme에 대해 단 하나의 sharp spike가 생성되도록 보장 의 각w=(wi)Mi=1 에 대해 CTC-alignment의 position은,wi 의a=(ai)Mi=1 ai
- 는 strictly increasing 하므로a ,a0:=0 로 둘 수 있음di:=(ai−ai−1)
- Positive sequence 은 phoneme duration을 포함d=(di)Mi=1 - 근사 posterior
는 다음과 같이 정의됨:qϕ(z0|y,a) - Encoder Conformer에 의해
를 처리한 다음,y - Output frame-rate latent representation
는 framee∈RN×Denc 에서 값을 gathering 하여,(ai)Mi=1 로 down-sampling 됨˜e∈RM×Denc - 이후
는 linear projection 된 다음 split 되어 평균˜e 와 log 분산μ∈RM×Dlatent 를 생성logσ∈RM×Dlatent - 최종적으로
는:z0∈RM×Dlatent qϕ(z0|y,a):=N(z0;μ,σ)=∏Mi=1∏Dlatentk=1N((z0)i,k;μi,k,σi,k)
- Encoder Conformer에 의해
- 이때 prior
는 standard Normal density로써:p(z0) p(z0):=∏Mi=1∏Dlatentk=1N((z0)i,k;0,1) - Conditional density
는 다음과 같이 정의됨:pψ(y|z0,a)
가 alignmentz0∈RM×Dlatent 에 따라a 로 up-sampling 됨˜z0∈RN×Dlatent
- 이때 이고,∀1≤i≤M:(˜z0)ai,⋅=(z0)i,⋅ ∀j∉a:(˜z0)j,⋅=0 - 이후
는˜z0 를 얻기 위해 decoder conformer에 전달되고, 각 frame에서h∈RN×Ddec 로 linear projection 됨˜y∈RN×Dmel - 최종적으로
는:pψ pψ(y|z0,a):=∏Nj=1∏Dmelk=112bexp(−|yj,k−˜yj,k|b)
- : 학습을 조절하기 위한 hyper-parameterb∈(0,∞)
- 따라서 DiffVoice의 VAE는
를 최적화하여 학습됨LVAE=E(y,a)[Lϕ,ψ(y,a)]
-Lϕ,ψ(y,a)=−DKL(qϕ(z0|y,a)||p(z0))+Eqϕ(z0|y,a)logpψ(y|z0,a)
- DiffVoice는

- Adversarial Training
- 위의 최적화 식만을 사용하면 VAE는 high-frequency detail이 부족한 spectrogram을 생성하게 됨
- 따라서 DiffVoice VAE의 high-fidelity reconstruction을 보장하기 위해, adversarial loss를 추가
- Adversarial training은 VAE가 먼저 수렴한 다음 적용되고 sepctrogram decoder를 통해 수행됨
- Spectrogram decoder는 random initialized 2D convolution stack과 linear projection을 통해 spectrogram residual을 생성
- 이때 2D convolution은 spectral norm regularization에 의해 regularize 되고, leaky ReLU를 통해 interleave 됨
- Discriminator는 leaky ReLU에 의해 interleave 된 spectral norm regularization을 사용하는 2D convolution stack
- Stochastic map을
로, generator를(y,a)→ˆy 로, discriminator를G(y,a) 라 하자D(⋅) - Adversarial training을 위해 least square loss
와 feature matching lossLG,LD 를 사용하여LfeatG 를 학습G,D - 결과적으로 adversarial training을 위한 최종 loss
는Ladv 의 weighted sum:LG,LD,LfeatG,LVAE LD:=E(y,a)[∑j,k(Dj,k(y)−1)2]+E(y,a)[∑j,k(Dj,k(ˆy))2] LG:=E(y,a)[∑j,k(Dj,k(G(y,a))−1)2] LfeatG:=E(y,a)[1L∑Lℓ=11dℓ||D(ℓ)(y)−D(ℓ)(G(y,a))||1]
- Discriminator의 output은 2D matrix이고, 는Dj,k -th valuej,k
- Feature matching loss 에서LfeatG 은L 의 layer 수D
- 은D(ℓ) element가 있는 layerdℓ 의 hidden feature mapℓ
- Adversarial training을 위해 least square loss

- Latent Diffusion Model
- DiffVoice는 VAE가 완전히 학습된 후, weight를 freeze 하여 음성을 latent representation으로 encoding
- Diffusion model을 통해 integer duration sequence
를 modelling 하기 위해서d -
으로 sampling 하여 uniform dequantization을 적용한 다음,u∼Uniform[0,1)M 를 정의함˜d=d−u
- 추가적으로 분포를 normalize 하기 위해 선택된 constant 에c0,c1 를 취함lj:=log(˜dj+c0)+c1 - 이때
와l=(lj)Mj=1 의 concatentation을z0 로 정의하면,x0:=[l;z0]∈RM×(Dlatent+1) - Latent Diffusion Model은 density
에서 sampling을 수행하는 것을 목표로 함p0(x0|w)
-
- DiffVoice는 Variance Preserving SDE를 활용하여 generative modelling을 수행함
- 여기서 Ito SDE는:
dXt=12β(t)Xtdt+√β(t)dBt
- :Xt 에서의 random processRM×(D+1)
- 이고,t∈[0,1] :Bt -valued standard Brownian motionRM×(D+1) 라고 하면, Ito SDE에 대한 transition density는:ˉα(t):=exp(−∫t0β(s)ds) p0t(xt|x0,w)=N(xt;x0√ˉα(t),(1−ˉα(t))I) - Text를 condition으로 하는 score estimator
는,sθ(xt,t,w) 의 denoising score matching으로 학습되고, time에 따른 weightsθ(xt,t,w)≈∇xtlogpt(xt|w) 가 적용됨λt - 결과적으로 SDE 과정에 대한 loss
는:LSDE LSDE:=E{λtE(x0,w)Ext|x0[||sθ(xt,t,w)−∇xtlogp0t(xt|x0,w)||22]}
- 여기서 Ito SDE는:
- 추론 과정에서는,
- Latent Diffusion Model을 사용하여
에서p0(x0|w) 를 samplingx0 - 이후
를x0 과l 로 split 하고z0 에서 alignmentl 를 reconstruct 한 다음, spectrogram decoder를 통해a 에서 log mel-spectrogram(z0,a) 를 decodingˆy
- Latent Diffusion Model을 사용하여
- Diffusion model을 통해 integer duration sequence
- Solving Inverse Problems with DiffVoice
가 differentiable 할 때A 라고 가정하면,o=A(x0)∈RO ∇xtlogpt(xt|o,w)=∇xtlogpt(xt|w)+∇xtlogpt(o|xt,w) 에서 sampling 하기 위해서,p0(x0|o,w) 에 대한 estimator를 추가∇xtlogpt(o|xt,w) - 여기서
를 근사하는E[x0|xt,w] 는:πθ(xt,t,w) πθ(xt,t,w):=1√ˉα(t)(xt+(1−ˉα(t))sθ(xt,t,w)) - Weighting function
를 취하면:ξ(t):[0,1]→[0,∞) ∇xtlogpt(o|xt,w)≈−ξ(t)∇xt||A(πθ(xt,t,w))−A(x0)||22
- 여기서

3. Experiments
- Settings
- Dataset : LJSpeech, LibriTTS
- Comparisons : FastSpeech2, VITS, Grad-TTS
- Results
- Single Speaker Text-to-Speech
- LJSpeech dataset에 대해 single speaker TTS 품질을 비교
- MOS 측면에서 DiffVoice는 가장 우수한 합성 품질을 보임

- Multi-Speaker Text-to-Speech
- LibriTTS dataset에 대해 multi-speaker TTS 품질을 비교
- 마찬가지로 DiffVoice는 가장 우수한 합성 품질을 달성

- Utterance-level-X-vector를 활용하여 zero-shot adaptation 실험을 진행
- 이때 DiffVoice는 prompt-based zero-shot adaptation을 활용
- 결과적으로 zero-shot 환경에서도 DiffVoice는 가장 우수한 합성 품질을 보임

- Text-based Speech Editing
- RetrieverTTS와 비슷하게 text-based speech inpainting에 대한 성능 평가를 진행
- 결과적으로 DiffVoice가 speech inpainting에 대해서도 우수한 성능을 보임

반응형