Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
曾经的那一瞬间
Models
提交
4e9f9514
M
Models
项目概览
曾经的那一瞬间
/
Models
大约 1 年 前同步成功
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
Models
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
4e9f9514
编写于
8月 02, 2022
作者:
H
Hongkun Yu
提交者:
A. Unique TensorFlower
8月 02, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Internal change
PiperOrigin-RevId: 464934071
上级
a81f8590
变更
8
显示空白变更内容
内联
并排
Showing
8 changed file
with
14 addition
and
14 deletion
+14
-14
official/nlp/modeling/layers/transformer_scaffold.py
official/nlp/modeling/layers/transformer_scaffold.py
+1
-1
official/nlp/modeling/networks/albert_encoder.py
official/nlp/modeling/networks/albert_encoder.py
+1
-1
official/nlp/modeling/networks/classification.py
official/nlp/modeling/networks/classification.py
+1
-1
official/nlp/modeling/networks/encoder_scaffold.py
official/nlp/modeling/networks/encoder_scaffold.py
+1
-1
official/nlp/modeling/networks/mobile_bert_encoder.py
official/nlp/modeling/networks/mobile_bert_encoder.py
+1
-1
official/nlp/modeling/networks/packed_sequence_embedding.py
official/nlp/modeling/networks/packed_sequence_embedding.py
+4
-4
official/nlp/modeling/networks/span_labeling.py
official/nlp/modeling/networks/span_labeling.py
+1
-1
official/nlp/modeling/networks/xlnet_base.py
official/nlp/modeling/networks/xlnet_base.py
+4
-4
未找到文件。
official/nlp/modeling/layers/transformer_scaffold.py
浏览文件 @
4e9f9514
...
...
@@ -237,7 +237,7 @@ class TransformerScaffold(tf.keras.layers.Layer):
self
.
_output_layer_norm
=
tf
.
keras
.
layers
.
LayerNormalization
(
name
=
"output_layer_norm"
,
axis
=-
1
,
epsilon
=
1e-12
,
dtype
=
tf
.
float32
)
super
(
TransformerScaffold
,
self
).
build
(
input_shape
)
super
().
build
(
input_shape
)
logging
.
info
(
"%s configs: %s"
,
self
.
__class__
.
__name__
,
self
.
get_config
())
def
get_config
(
self
):
...
...
official/nlp/modeling/networks/albert_encoder.py
浏览文件 @
4e9f9514
...
...
@@ -173,7 +173,7 @@ class AlbertEncoder(tf.keras.Model):
# created using the Functional API. Once super().__init__ is called, we
# can assign attributes to `self` - note that all `self` assignments are
# below this line.
super
(
AlbertEncoder
,
self
).
__init__
(
super
().
__init__
(
inputs
=
[
word_ids
,
mask
,
type_ids
],
outputs
=
outputs
,
**
kwargs
)
config_dict
=
{
'vocab_size'
:
vocab_size
,
...
...
official/nlp/modeling/networks/classification.py
浏览文件 @
4e9f9514
...
...
@@ -74,7 +74,7 @@ class Classification(tf.keras.Model):
(
'Unknown `output` value "%s". `output` can be either "logits" or '
'"predictions"'
)
%
output
)
super
(
Classification
,
self
).
__init__
(
super
().
__init__
(
inputs
=
[
cls_output
],
outputs
=
output_tensors
,
**
kwargs
)
# b/164516224
...
...
official/nlp/modeling/networks/encoder_scaffold.py
浏览文件 @
4e9f9514
...
...
@@ -271,7 +271,7 @@ class EncoderScaffold(tf.keras.Model):
# created using the Functional API. Once super().__init__ is called, we
# can assign attributes to `self` - note that all `self` assignments are
# below this line.
super
(
EncoderScaffold
,
self
).
__init__
(
super
().
__init__
(
inputs
=
inputs
,
outputs
=
outputs
,
**
kwargs
)
self
.
_hidden_cls
=
hidden_cls
...
...
official/nlp/modeling/networks/mobile_bert_encoder.py
浏览文件 @
4e9f9514
...
...
@@ -163,7 +163,7 @@ class MobileBERTEncoder(tf.keras.Model):
encoder_outputs
=
all_layer_outputs
,
attention_scores
=
all_attention_scores
)
super
(
MobileBERTEncoder
,
self
).
__init__
(
super
().
__init__
(
inputs
=
self
.
inputs
,
outputs
=
outputs
,
**
kwargs
)
def
get_embedding_table
(
self
):
...
...
official/nlp/modeling/networks/packed_sequence_embedding.py
浏览文件 @
4e9f9514
...
...
@@ -143,7 +143,7 @@ class PackedSequenceEmbedding(tf.keras.Model):
[
attention_mask
,
sub_seq_mask
])
outputs
=
[
embeddings
,
attention_mask
]
super
(
PackedSequenceEmbedding
,
self
).
__init__
(
super
().
__init__
(
inputs
=
inputs
,
outputs
=
outputs
,
**
kwargs
)
# TF does not track immutable attrs which do not contain Trackables,
# so by creating a config namedtuple instead of a dict we avoid tracking it.
...
...
@@ -221,7 +221,7 @@ class PositionEmbeddingWithSubSeqMask(tf.keras.layers.Layer):
if
'dtype'
not
in
kwargs
:
kwargs
[
'dtype'
]
=
'float32'
super
(
PositionEmbeddingWithSubSeqMask
,
self
).
__init__
(
**
kwargs
)
super
().
__init__
(
**
kwargs
)
if
use_dynamic_slicing
and
max_sequence_length
is
None
:
raise
ValueError
(
'If `use_dynamic_slicing` is True, `max_sequence_length` must be set.'
...
...
@@ -236,7 +236,7 @@ class PositionEmbeddingWithSubSeqMask(tf.keras.layers.Layer):
'initializer'
:
tf
.
keras
.
initializers
.
serialize
(
self
.
_initializer
),
'use_dynamic_slicing'
:
self
.
_use_dynamic_slicing
,
}
base_config
=
super
(
PositionEmbeddingWithSubSeqMask
,
self
).
get_config
()
base_config
=
super
().
get_config
()
return
dict
(
list
(
base_config
.
items
())
+
list
(
config
.
items
()))
def
build
(
self
,
input_shape
):
...
...
@@ -273,7 +273,7 @@ class PositionEmbeddingWithSubSeqMask(tf.keras.layers.Layer):
shape
=
[
weight_sequence_length
,
width
],
initializer
=
self
.
_initializer
)
super
(
PositionEmbeddingWithSubSeqMask
,
self
).
build
(
input_shape
)
super
().
build
(
input_shape
)
def
call
(
self
,
inputs
,
position_ids
=
None
,
sub_sequence_mask
=
None
):
"""Implements call() for the layer.
...
...
official/nlp/modeling/networks/span_labeling.py
浏览文件 @
4e9f9514
...
...
@@ -81,7 +81,7 @@ class SpanLabeling(tf.keras.Model):
# created using the Functional API. Once super().__init__ is called, we
# can assign attributes to `self` - note that all `self` assignments are
# below this line.
super
(
SpanLabeling
,
self
).
__init__
(
super
().
__init__
(
inputs
=
[
sequence_data
],
outputs
=
output_tensors
,
**
kwargs
)
config_dict
=
{
'input_width'
:
input_width
,
...
...
official/nlp/modeling/networks/xlnet_base.py
浏览文件 @
4e9f9514
...
...
@@ -384,7 +384,7 @@ class RelativePositionEncoding(tf.keras.layers.Layer):
"""
def
__init__
(
self
,
hidden_size
,
**
kwargs
):
super
(
RelativePositionEncoding
,
self
).
__init__
(
**
kwargs
)
super
().
__init__
(
**
kwargs
)
self
.
_hidden_size
=
hidden_size
self
.
_inv_freq
=
1.0
/
(
10000.0
**
(
tf
.
range
(
0
,
self
.
_hidden_size
,
2.0
)
/
self
.
_hidden_size
))
...
...
@@ -476,7 +476,7 @@ class XLNetBase(tf.keras.layers.Layer):
use_cls_mask
=
False
,
embedding_width
=
None
,
**
kwargs
):
super
(
XLNetBase
,
self
).
__init__
(
**
kwargs
)
super
().
__init__
(
**
kwargs
)
self
.
_vocab_size
=
vocab_size
self
.
_initializer
=
initializer
...
...
@@ -574,7 +574,7 @@ class XLNetBase(tf.keras.layers.Layer):
"embedding_width"
:
self
.
_embedding_width
,
}
base_config
=
super
(
XLNetBase
,
self
).
get_config
()
base_config
=
super
().
get_config
()
return
dict
(
list
(
base_config
.
items
())
+
list
(
config
.
items
()))
def
get_embedding_lookup_table
(
self
):
...
...
@@ -601,7 +601,7 @@ class XLNetBase(tf.keras.layers.Layer):
"target_mapping"
:
target_mapping
,
"masked_tokens"
:
masked_tokens
}
return
super
(
XLNetBase
,
self
).
__call__
(
inputs
,
**
kwargs
)
return
super
().
__call__
(
inputs
,
**
kwargs
)
def
call
(
self
,
inputs
):
"""Implements call() for the layer."""
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录