Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Parakeet
提交
bf6d9ef0
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看板
提交
bf6d9ef0
编写于
8月 07, 2020
作者:
走神的阿圆
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add visualdl for parakeet
上级
e58e927c
变更
15
隐藏空白更改
内联
并排
Showing
15 changed file
with
77 addition
and
47 deletion
+77
-47
examples/clarinet/synthesis.py
examples/clarinet/synthesis.py
+0
-1
examples/clarinet/train.py
examples/clarinet/train.py
+2
-2
examples/clarinet/utils.py
examples/clarinet/utils.py
+0
-1
examples/deepvoice3/synthesize.py
examples/deepvoice3/synthesize.py
+0
-1
examples/deepvoice3/train.py
examples/deepvoice3/train.py
+2
-2
examples/fastspeech/synthesis.py
examples/fastspeech/synthesis.py
+2
-2
examples/fastspeech/train.py
examples/fastspeech/train.py
+3
-3
examples/transformer_tts/synthesis.py
examples/transformer_tts/synthesis.py
+3
-4
examples/transformer_tts/train_transformer.py
examples/transformer_tts/train_transformer.py
+42
-9
examples/transformer_tts/train_vocoder.py
examples/transformer_tts/train_vocoder.py
+3
-3
examples/waveflow/train.py
examples/waveflow/train.py
+6
-5
examples/waveflow/waveflow.py
examples/waveflow/waveflow.py
+11
-9
examples/wavenet/synthesis.py
examples/wavenet/synthesis.py
+0
-1
examples/wavenet/train.py
examples/wavenet/train.py
+2
-2
setup.py
setup.py
+1
-2
未找到文件。
examples/clarinet/synthesis.py
浏览文件 @
bf6d9ef0
...
...
@@ -21,7 +21,6 @@ import random
from
tqdm
import
tqdm
import
pickle
import
numpy
as
np
from
tensorboardX
import
SummaryWriter
import
paddle.fluid.dygraph
as
dg
from
paddle
import
fluid
...
...
examples/clarinet/train.py
浏览文件 @
bf6d9ef0
...
...
@@ -21,7 +21,7 @@ import random
from
tqdm
import
tqdm
import
pickle
import
numpy
as
np
from
tensorboardX
import
Summary
Writer
from
visualdl
import
Log
Writer
import
paddle.fluid.dygraph
as
dg
from
paddle
import
fluid
...
...
@@ -179,7 +179,7 @@ if __name__ == "__main__":
checkpoint_dir
=
os
.
path
.
join
(
args
.
output
,
"checkpoints"
)
state_dir
=
os
.
path
.
join
(
args
.
output
,
"states"
)
log_dir
=
os
.
path
.
join
(
args
.
output
,
"log"
)
writer
=
Summary
Writer
(
log_dir
)
writer
=
Log
Writer
(
log_dir
)
if
args
.
checkpoint
is
not
None
:
iteration
=
io
.
load_parameters
(
...
...
examples/clarinet/utils.py
浏览文件 @
bf6d9ef0
...
...
@@ -15,7 +15,6 @@
from
__future__
import
division
import
os
import
soundfile
as
sf
from
tensorboardX
import
SummaryWriter
from
collections
import
OrderedDict
from
paddle
import
fluid
...
...
examples/deepvoice3/synthesize.py
浏览文件 @
bf6d9ef0
...
...
@@ -11,7 +11,6 @@ from paddle import fluid
from
paddle.fluid
import
layers
as
F
from
paddle.fluid
import
dygraph
as
dg
from
paddle.fluid.io
import
DataLoader
from
tensorboardX
import
SummaryWriter
import
soundfile
as
sf
from
parakeet.data
import
SliceDataset
,
DataCargo
,
PartialyRandomizedSimilarTimeLengthSampler
,
SequentialSampler
...
...
examples/deepvoice3/train.py
浏览文件 @
bf6d9ef0
...
...
@@ -9,7 +9,7 @@ from paddle import fluid
from
paddle.fluid
import
layers
as
F
from
paddle.fluid
import
dygraph
as
dg
from
paddle.fluid.io
import
DataLoader
from
tensorboardX
import
Summary
Writer
from
visualdl
import
Log
Writer
from
parakeet.models.deepvoice3
import
Encoder
,
Decoder
,
PostNet
,
SpectraNet
from
parakeet.data
import
SliceDataset
,
DataCargo
,
PartialyRandomizedSimilarTimeLengthSampler
,
SequentialSampler
...
...
@@ -181,7 +181,7 @@ if __name__ == "__main__":
global
global_step
global_step
=
1
global
writer
writer
=
Summary
Writer
()
writer
=
Log
Writer
()
print
(
"[Training] tensorboard log and checkpoints are save in {}"
.
format
(
writer
.
logdir
))
train
(
args
,
config
)
\ No newline at end of file
examples/fastspeech/synthesis.py
浏览文件 @
bf6d9ef0
...
...
@@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import
os
from
tensorboardX
import
Summary
Writer
from
visualdl
import
Log
Writer
from
scipy.io.wavfile
import
write
from
collections
import
OrderedDict
import
argparse
...
...
@@ -78,7 +78,7 @@ def synthesis(text_input, args):
if
not
os
.
path
.
exists
(
args
.
output
):
os
.
mkdir
(
args
.
output
)
writer
=
Summary
Writer
(
os
.
path
.
join
(
args
.
output
,
'log'
))
writer
=
Log
Writer
(
os
.
path
.
join
(
args
.
output
,
'log'
))
model
=
FastSpeech
(
cfg
[
'network'
],
num_mels
=
cfg
[
'audio'
][
'num_mels'
])
# Load parameters.
...
...
examples/fastspeech/train.py
浏览文件 @
bf6d9ef0
...
...
@@ -22,7 +22,7 @@ from ruamel import yaml
from
tqdm
import
tqdm
from
matplotlib
import
cm
from
collections
import
OrderedDict
from
tensorboardX
import
Summary
Writer
from
visualdl
import
Log
Writer
import
paddle.fluid.dygraph
as
dg
import
paddle.fluid.layers
as
layers
import
paddle.fluid
as
fluid
...
...
@@ -69,8 +69,8 @@ def main(args):
if
not
os
.
path
.
exists
(
args
.
output
):
os
.
mkdir
(
args
.
output
)
writer
=
Summary
Writer
(
os
.
path
.
join
(
args
.
output
,
'log'
))
if
local_rank
==
0
else
None
writer
=
Log
Writer
(
os
.
path
.
join
(
args
.
output
,
'log'
))
if
local_rank
==
0
else
None
model
=
FastSpeech
(
cfg
[
'network'
],
num_mels
=
cfg
[
'audio'
][
'num_mels'
])
model
.
train
()
...
...
examples/transformer_tts/synthesis.py
浏览文件 @
bf6d9ef0
...
...
@@ -16,7 +16,7 @@ from scipy.io.wavfile import write
import
numpy
as
np
from
tqdm
import
tqdm
from
matplotlib
import
cm
from
tensorboardX
import
Summary
Writer
from
visualdl
import
Log
Writer
from
ruamel
import
yaml
from
pathlib
import
Path
import
argparse
...
...
@@ -81,7 +81,7 @@ def synthesis(text_input, args):
if
not
os
.
path
.
exists
(
args
.
output
):
os
.
mkdir
(
args
.
output
)
writer
=
Summary
Writer
(
os
.
path
.
join
(
args
.
output
,
'log'
))
writer
=
Log
Writer
(
os
.
path
.
join
(
args
.
output
,
'log'
))
fluid
.
enable_dygraph
(
place
)
with
fluid
.
unique_name
.
guard
():
...
...
@@ -121,8 +121,7 @@ def synthesis(text_input, args):
writer
.
add_image
(
'Attention_%d_0'
%
global_step
,
x
,
i
*
4
+
j
,
dataformats
=
"HWC"
)
i
*
4
+
j
)
if
args
.
vocoder
==
'griffin-lim'
:
#synthesis use griffin-lim
...
...
examples/transformer_tts/train_transformer.py
浏览文件 @
bf6d9ef0
...
...
@@ -13,7 +13,7 @@
# limitations under the License.
import
os
from
tqdm
import
tqdm
from
tensorboardX
import
Summary
Writer
from
visualdl
import
Log
Writer
from
collections
import
OrderedDict
import
argparse
from
pprint
import
pprint
...
...
@@ -29,6 +29,41 @@ from parakeet.models.transformer_tts import TransformerTTS
from
parakeet.utils
import
io
def
add_scalars
(
self
,
main_tag
,
tag_scalar_dict
,
step
,
walltime
=
None
):
"""Add scalars to vdl record file.
Args:
main_tag (string): The parent name for the tags
tag_scalar_dict (dict): Key-value pair storing the tag and corresponding values
step (int): Step of scalars
walltime (float): Wall time of scalars.
Example:
for index in range(1, 101):
writer.add_scalar(tag="train/loss", value=index*0.2, step=index)
writer.add_scalar(tag="train/lr", value=index*0.5, step=index)
"""
import
time
from
visualdl.writer.record_writer
import
RecordFileWriter
from
visualdl.component.base_component
import
scalar
fw_logdir
=
self
.
logdir
walltime
=
round
(
time
.
time
())
if
walltime
is
None
else
walltime
for
tag
,
value
in
tag_scalar_dict
.
items
():
tag
=
os
.
path
.
join
(
fw_logdir
,
main_tag
,
tag
)
if
'%'
in
tag
:
raise
RuntimeError
(
"% can't appear in tag!"
)
if
tag
in
self
.
_all_writers
:
fw
=
self
.
_all_writers
[
tag
]
else
:
fw
=
RecordFileWriter
(
logdir
=
tag
,
max_queue_size
=
self
.
_max_queue
,
flush_secs
=
self
.
_flush_secs
,
filename_suffix
=
self
.
_filename_suffix
)
self
.
_all_writers
.
update
({
tag
:
fw
})
fw
.
add_record
(
scalar
(
tag
=
main_tag
,
value
=
value
,
step
=
step
,
walltime
=
walltime
))
def
add_config_options_to_parser
(
parser
):
parser
.
add_argument
(
"--config"
,
type
=
str
,
help
=
"path of the config file"
)
parser
.
add_argument
(
"--use_gpu"
,
type
=
int
,
default
=
0
,
help
=
"device to use"
)
...
...
@@ -62,8 +97,9 @@ def main(args):
if
not
os
.
path
.
exists
(
args
.
output
):
os
.
mkdir
(
args
.
output
)
writer
=
SummaryWriter
(
os
.
path
.
join
(
args
.
output
,
'log'
))
if
local_rank
==
0
else
None
writer
=
LogWriter
(
os
.
path
.
join
(
args
.
output
,
'log'
))
if
local_rank
==
0
else
None
writer
.
add_scalars
=
add_scalars
fluid
.
enable_dygraph
(
place
)
network_cfg
=
cfg
[
'network'
]
...
...
@@ -162,8 +198,7 @@ def main(args):
writer
.
add_image
(
'Attention_%d_0'
%
global_step
,
x
,
i
*
4
+
j
,
dataformats
=
"HWC"
)
i
*
4
+
j
)
for
i
,
prob
in
enumerate
(
attn_enc
):
for
j
in
range
(
cfg
[
'network'
][
'encoder_num_head'
]):
...
...
@@ -173,8 +208,7 @@ def main(args):
writer
.
add_image
(
'Attention_enc_%d_0'
%
global_step
,
x
,
i
*
4
+
j
,
dataformats
=
"HWC"
)
i
*
4
+
j
)
for
i
,
prob
in
enumerate
(
attn_dec
):
for
j
in
range
(
cfg
[
'network'
][
'decoder_num_head'
]):
...
...
@@ -184,8 +218,7 @@ def main(args):
writer
.
add_image
(
'Attention_dec_%d_0'
%
global_step
,
x
,
i
*
4
+
j
,
dataformats
=
"HWC"
)
i
*
4
+
j
)
if
parallel
:
loss
=
model
.
scale_loss
(
loss
)
...
...
examples/transformer_tts/train_vocoder.py
浏览文件 @
bf6d9ef0
...
...
@@ -11,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from
tensorboardX
import
Summary
Writer
from
visualdl
import
Log
Writer
import
os
from
tqdm
import
tqdm
from
pathlib
import
Path
...
...
@@ -60,8 +60,8 @@ def main(args):
if
not
os
.
path
.
exists
(
args
.
output
):
os
.
mkdir
(
args
.
output
)
writer
=
Summary
Writer
(
os
.
path
.
join
(
args
.
output
,
'log'
))
if
local_rank
==
0
else
None
writer
=
Log
Writer
(
os
.
path
.
join
(
args
.
output
,
'log'
))
if
local_rank
==
0
else
None
fluid
.
enable_dygraph
(
place
)
model
=
Vocoder
(
cfg
[
'train'
][
'batch_size'
],
cfg
[
'vocoder'
][
'hidden_size'
],
...
...
examples/waveflow/train.py
浏览文件 @
bf6d9ef0
...
...
@@ -22,7 +22,8 @@ import argparse
import
numpy
as
np
import
paddle.fluid.dygraph
as
dg
from
paddle
import
fluid
from
tensorboardX
import
SummaryWriter
from
visualdl
import
LogWriter
import
utils
from
parakeet.utils
import
io
...
...
@@ -78,8 +79,8 @@ def train(config):
os
.
makedirs
(
checkpoint_dir
)
# Create tensorboard logger.
tb
=
Summary
Writer
(
os
.
path
.
join
(
run_dir
,
"logs"
))
\
if
rank
==
0
else
None
vdl
=
Log
Writer
(
os
.
path
.
join
(
run_dir
,
"logs"
))
\
if
rank
==
0
else
None
# Configurate device
place
=
fluid
.
CUDAPlace
(
rank
)
if
use_gpu
else
fluid
.
CPUPlace
()
...
...
@@ -94,7 +95,7 @@ def train(config):
print
(
"Random Seed: "
,
seed
)
# Build model.
model
=
WaveFlow
(
config
,
checkpoint_dir
,
parallel
,
rank
,
nranks
,
tb
)
model
=
WaveFlow
(
config
,
checkpoint_dir
,
parallel
,
rank
,
nranks
,
vdl
)
iteration
=
model
.
build
()
while
iteration
<
config
.
max_iterations
:
...
...
@@ -113,7 +114,7 @@ def train(config):
# Close TensorBoard.
if
rank
==
0
:
tb
.
close
()
vdl
.
close
()
if
__name__
==
"__main__"
:
...
...
examples/waveflow/waveflow.py
浏览文件 @
bf6d9ef0
...
...
@@ -42,7 +42,7 @@ class WaveFlow():
rank (int, optional): the rank of the process in a multi-process
scenario. Defaults to 0.
nranks (int, optional): the total number of processes. Defaults to 1.
tb
_logger (obj, optional): logger to visualize metrics.
vdl
_logger (obj, optional): logger to visualize metrics.
Defaults to None.
Returns:
...
...
@@ -55,13 +55,13 @@ class WaveFlow():
parallel
=
False
,
rank
=
0
,
nranks
=
1
,
tb
_logger
=
None
):
vdl
_logger
=
None
):
self
.
config
=
config
self
.
checkpoint_dir
=
checkpoint_dir
self
.
parallel
=
parallel
self
.
rank
=
rank
self
.
nranks
=
nranks
self
.
tb_logger
=
tb
_logger
self
.
vdl_logger
=
vdl
_logger
self
.
dtype
=
"float16"
if
config
.
use_fp16
else
"float32"
def
build
(
self
,
training
=
True
):
...
...
@@ -161,8 +161,8 @@ class WaveFlow():
load_time
-
start_time
,
graph_time
-
load_time
)
print
(
log
)
tb
=
self
.
tb
_logger
tb
.
add_scalar
(
"Train-Loss-Rank-0"
,
loss_val
,
iteration
)
vdl_writer
=
self
.
vdl
_logger
vdl_writer
.
add_scalar
(
"Train-Loss-Rank-0"
,
loss_val
,
iteration
)
@
dg
.
no_grad
def
valid_step
(
self
,
iteration
):
...
...
@@ -175,7 +175,7 @@ class WaveFlow():
None
"""
self
.
waveflow
.
eval
()
tb
=
self
.
tb
_logger
vdl_writer
=
self
.
vdl
_logger
total_loss
=
[]
sample_audios
=
[]
...
...
@@ -188,10 +188,12 @@ class WaveFlow():
# Visualize latent z and scale log_s.
if
self
.
rank
==
0
and
i
==
0
:
tb
.
add_histogram
(
"Valid-Latent_z"
,
valid_z
.
numpy
(),
iteration
)
vdl_writer
.
add_histogram
(
"Valid-Latent_z"
,
valid_z
.
numpy
(),
iteration
)
for
j
,
valid_log_s
in
enumerate
(
valid_log_s_list
):
hist_name
=
"Valid-{}th-Flow-Log_s"
.
format
(
j
)
tb
.
add_histogram
(
hist_name
,
valid_log_s
.
numpy
(),
iteration
)
vdl_writer
.
add_histogram
(
hist_name
,
valid_log_s
.
numpy
(),
iteration
)
valid_loss
=
self
.
criterion
(
valid_outputs
)
total_loss
.
append
(
float
(
valid_loss
.
numpy
()))
...
...
@@ -202,7 +204,7 @@ class WaveFlow():
log
=
"Test | Rank: {} AvgLoss: {:<8.3f} Time {:<8.3f}"
.
format
(
self
.
rank
,
loss_val
,
total_time
)
print
(
log
)
tb
.
add_scalar
(
"Valid-Avg-Loss"
,
loss_val
,
iteration
)
vdl_writer
.
add_scalar
(
"Valid-Avg-Loss"
,
loss_val
,
iteration
)
@
dg
.
no_grad
def
infer
(
self
,
iteration
):
...
...
examples/wavenet/synthesis.py
浏览文件 @
bf6d9ef0
...
...
@@ -17,7 +17,6 @@ import os
import
ruamel.yaml
import
argparse
from
tqdm
import
tqdm
from
tensorboardX
import
SummaryWriter
from
paddle
import
fluid
fluid
.
require_version
(
'1.8.0'
)
import
paddle.fluid.dygraph
as
dg
...
...
examples/wavenet/train.py
浏览文件 @
bf6d9ef0
...
...
@@ -17,7 +17,7 @@ import os
import
ruamel.yaml
import
argparse
import
tqdm
from
tensorboardX
import
Summary
Writer
from
visualdl
import
Log
Writer
from
paddle
import
fluid
fluid
.
require_version
(
'1.8.0'
)
import
paddle.fluid.dygraph
as
dg
...
...
@@ -154,7 +154,7 @@ if __name__ == "__main__":
eval_interval
=
train_config
[
"eval_interval"
]
checkpoint_dir
=
os
.
path
.
join
(
args
.
output
,
"checkpoints"
)
log_dir
=
os
.
path
.
join
(
args
.
output
,
"log"
)
writer
=
Summary
Writer
(
log_dir
)
writer
=
Log
Writer
(
log_dir
)
# load parameters and optimizer, and update iterations done so far
if
args
.
checkpoint
is
not
None
:
...
...
setup.py
浏览文件 @
bf6d9ef0
...
...
@@ -57,8 +57,7 @@ setup_info = dict(
'numba==0.47.0'
,
'tqdm==4.19.8'
,
'matplotlib'
,
'tensorboardX'
,
'tensorboard'
,
'visualdl'
,
'scipy'
,
'ruamel.yaml'
,
'pandas'
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录