[add]Sichuan model pth

This commit is contained in:
root
2023-01-03 16:06:54 +08:00
parent b280b5dbd7
commit 1b91ff809f
11 changed files with 518 additions and 6 deletions

173
README.md
View File

@ -1,9 +1,170 @@
---
tasks:
- text-to-speech
domain:
- audio
frameworks:
- pytorch
backbone:
- transformer
metrics:
- MOS
license: Apache License 2.0
tags:
- Alibaba
- tts
- hifigan
- sambert
- text-to-speech
- Sichuan
- 16k
widgets:
- task: text-to-speech
inputs:
- type: text
name: input
title: 文本
validator:
max_words: 300
examples:
- name: 1
title: 示例1
inputs:
- name: input
data: 北京今天天气怎么样
inferencespec:
cpu: 4 #CPU数量
memory: 8192
gpu: 1 #GPU数量
gpu_memory: 8192
---
###### 该模型当前使用的是默认介绍模版,处于“预发布”阶段,页面仅限所有者可见。
###### 请根据[模型贡献文档说明](https://www.modelscope.cn/docs/%E5%A6%82%E4%BD%95%E6%92%B0%E5%86%99%E5%A5%BD%E7%94%A8%E7%9A%84%E6%A8%A1%E5%9E%8B%E5%8D%A1%E7%89%87)及时完善模型卡片内容。ModelScope平台将在模型卡片完善后展示。谢谢您的理解。
#### Clone with HTTP
```bash
git clone https://www.modelscope.cn/speech_tts/speech_sambert-hifigan_tts_chuangirl_Sichuan_16k.git
```
# Sambert-Hifigan模型介绍
## 框架描述
拼接法和参数法是两种Text-To-Speech(TTS)技术路线。近年来参数TTS系统获得了广泛的应用故此处仅涉及参数法。
参数TTS系统可分为两大模块前端和后端。
前端包含文本正则、分词、多音字预测、文本转音素和韵律预测等模块,它的功能是把输入文本进行解析,获得音素、音调、停顿和位置等语言学特征。
后端包含时长模型、声学模型和声码器,它的功能是将语言学特征转换为语音。其中,时长模型的功能是给定语言学特征,获得每一个建模单元(例如:音素)的时长信息;声学模型则基于语言学特征和时长信息预测声学特征;声码器则将声学特征转换为对应的语音波形。
其系统结构如[图1]所示:
![系统结构](description/tts-system.jpg)
前端模块我们采用模型结合规则的方式灵活处理各种场景下的文本后端模块则采用SAM-BERT + HIFIGAN提供高表现力的流式合成效果。
### 声学模型SAM-BERT
后端模块中声学模型采用自研的SAM-BERT,将时长模型和声学模型联合进行建模。结构如[图2]所示
```
1. Backbone采用Self-Attention-Mechanism(SAM),提升模型建模能力。
2. Encoder部分采用BERT进行初始化引入更多文本信息提升合成韵律。
3. Variance Adaptor对音素级别的韵律(基频、能量、时长)轮廓进行粗粒度的预测再通过decoder进行帧级别细粒度的建模;并在时长预测时考虑到其与基频、能量的关联信息,结合自回归结构,进一步提升韵律自然度.
4. Decoder部分采用PNCA AR-Decoder[@li2020robutrans],自然支持流式合成。
```
![SAMBERT结构](description/sambert.jpg)
### 声码器模型:HIFI-GAN
后端模块中声码器采用HIFI-GAN, 基于GAN的方式利用判别器(Discriminator)来指导声码器(即生成器Generator)的训练相较于经典的自回归式逐样本点CE训练, 训练方式更加自然,在生成效率和效果上具有明显的优势。其系统结构如[图3]所示:
![系统结构](description/hifigan.jpg)
在HIFI-GAN开源工作[1]的基础上我们针对16k, 48k采样率下的模型结构进行了调优设计并提供了基于因果卷积的低时延流式生成和chunk流式生成机制可与声学模型配合支持CPU、GPU等硬件条件下的实时流式合成。
## 使用方式和范围
使用方式:
* 直接输入文本进行推理
使用范围:
* 适用于四川话的语音合成场景输入文本使用utf-8编码整体长度建议不超过30字
目标场景:
* 各种语音合成任务,比如配音,虚拟主播,数字人等
### 如何使用
目前仅支持Linux使用暂不支持Windows及Mac使用。
请结合[KAN-TTS](https://github.com/AlibabaResearch/KAN-TTS)代码进行finetune。具体使用方法参考
[sambert训练教程](https://github.com/AlibabaResearch/KAN-TTS/wiki/training_sambert)
[hifigan训练教程](https://github.com/AlibabaResearch/KAN-TTS/wiki/training_hifigan)
MaaS-lib暂未支持本模型训练敬请期待。
#### 代码范例
```Python
from scipy.io.wavfile import write
from modelscope.outputs import OutputKeys
from modelscope.pipelines import pipeline
from modelscope.utils.constant import Tasks
text = '待合成文本'
model_id = 'speech_tts/speech_sambert-hifigan_tts_zh-cn_multisp_pretrain_16k'
sambert_hifigan_tts = pipeline(task=Tasks.text_to_speech, model=model_id, model_revision='v1.0.0')
output = sambert_hifigan_tts(input=text)
pcm = output[OutputKeys.OUTPUT_PCM]
write('output.wav', 16000, pcm)
```
### 模型局限性以及可能的偏差
* 该发音人支持四川话TN规则为中文
## 训练数据介绍
使用单一发音人共计约11.2小时数据训练, 主要为四川话。
## 模型训练流程
模型所需训练数据格式为:音频(.wav), 文本标注(.txt), 音素时长标注(.interval), 随机初始化训练要求训练数据规模在2小时以上对于2小时以下的数据集需使用多人预训练模型进行参数初始化。其中AM模型训练时间需要12天Vocoder模型训练时间需要57天。
### 预处理
模型训练需对音频文件提取声学特征(梅尔频谱)音素时长根据配置项中的帧长将时间单位转换成帧数文本标注根据配置项中的音素集、音调分类、边界分类转换成对应的one-hot编号
## 引用
如果你觉得这个该模型对有所帮助,请考虑引用下面的相关的论文:
```BibTeX
@inproceedings{li2020robutrans,
title={Robutrans: A robust transformer-based text-to-speech model},
author={Li, Naihan and Liu, Yanqing and Wu, Yu and Liu, Shujie and Zhao, Sheng and Liu, Ming},
booktitle={Proceedings of the AAAI Conference on Artificial Intelligence},
volume={34},
number={05},
pages={8228--8235},
year={2020}
}
```
```BibTeX
@article{devlin2018bert,
title={Bert: Pre-training of deep bidirectional transformers for language understanding},
author={Devlin, Jacob and Chang, Ming-Wei and Lee, Kenton and Toutanova, Kristina},
journal={arXiv preprint arXiv:1810.04805},
year={2018}
}
```
```BibTeX
@article{kong2020hifi,
title={Hifi-gan: Generative adversarial networks for efficient and high fidelity speech synthesis},
author={Kong, Jungil and Kim, Jaehyeon and Bae, Jaekyoung},
journal={Advances in Neural Information Processing Systems},
volume={33},
pages={17022--17033},
year={2020}
}
```
本模型参考了以下实现
- [1] [ming024's FastSpeech2 Implementation](https://github.com/ming024/FastSpeech2)
- [2] [jik876/hifi-gan](https://github.com/jik876/hifi-gan)
- [3] [kan-bayashi/ParallelWaveGAN](https://github.com/kan-bayashi/ParallelWaveGAN)
- [4] [mozilla/TTS](https://github.com/mozilla/TTS)
- [5] [espnet/espnet](https://github.com/espnet/espnet)