How to run Bert-VITS2 on Intel CPU, iGPU, dGPU #396
feng-intel
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
How to run Bert-VITS2 on Intel CPU, iGPU, dGPU
Experienced platforms:
Focus on webui.py running.
1. Steps
Create conda env and install ipex, or use intel ipex xpu docker image
Refer to https://intel.github.io/intel-extension-for-pytorch/xpu/latest/tutorials/installation.html
Change requirements.txt and install
Then: $ pip install -r requirements.txt
Download models
Set webui config in default_config.yml as the below.
Notes:
Fix code
2. Performance improvement
Here troch.randn will affect the output of duration predictor. The y_lengths tensor value will be variable for the same text input. It will make the input dynamic shape for self.flow (TransformerCouplingBlock) and self.dec (Generator) . Dynamic shape will make performance drop. (We are continuously optimizing it)
If we set torch.manual_seed(seed=seed) before randn, it can make the duration predictor output fixed for the same length of text input. The reference code is in the below.
3. Models
emotional/clap-htsat-fused
Docs:
Input emotional text, such as happy, output audio embedding
CLAP paper https://arxiv.org/abs/2211.06687
CLIP https://github.com/openai/CLIP
./emotional/clap-htsat-fused/README.md
model load and inference
g2pw
Erlangshen-MegatronBert
中文 BERT 模型,这个模型的编码器结构为主,专注于解决各种自然语言理解任务。它同时,鉴于中文语法和大规模训练的难度,使用了四种预训练策略来改进 BERT,Erlangshen-MegatronBert 模型适用于各种自然语言理解任务,包括文本生成、文本分类、问答等,这个模型的权重和代码都是开源的,可以在 Hugging Face 和 CSDN 博客等平台上找到。Erlangshen-MegatronBert 模型可以应用于多种领域,如 AI 模拟声音、数字人虚拟主播等。 有三个参数选择,有710m和1.3b以及3.9B, 这里选择了居中的1.3b大模型。
Bert-vits2 中文特化底模
融合了BERT的预训练能力与VITS2的微调技术,旨在实现高质量的个性化语音合成。该模型能够处理多种自然语言处理任务,如文本转语音(TTS),并支持不同语言的语音合成,特别是中文和日语。通过结合Transformer架构,Bert-VITS2能够生成高度自然、具有个性特色的语音。
由于文本到语音的任务特点,解决方案也可以是复杂的。之前的工作通过将从输入文本生成波形的过程分为两个级联阶段来解决这些问题。一种流行的方法涉及从第一阶段的输入文本中生成中间语音表示,如梅尔语谱图或语言特征,然后以第二阶段的这些中间表示为条件生成原始波形。两级系统具有简化每个模型和便于训练的优点;然而,它们也有以下限制。1)错误从第一阶段传播到第二阶段。2)它不是利用模型内部学习到的表示,而是通过人类定义的特征(如梅尔语谱图或语言特征)进行中介。3)生成中间特征所需的计算量。最近,为了解决这些限制,直接从输入文本中生成波形的单阶段模型已被积极研究。单阶段模型不仅优于两阶段管道系统,而且显示了生成与人类几乎不可区分的高质量语音的能力。
VITS模型(Variational Inference Text-to-Speech):Variational Inference with adversarial learning for end-to-end Text-to-Speech, 它是一种结合变分推理(variational inference)、标准化流(normalizing flows)和对抗训练的高性能语音合成模型。VITS通过隐变量而非频谱串联起语音合成的声学模型和声码器,并在隐变量上执行随机建模以及随机时长预测器,以此提高合成语音的多样性。VITS模型在训练时会生成梅尔频谱以指导模型训练,但在推理时不需要生成梅尔频谱,而是使用线性谱作为输入。此外,VITS模型采用了基于标准化的流模型(normalizing flows)的变分推理(variational inference)策略和对抗学习策略来提升生成模型的表现力。
4. Pipeline
Beta Was this translation helpful? Give feedback.
All reactions