Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Parakeet
提交
47915461
P
Parakeet
项目概览
PaddlePaddle
/
Parakeet
通知
8
Star
3
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
19
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Parakeet
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
19
Issue
19
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
47915461
编写于
7月 28, 2020
作者:
Y
Yibing Liu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Adapt waveflow to internal dataset
上级
e58e927c
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
9 addition
and
7 deletion
+9
-7
examples/waveflow/data.py
examples/waveflow/data.py
+1
-4
parakeet/models/waveflow/waveflow_modules.py
parakeet/models/waveflow/waveflow_modules.py
+8
-3
未找到文件。
examples/waveflow/data.py
浏览文件 @
47915461
...
...
@@ -35,8 +35,7 @@ class Dataset(ljspeech.LJSpeech):
fname
,
_
,
_
=
metadatum
wav_path
=
os
.
path
.
join
(
self
.
root
,
"wavs"
,
fname
+
".wav"
)
loaded_sr
,
audio
=
read
(
wav_path
)
assert
loaded_sr
==
self
.
config
.
sample_rate
audio
,
loaded_sr
=
librosa
.
load
(
wav_path
,
sr
=
self
.
config
.
sample_rate
)
return
audio
...
...
@@ -91,8 +90,6 @@ class Subset(DatasetMixin):
mode
=
'constant'
,
constant_values
=
0
)
# Normalize audio to the [-1, 1] range.
audio
=
audio
.
astype
(
np
.
float32
)
/
32768.0
mel
=
self
.
get_mel
(
audio
)
return
audio
,
mel
...
...
parakeet/models/waveflow/waveflow_modules.py
浏览文件 @
47915461
...
...
@@ -62,9 +62,8 @@ class WaveFlowLoss:
class
Conditioner
(
dg
.
Layer
):
def
__init__
(
self
,
dtype
):
def
__init__
(
self
,
dtype
,
upsample_factors
):
super
(
Conditioner
,
self
).
__init__
()
upsample_factors
=
[
16
,
16
]
self
.
upsample_conv2d
=
[]
for
s
in
upsample_factors
:
...
...
@@ -296,11 +295,13 @@ class WaveFlowModule(dg.Layer):
self
.
n_flows
=
config
.
n_flows
self
.
n_group
=
config
.
n_group
self
.
n_layers
=
config
.
n_layers
self
.
upsample_factors
=
config
.
upsample_factors
if
hasattr
(
config
,
"upsample_factors"
)
else
[
16
,
16
]
assert
self
.
n_group
%
2
==
0
assert
self
.
n_flows
%
2
==
0
self
.
dtype
=
"float16"
if
config
.
use_fp16
else
"float32"
self
.
conditioner
=
Conditioner
(
self
.
dtype
)
self
.
conditioner
=
Conditioner
(
self
.
dtype
,
self
.
upsample_factors
)
self
.
flows
=
[]
for
i
in
range
(
self
.
n_flows
):
flow
=
Flow
(
config
)
...
...
@@ -397,6 +398,10 @@ class WaveFlowModule(dg.Layer):
if
self
.
dtype
==
"float16"
:
mel
=
fluid
.
layers
.
cast
(
mel
,
self
.
dtype
)
mel
=
self
.
conditioner
.
infer
(
mel
)
# Prune out the tail of mel so that time/n_group == 0.
pruned_len
=
int
(
mel
.
shape
[
2
]
//
self
.
n_group
*
self
.
n_group
)
if
mel
.
shape
[
2
]
>
pruned_len
:
mel
=
mel
[:,
:,
:
pruned_len
]
# From [bs, mel_bands, time] to [bs, mel_bands, n_group, time/n_group]
mel
=
fluid
.
layers
.
transpose
(
unfold
(
mel
,
self
.
n_group
),
[
0
,
1
,
3
,
2
])
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录