Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
DeepSpeech
提交
caa391f4
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看板
未验证
提交
caa391f4
编写于
1月 12, 2022
作者:
小湉湉
提交者:
GitHub
1月 12, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix speedyspeech inference, test=tts (#1322)
上级
0c4895cd
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
9 addition
and
26 deletion
+9
-26
paddlespeech/t2s/models/speedyspeech/speedyspeech.py
paddlespeech/t2s/models/speedyspeech/speedyspeech.py
+9
-26
未找到文件。
paddlespeech/t2s/models/speedyspeech/speedyspeech.py
浏览文件 @
caa391f4
...
@@ -11,7 +11,6 @@
...
@@ -11,7 +11,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# See the License for the specific language governing permissions and
# limitations under the License.
# limitations under the License.
import
numpy
as
np
import
paddle
import
paddle
from
paddle
import
nn
from
paddle
import
nn
...
@@ -23,18 +22,16 @@ def expand(encodings: paddle.Tensor, durations: paddle.Tensor) -> paddle.Tensor:
...
@@ -23,18 +22,16 @@ def expand(encodings: paddle.Tensor, durations: paddle.Tensor) -> paddle.Tensor:
encodings: (B, T, C)
encodings: (B, T, C)
durations: (B, T)
durations: (B, T)
"""
"""
batch_size
,
t_enc
=
durations
.
shape
batch_size
,
t_enc
=
paddle
.
shape
(
durations
)
durations
=
durations
.
numpy
()
slens
=
paddle
.
sum
(
durations
,
-
1
)
slens
=
np
.
sum
(
durations
,
-
1
)
t_dec
=
paddle
.
max
(
slens
)
t_dec
=
np
.
max
(
slens
)
M
=
paddle
.
zeros
([
batch_size
,
t_dec
,
t_enc
])
M
=
np
.
zeros
([
batch_size
,
t_dec
,
t_enc
])
for
i
in
range
(
batch_size
):
for
i
in
range
(
batch_size
):
k
=
0
k
=
0
for
j
in
range
(
t_enc
):
for
j
in
range
(
t_enc
):
d
=
durations
[
i
,
j
]
d
=
durations
[
i
,
j
]
M
[
i
,
k
:
k
+
d
,
j
]
=
1
M
[
i
,
k
:
k
+
d
,
j
]
=
1
k
+=
d
k
+=
d
M
=
paddle
.
to_tensor
(
M
,
dtype
=
encodings
.
dtype
)
encodings
=
paddle
.
matmul
(
M
,
encodings
)
encodings
=
paddle
.
matmul
(
M
,
encodings
)
return
encodings
return
encodings
...
@@ -234,28 +231,14 @@ class SpeedySpeech(nn.Layer):
...
@@ -234,28 +231,14 @@ class SpeedySpeech(nn.Layer):
encodings
=
self
.
encoder
(
text
,
tones
,
spk_id
)
encodings
=
self
.
encoder
(
text
,
tones
,
spk_id
)
if
type
(
durations
)
==
type
(
None
):
if
durations
is
None
:
pred_durations
=
self
.
duration_predictor
(
encodings
)
# (1, T)
# (1, T)
pred_durations
=
self
.
duration_predictor
(
encodings
)
durations_to_expand
=
paddle
.
round
(
pred_durations
.
exp
())
durations_to_expand
=
paddle
.
round
(
pred_durations
.
exp
())
durations_to_expand
=
(
durations_to_expand
).
astype
(
paddle
.
int64
)
durations_to_expand
=
durations_to_expand
.
astype
(
paddle
.
int64
)
slens
=
paddle
.
sum
(
durations_to_expand
,
-
1
)
# [1]
t_dec
=
slens
[
0
]
# [1]
t_enc
=
paddle
.
shape
(
pred_durations
)[
-
1
]
M
=
paddle
.
zeros
([
1
,
t_dec
,
t_enc
])
k
=
paddle
.
full
([
1
],
0
,
dtype
=
paddle
.
int64
)
for
j
in
range
(
t_enc
):
d
=
durations_to_expand
[
0
,
j
]
# If the d == 0, slice action is meaningless and not supported
if
d
>=
1
:
M
[
0
,
k
:
k
+
d
,
j
]
=
1
k
+=
d
encodings
=
paddle
.
matmul
(
M
,
encodings
)
else
:
else
:
durations_to_expand
=
durations
durations_to_expand
=
durations
encodings
=
expand
(
encodings
,
durations_to_expand
)
encodings
=
expand
(
encodings
,
durations_to_expand
)
shape
=
paddle
.
shape
(
encodings
)
shape
=
paddle
.
shape
(
encodings
)
t_dec
,
feature_size
=
shape
[
1
],
shape
[
2
]
t_dec
,
feature_size
=
shape
[
1
],
shape
[
2
]
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录