Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
DeepSpeech
提交
7d133368
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看板
提交
7d133368
编写于
8月 17, 2021
作者:
H
Hui Zhang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix bugs
上级
16f4bdc5
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
19 addition
and
31 deletion
+19
-31
.bashrc
.bashrc
+0
-10
.notebook/u2_confermer_model_wenet.ipynb
.notebook/u2_confermer_model_wenet.ipynb
+1
-1
deepspeech/frontend/augmentor/augmentation.py
deepspeech/frontend/augmentor/augmentation.py
+1
-4
deepspeech/io/dataset.py
deepspeech/io/dataset.py
+1
-0
deepspeech/models/ds2/rnn.py
deepspeech/models/ds2/rnn.py
+1
-1
deepspeech/models/u2.py
deepspeech/models/u2.py
+1
-1
deepspeech/models/u2_st.py
deepspeech/models/u2_st.py
+1
-1
deepspeech/modules/decoder.py
deepspeech/modules/decoder.py
+2
-2
deepspeech/modules/decoder_layer.py
deepspeech/modules/decoder_layer.py
+7
-7
deepspeech/modules/encoder.py
deepspeech/modules/encoder.py
+2
-2
deepspeech/modules/rnn.py
deepspeech/modules/rnn.py
+1
-1
examples/librispeech/s0/conf/deepspeech2.yaml
examples/librispeech/s0/conf/deepspeech2.yaml
+1
-1
未找到文件。
.bashrc
已删除
100755 → 0
浏览文件 @
16f4bdc5
# Locales
export
LC_ALL
=
en_US.UTF-8
export
LANG
=
en_US.UTF-8
export
LANGUAGE
=
en_US.UTF-8
# Aliases
alias
nvs
=
"nvidia-smi"
alias
rsync
=
"rsync --progress -raz"
alias
his
=
"history"
.notebook/u2_confermer_model_wenet.ipynb
浏览文件 @
7d133368
...
@@ -3431,7 +3431,7 @@
...
@@ -3431,7 +3431,7 @@
" convolution_layer_args = (output_size, cnn_module_kernel, activation,\n",
" convolution_layer_args = (output_size, cnn_module_kernel, activation,\n",
" cnn_module_norm, causal)\n",
" cnn_module_norm, causal)\n",
"\n",
"\n",
" self.encoders = nn.
Module
List([\n",
" self.encoders = nn.
Layer
List([\n",
" ConformerEncoderLayer(\n",
" ConformerEncoderLayer(\n",
" size=output_size,\n",
" size=output_size,\n",
" self_attn=encoder_selfattn_layer(*encoder_selfattn_layer_args),\n",
" self_attn=encoder_selfattn_layer(*encoder_selfattn_layer_args),\n",
...
...
deepspeech/frontend/augmentor/augmentation.py
浏览文件 @
7d133368
...
@@ -164,8 +164,6 @@ class AugmentationPipeline():
...
@@ -164,8 +164,6 @@ class AugmentationPipeline():
:param audio_segment: Audio segment to process.
:param audio_segment: Audio segment to process.
:type audio_segment: AudioSegmenet|SpeechSegment
:type audio_segment: AudioSegmenet|SpeechSegment
"""
"""
if
not
self
.
_train
:
return
for
augmentor
,
rate
in
zip
(
self
.
_audio_augmentors
,
self
.
_audio_rates
):
for
augmentor
,
rate
in
zip
(
self
.
_audio_augmentors
,
self
.
_audio_rates
):
if
self
.
_rng
.
uniform
(
0.
,
1.
)
<
rate
:
if
self
.
_rng
.
uniform
(
0.
,
1.
)
<
rate
:
augmentor
.
transform_audio
(
audio_segment
)
augmentor
.
transform_audio
(
audio_segment
)
...
@@ -176,8 +174,6 @@ class AugmentationPipeline():
...
@@ -176,8 +174,6 @@ class AugmentationPipeline():
Args:
Args:
spec_segment (np.ndarray): audio feature, (D, T).
spec_segment (np.ndarray): audio feature, (D, T).
"""
"""
if
not
self
.
_train
:
return
for
augmentor
,
rate
in
zip
(
self
.
_spec_augmentors
,
self
.
_spec_rates
):
for
augmentor
,
rate
in
zip
(
self
.
_spec_augmentors
,
self
.
_spec_rates
):
if
self
.
_rng
.
uniform
(
0.
,
1.
)
<
rate
:
if
self
.
_rng
.
uniform
(
0.
,
1.
)
<
rate
:
spec_segment
=
augmentor
.
transform_feature
(
spec_segment
)
spec_segment
=
augmentor
.
transform_feature
(
spec_segment
)
...
@@ -217,3 +213,4 @@ class AugmentationPipeline():
...
@@ -217,3 +213,4 @@ class AugmentationPipeline():
obj
=
class_obj
(
self
.
_rng
,
**
params
)
obj
=
class_obj
(
self
.
_rng
,
**
params
)
except
Exception
:
except
Exception
:
raise
ValueError
(
"Unknown augmentor type [%s]."
%
augmentor_type
)
raise
ValueError
(
"Unknown augmentor type [%s]."
%
augmentor_type
)
return
obj
deepspeech/io/dataset.py
浏览文件 @
7d133368
...
@@ -13,6 +13,7 @@
...
@@ -13,6 +13,7 @@
# limitations under the License.
# limitations under the License.
from
typing
import
Optional
from
typing
import
Optional
import
numpy
as
np
from
paddle.io
import
Dataset
from
paddle.io
import
Dataset
from
yacs.config
import
CfgNode
from
yacs.config
import
CfgNode
...
...
deepspeech/models/ds2/rnn.py
浏览文件 @
7d133368
...
@@ -297,7 +297,7 @@ class RNNStack(nn.Layer):
...
@@ -297,7 +297,7 @@ class RNNStack(nn.Layer):
share_weights
=
share_rnn_weights
))
share_weights
=
share_rnn_weights
))
i_size
=
h_size
*
2
i_size
=
h_size
*
2
self
.
rnn_stacks
=
nn
.
Module
List
(
rnn_stacks
)
self
.
rnn_stacks
=
nn
.
Layer
List
(
rnn_stacks
)
def
forward
(
self
,
x
:
paddle
.
Tensor
,
x_len
:
paddle
.
Tensor
):
def
forward
(
self
,
x
:
paddle
.
Tensor
,
x_len
:
paddle
.
Tensor
):
"""
"""
...
...
deepspeech/models/u2.py
浏览文件 @
7d133368
...
@@ -54,7 +54,7 @@ __all__ = ["U2Model", "U2InferModel"]
...
@@ -54,7 +54,7 @@ __all__ = ["U2Model", "U2InferModel"]
logger
=
Log
(
__name__
).
getlog
()
logger
=
Log
(
__name__
).
getlog
()
class
U2BaseModel
(
nn
.
Module
):
class
U2BaseModel
(
nn
.
Layer
):
"""CTC-Attention hybrid Encoder-Decoder model"""
"""CTC-Attention hybrid Encoder-Decoder model"""
@
classmethod
@
classmethod
...
...
deepspeech/models/u2_st.py
浏览文件 @
7d133368
...
@@ -48,7 +48,7 @@ __all__ = ["U2STModel", "U2STInferModel"]
...
@@ -48,7 +48,7 @@ __all__ = ["U2STModel", "U2STInferModel"]
logger
=
Log
(
__name__
).
getlog
()
logger
=
Log
(
__name__
).
getlog
()
class
U2STBaseModel
(
nn
.
Module
):
class
U2STBaseModel
(
nn
.
Layer
):
"""CTC-Attention hybrid Encoder-Decoder model"""
"""CTC-Attention hybrid Encoder-Decoder model"""
@
classmethod
@
classmethod
...
...
deepspeech/modules/decoder.py
浏览文件 @
7d133368
...
@@ -33,7 +33,7 @@ logger = Log(__name__).getlog()
...
@@ -33,7 +33,7 @@ logger = Log(__name__).getlog()
__all__
=
[
"TransformerDecoder"
]
__all__
=
[
"TransformerDecoder"
]
class
TransformerDecoder
(
nn
.
Module
):
class
TransformerDecoder
(
nn
.
Layer
):
"""Base class of Transfomer decoder module.
"""Base class of Transfomer decoder module.
Args:
Args:
vocab_size: output dim
vocab_size: output dim
...
@@ -86,7 +86,7 @@ class TransformerDecoder(nn.Module):
...
@@ -86,7 +86,7 @@ class TransformerDecoder(nn.Module):
self
.
use_output_layer
=
use_output_layer
self
.
use_output_layer
=
use_output_layer
self
.
output_layer
=
nn
.
Linear
(
attention_dim
,
vocab_size
)
self
.
output_layer
=
nn
.
Linear
(
attention_dim
,
vocab_size
)
self
.
decoders
=
nn
.
Module
List
([
self
.
decoders
=
nn
.
Layer
List
([
DecoderLayer
(
DecoderLayer
(
size
=
attention_dim
,
size
=
attention_dim
,
self_attn
=
MultiHeadedAttention
(
attention_heads
,
attention_dim
,
self_attn
=
MultiHeadedAttention
(
attention_heads
,
attention_dim
,
...
...
deepspeech/modules/decoder_layer.py
浏览文件 @
7d133368
...
@@ -25,15 +25,15 @@ logger = Log(__name__).getlog()
...
@@ -25,15 +25,15 @@ logger = Log(__name__).getlog()
__all__
=
[
"DecoderLayer"
]
__all__
=
[
"DecoderLayer"
]
class
DecoderLayer
(
nn
.
Module
):
class
DecoderLayer
(
nn
.
Layer
):
"""Single decoder layer module.
"""Single decoder layer module.
Args:
Args:
size (int): Input dimension.
size (int): Input dimension.
self_attn (nn.
Module
): Self-attention module instance.
self_attn (nn.
Layer
): Self-attention module instance.
`MultiHeadedAttention` instance can be used as the argument.
`MultiHeadedAttention` instance can be used as the argument.
src_attn (nn.
Module
): Self-attention module instance.
src_attn (nn.
Layer
): Self-attention module instance.
`MultiHeadedAttention` instance can be used as the argument.
`MultiHeadedAttention` instance can be used as the argument.
feed_forward (nn.
Module
): Feed-forward module instance.
feed_forward (nn.
Layer
): Feed-forward module instance.
`PositionwiseFeedForward` instance can be used as the argument.
`PositionwiseFeedForward` instance can be used as the argument.
dropout_rate (float): Dropout rate.
dropout_rate (float): Dropout rate.
normalize_before (bool):
normalize_before (bool):
...
@@ -48,9 +48,9 @@ class DecoderLayer(nn.Module):
...
@@ -48,9 +48,9 @@ class DecoderLayer(nn.Module):
def
__init__
(
def
__init__
(
self
,
self
,
size
:
int
,
size
:
int
,
self_attn
:
nn
.
Module
,
self_attn
:
nn
.
Layer
,
src_attn
:
nn
.
Module
,
src_attn
:
nn
.
Layer
,
feed_forward
:
nn
.
Module
,
feed_forward
:
nn
.
Layer
,
dropout_rate
:
float
,
dropout_rate
:
float
,
normalize_before
:
bool
=
True
,
normalize_before
:
bool
=
True
,
concat_after
:
bool
=
False
,
):
concat_after
:
bool
=
False
,
):
...
...
deepspeech/modules/encoder.py
浏览文件 @
7d133368
...
@@ -358,7 +358,7 @@ class TransformerEncoder(BaseEncoder):
...
@@ -358,7 +358,7 @@ class TransformerEncoder(BaseEncoder):
pos_enc_layer_type
,
normalize_before
,
concat_after
,
pos_enc_layer_type
,
normalize_before
,
concat_after
,
static_chunk_size
,
use_dynamic_chunk
,
global_cmvn
,
static_chunk_size
,
use_dynamic_chunk
,
global_cmvn
,
use_dynamic_left_chunk
)
use_dynamic_left_chunk
)
self
.
encoders
=
nn
.
Module
List
([
self
.
encoders
=
nn
.
Layer
List
([
TransformerEncoderLayer
(
TransformerEncoderLayer
(
size
=
output_size
,
size
=
output_size
,
self_attn
=
MultiHeadedAttention
(
attention_heads
,
output_size
,
self_attn
=
MultiHeadedAttention
(
attention_heads
,
output_size
,
...
@@ -438,7 +438,7 @@ class ConformerEncoder(BaseEncoder):
...
@@ -438,7 +438,7 @@ class ConformerEncoder(BaseEncoder):
convolution_layer_args
=
(
output_size
,
cnn_module_kernel
,
activation
,
convolution_layer_args
=
(
output_size
,
cnn_module_kernel
,
activation
,
cnn_module_norm
,
causal
)
cnn_module_norm
,
causal
)
self
.
encoders
=
nn
.
Module
List
([
self
.
encoders
=
nn
.
Layer
List
([
ConformerEncoderLayer
(
ConformerEncoderLayer
(
size
=
output_size
,
size
=
output_size
,
self_attn
=
encoder_selfattn_layer
(
*
encoder_selfattn_layer_args
),
self_attn
=
encoder_selfattn_layer
(
*
encoder_selfattn_layer_args
),
...
...
deepspeech/modules/rnn.py
浏览文件 @
7d133368
...
@@ -297,7 +297,7 @@ class RNNStack(nn.Layer):
...
@@ -297,7 +297,7 @@ class RNNStack(nn.Layer):
share_weights
=
share_rnn_weights
))
share_weights
=
share_rnn_weights
))
i_size
=
h_size
*
2
i_size
=
h_size
*
2
self
.
rnn_stacks
=
nn
.
Module
List
(
rnn_stacks
)
self
.
rnn_stacks
=
nn
.
Layer
List
(
rnn_stacks
)
def
forward
(
self
,
x
:
paddle
.
Tensor
,
x_len
:
paddle
.
Tensor
):
def
forward
(
self
,
x
:
paddle
.
Tensor
,
x_len
:
paddle
.
Tensor
):
"""
"""
...
...
examples/librispeech/s0/conf/deepspeech2.yaml
浏览文件 @
7d133368
...
@@ -32,7 +32,7 @@ collator:
...
@@ -32,7 +32,7 @@ collator:
keep_transcription_text
:
False
keep_transcription_text
:
False
sortagrad
:
True
sortagrad
:
True
shuffle_method
:
batch_shuffle
shuffle_method
:
batch_shuffle
num_workers
:
0
num_workers
:
2
model
:
model
:
num_conv_layers
:
2
num_conv_layers
:
2
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录