Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
DeepSpeech
提交
05a6f776
D
DeepSpeech
项目概览
PaddlePaddle
/
DeepSpeech
大约 2 年 前同步成功
通知
210
Star
8425
Fork
1598
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
245
列表
看板
标记
里程碑
合并请求
3
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
DeepSpeech
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
245
Issue
245
列表
看板
标记
里程碑
合并请求
3
合并请求
3
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
05a6f776
编写于
11月 30, 2021
作者:
小湉湉
提交者:
GitHub
11月 30, 2021
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1052 from yt605155624/fix_docs
[TTS]update tts_tutorial
上级
100fdf24
c35457b8
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
34 addition
and
34 deletion
+34
-34
docs/tutorial/tts/tts_tutorial.ipynb
docs/tutorial/tts/tts_tutorial.ipynb
+34
-34
未找到文件。
docs/tutorial/tts/tts_tutorial.ipynb
浏览文件 @
05a6f776
...
...
@@ -252,7 +252,7 @@
},
{
"cell_type": "code",
"execution_count":
18
,
"execution_count":
25
,
"metadata": {
"scrolled": true
},
...
...
@@ -261,8 +261,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"The autoreload extension is already loaded. To reload it, use:\n",
" %reload_ext autoreload\n"
"env: CUDA_VISIBLE_DEVICES=0\n"
]
}
],
...
...
@@ -284,7 +283,7 @@
},
{
"cell_type": "code",
"execution_count":
19
,
"execution_count":
28
,
"metadata": {
"scrolled": true
},
...
...
@@ -317,7 +316,7 @@
},
{
"cell_type": "code",
"execution_count":
2
0,
"execution_count":
3
0,
"metadata": {
"scrolled": true
},
...
...
@@ -596,11 +595,19 @@
},
{
"cell_type": "code",
"execution_count": 3
2
,
"execution_count": 3
1
,
"metadata": {
"scrolled": true
},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Frontend done!\n"
]
}
],
"source": [
"# 传入 phones_dict 会把相应的 phones 转换成 phone_ids\n",
"frontend = Frontend(phone_vocab_path=phones_dict)\n",
...
...
@@ -619,25 +626,11 @@
},
{
"cell_type": "code",
"execution_count":
23
,
"execution_count":
35
,
"metadata": {
"scrolled": true
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"Building prefix dict from the default dictionary ...\n",
"DEBUG:jieba:Building prefix dict from the default dictionary ...\n",
"Loading model from cache /tmp/jieba.cache\n",
"DEBUG:jieba:Loading model from cache /tmp/jieba.cache\n",
"Loading model cost 5.331 seconds.\n",
"DEBUG:jieba:Loading model cost 5.331 seconds.\n",
"Prefix dict has been built successfully.\n",
"DEBUG:jieba:Prefix dict has been built successfully.\n"
]
},
{
"name": "stdout",
"output_type": "stream",
...
...
@@ -701,8 +694,10 @@
"<br></br>\n",
"在本教程中,我们使用 `FastSpeech2` 作为声学模型。\n",
"\n",
"\n",
"PaddleSpeech TTS 实现的 FastSpeech2 与论文不同的地方在于,我们使用的的是 phone 级别的 `pitch` 和 `energy`(与 FastPitch 类似)。\n",
"\n",
"\n",
"更多关于[声学模型的发展及改进](https://paddlespeech.readthedocs.io/en/latest/tts/models_introduction.html)。"
]
},
...
...
@@ -1020,13 +1015,16 @@
"odim = fastspeech2_config.n_mels\n",
"model = FastSpeech2(\n",
" idim=vocab_size, odim=odim, **fastspeech2_config[\"model\"])\n",
"\n",
"model.set_state_dict(paddle.load(fastspeech2_checkpoint)[\"main_params\"]) # 加载预训练模型参数\n",
"model.eval() # 推理阶段不启用 batch norm 和 dropout\n",
"# 加载预训练模型参数\n",
"model.set_state_dict(paddle.load(fastspeech2_checkpoint)[\"main_params\"])\n",
"# 推理阶段不启用 batch norm 和 dropout\n",
"model.eval()\n",
"stat = np.load(fastspeech2_stat)\n",
"mu, std = stat # 读取数据预处理阶段数据集的均值和标准差\n",
"# 读取数据预处理阶段数据集的均值和标准差\n",
"mu, std = stat\n",
"mu, std = paddle.to_tensor(mu), paddle.to_tensor(std)\n",
"fastspeech2_normalizer = ZScore(mu, std) # 构造归一化的新模型\n",
"# 构造归一化的新模型\n",
"fastspeech2_normalizer = ZScore(mu, std)\n",
"fastspeech2_inference = FastSpeech2Inference(fastspeech2_normalizer, model)\n",
"fastspeech2_inference.eval()\n",
"print(fastspeech2_inference)\n",
...
...
@@ -1153,16 +1151,18 @@
],
"source": [
"vocoder = PWGGenerator(**pwg_config[\"generator_params\"])\n",
"\n",
"vocoder.set_state_dict(paddle.load(pwg_checkpoint)[\"generator_params\"])
# 模型加载预训练参数
\n",
"
# 模型加载预训练参数
\n",
"vocoder.set_state_dict(paddle.load(pwg_checkpoint)[\"generator_params\"]) \n",
"vocoder.remove_weight_norm()\n",
"vocoder.eval() # 推理阶段不启用 batch norm 和 dropout\n",
"\n",
"stat = np.load(pwg_stat) # 读取数据预处理阶段数据集的均值和标准差\n",
"# 推理阶段不启用 batch norm 和 dropout\n",
"vocoder.eval()\n",
"# 读取数据预处理阶段数据集的均值和标准差\n",
"stat = np.load(pwg_stat)\n",
"mu, std = stat\n",
"mu, std = paddle.to_tensor(mu), paddle.to_tensor(std)\n",
"pwg_normalizer = ZScore(mu, std)\n",
"pwg_inference = PWGInference(pwg_normalizer, vocoder) # 构建归一化的模型\n",
"# 构建归一化的模型\n",
"pwg_inference = PWGInference(pwg_normalizer, vocoder)\n",
"pwg_inference.eval()\n",
"print(\"Parallel WaveGAN done!\")"
]
...
...
@@ -1266,7 +1266,7 @@
},
{
"cell_type": "code",
"execution_count":
40
,
"execution_count":
36
,
"metadata": {},
"outputs": [
{
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录