python语音合成 标贝_GitHub - jiev/Tacotron-2-Chinese: 中文语音合成,改自 https://github.com/Rayhane-mamah/Tacotron-...

该博客介绍了如何使用 Tacotron-2-Chinese 进行中文语音合成,包括预训练模型下载、依赖安装、数据预处理、模型训练、语音合成等步骤。特别地,该模型使用了标贝数据集,并通过ffmpeg将音频采样率降低到36KHz。

Tacotron-2-Chinese 中文语音合成

预训练模型下载

仅 Tacotron 频谱预测部分,无 WaveNet 声码器(实验中),可用 Griffin-Lim 合成语音(见下)。

使用标贝数据集训练,为避免爆显存用了 ffmpeg 把语料的采样率从 48KHz 降到了 36KHz,听感基本无区别。

安装依赖

安装 Python 3 和 Tensorflow 1.10(在 Tensorflow 1.14 上用 WaveNet 会有Bug,在 1.10 上正常)。

安装依赖:

apt-get install -y libasound-dev portaudio19-dev libportaudio2 libportaudiocpp0 ffmpeg libav-tools

若 libav-tools 安装失败则手动安装:

wget http://launchpadlibrarian.net/339874908/libav-tools_3.3.4-2_all.deb

dpkg -i libav-tools_3.3.4-2_all.deb

安装 requirements:

pip install -r requirements.txt

训练模型

下载 标贝数据集,解压至 Tacotron-2-Chinese 文件夹根目录。目录结构如下:

Tacotron-2-Chinese

|- BZNSYP

|- PhoneLabeling

|- ProsodyLabeling

|- Wave

用 ffmpeg 把 /BZNSYP/Wave/ 中的 wav 的采样率降到36KHz:

ffmpeg.exe -i 输入.wav -ar 36000 输出.wav

预处理数据:

python preprocess.py --dataset='Biaobei'

训练模型(自动从最新 Checkpoint 继续):

python train.py --model='Tacotron-2'

合成语音

用根目录的 sentences.txt 中的文本合成语音。

python synthesize.py --model='Tacotron-2' --text_list='sentences.txt'

若无 WaveNet 模型,仅有频谱预测模型,则仅由 Griffin-Lim 生成语音,输出至 /tacotron_output/logs-eval/wavs/ 文件夹中。

若有 WaveNet 模型,则 WaveNet 生成的语音位于 /wavenet_output/wavs/ 中。

Tacotron-2:

Tensorflow implementation of DeepMind's Tacotron-2. A deep neural network architecture described in this paper: Natural TTS synthesis by conditioning Wavenet on MEL spectogram predictions

This Repository contains additional improvements and attempts over the paper, we thus propose paper_hparams.py file which holds the exact hyperparameters to reproduce the paper results without any additional extras.

Suggested hparams.py file which is default in use, contains the hyperparameters with extras that proved to provide better results in most cases. Feel free to toy with the parameters as needed.

DIFFERENCES WILL BE HIGHLIGHTED IN DOCUMENTATION SHORTLY.

Repository Structure:

Tacotron-2

├── datasets

├── en_UK(0)

│   └── by_book

│   └── female

├── en_US(0)

│   └── by_book

│   ├

中文词向量(Chinese Word Vectors)是自然语言处理(NLP)中非常重要的一种技术,用于将中文词语表示为向量形式,以便于计算机进行处理和分析。GitHub上的这个项目(https://github.com/Embedding/Chinese-Word-Vectors)提供了一个大规模的中文词向量数据集,并附有详细的使用说明文档(README_zh.md)。 以下是如何使用该项目的基本步骤: 1. **克隆仓库**: 首先,你需要将这个GitHub仓库克隆到本地。使用以下命令: ```bash git clone https://github.com/Embedding/Chinese-Word-Vectors.git ``` 2. **阅读文档**: 克隆仓库后,进入目录并打开`README_zh.md`文件。这个文件包含了项目的详细介绍、安装步骤、使用方法以及示例代码。 3. **安装依赖**: 根据文档中的说明,安装所需的依赖包。通常情况下,你需要安装`gensim`库。可以使用以下命令安装: ```bash pip install gensim ``` 4. **下载词向量**: 在`README_zh.md`中,作者提供了多个预训练的词向量文件链接。你可以根据需要下载相应的文件。例如,下载一个中文维基百科的词向量文件: ```bash wget http://<文件下载链接> ``` 5. **加载词向量**: 使用`gensim`库加载下载的词向量文件。以下是一个示例代码: ```python from gensim.models import KeyedVectors # 加载词向量 model = KeyedVectors.load_word2vec_format('path/to/your/word_vectors.bin', binary=True) # 使用词向量 vector = model['中国'] similar_words = model.most_similar('中国') print(vector) print(similar_words) ``` 6. **使用词向量**: 你可以使用这些词向量进行各种NLP任务,如文本分类、情感分析、机器翻译等。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值