Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
DeepSpeech
提交
12ea02fc
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看板
提交
12ea02fc
编写于
10月 24, 2021
作者:
H
Hui Zhang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix no pos
上级
e76d51fd
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
9 addition
and
9 deletion
+9
-9
deepspeech/modules/embedding.py
deepspeech/modules/embedding.py
+3
-3
deepspeech/modules/encoder.py
deepspeech/modules/encoder.py
+6
-6
未找到文件。
deepspeech/modules/embedding.py
浏览文件 @
12ea02fc
...
...
@@ -22,9 +22,9 @@ from deepspeech.utils.log import Log
logger
=
Log
(
__name__
).
getlog
()
__all__
=
[
"No
ne
PositionalEncoding"
,
"PositionalEncoding"
,
"RelPositionalEncoding"
]
__all__
=
[
"NoPositionalEncoding"
,
"PositionalEncoding"
,
"RelPositionalEncoding"
]
class
No
ne
PositionalEncoding
(
nn
.
Layer
):
class
NoPositionalEncoding
(
nn
.
Layer
):
def
__init__
(
self
,
d_model
:
int
,
dropout_rate
:
float
,
...
...
@@ -38,7 +38,7 @@ class NonePositionalEncoding(nn.Layer):
def
position_encoding
(
self
,
offset
:
int
,
size
:
int
)
->
paddle
.
Tensor
:
return
None
class
PositionalEncoding
(
nn
.
Layer
):
def
__init__
(
self
,
...
...
deepspeech/modules/encoder.py
浏览文件 @
12ea02fc
...
...
@@ -26,7 +26,7 @@ from deepspeech.modules.attention import RelPositionMultiHeadedAttention
from
deepspeech.modules.conformer_convolution
import
ConvolutionModule
from
deepspeech.modules.embedding
import
PositionalEncoding
from
deepspeech.modules.embedding
import
RelPositionalEncoding
from
deepspeech.modules.embedding
import
No
ne
PositionalEncoding
from
deepspeech.modules.embedding
import
NoPositionalEncoding
from
deepspeech.modules.encoder_layer
import
ConformerEncoderLayer
from
deepspeech.modules.encoder_layer
import
TransformerEncoderLayer
from
deepspeech.modules.mask
import
add_optional_chunk_mask
...
...
@@ -56,7 +56,7 @@ class BaseEncoder(nn.Layer):
positional_dropout_rate
:
float
=
0.1
,
attention_dropout_rate
:
float
=
0.0
,
input_layer
:
str
=
"conv2d"
,
pos_enc_layer_type
:
Optional
[
str
,
None
]
=
"abs_pos"
,
pos_enc_layer_type
:
str
=
"abs_pos"
,
normalize_before
:
bool
=
True
,
concat_after
:
bool
=
False
,
static_chunk_size
:
int
=
0
,
...
...
@@ -77,8 +77,8 @@ class BaseEncoder(nn.Layer):
positional encoding
input_layer (str): input layer type.
optional [linear, conv2d, conv2d6, conv2d8]
pos_enc_layer_type (str
, or None
): Encoder positional encoding layer type.
opitonal [abs_pos, scaled_abs_pos, rel_pos,
None
]
pos_enc_layer_type (str): Encoder positional encoding layer type.
opitonal [abs_pos, scaled_abs_pos, rel_pos,
no_pos
]
normalize_before (bool):
True: use layer_norm before each sub-block of a layer.
False: use layer_norm after each sub-block of a layer.
...
...
@@ -103,8 +103,8 @@ class BaseEncoder(nn.Layer):
pos_enc_class
=
PositionalEncoding
elif
pos_enc_layer_type
==
"rel_pos"
:
pos_enc_class
=
RelPositionalEncoding
elif
pos_enc_layer_type
is
None
:
pos_enc_class
=
No
ne
PositionalEncoding
elif
pos_enc_layer_type
is
"no_pos"
:
pos_enc_class
=
NoPositionalEncoding
else
:
raise
ValueError
(
"unknown pos_enc_layer: "
+
pos_enc_layer_type
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录