Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ModelZoo
ResNet50_tensorflow
Commits
01116d8e
Commit
01116d8e
authored
Aug 28, 2020
by
Zhenyu Tan
Committed by
A. Unique TensorFlower
Aug 28, 2020
Browse files
Replace Transformer for albert_transformer_encoder
PiperOrigin-RevId: 328975553
parent
cc7495e4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
5 deletions
+6
-5
official/nlp/modeling/networks/albert_transformer_encoder.py
official/nlp/modeling/networks/albert_transformer_encoder.py
+6
-5
No files found.
official/nlp/modeling/networks/albert_transformer_encoder.py
View file @
01116d8e
...
@@ -22,6 +22,7 @@ from __future__ import print_function
...
@@ -22,6 +22,7 @@ from __future__ import print_function
import
tensorflow
as
tf
import
tensorflow
as
tf
from
official.modeling
import
activations
from
official.modeling
import
activations
from
official.nlp
import
keras_nlp
from
official.nlp.modeling
import
layers
from
official.nlp.modeling
import
layers
...
@@ -152,12 +153,12 @@ class AlbertTransformerEncoder(tf.keras.Model):
...
@@ -152,12 +153,12 @@ class AlbertTransformerEncoder(tf.keras.Model):
data
=
embeddings
data
=
embeddings
attention_mask
=
layers
.
SelfAttentionMask
()([
data
,
mask
])
attention_mask
=
layers
.
SelfAttentionMask
()([
data
,
mask
])
shared_layer
=
layers
.
Transformer
(
shared_layer
=
keras_nlp
.
Transformer
EncoderBlock
(
num_attention_heads
=
num_attention_heads
,
num_attention_heads
=
num_attention_heads
,
in
t
er
mediate_size
=
intermediate_size
,
in
n
er
_dim
=
intermediate_size
,
in
t
er
mediate
_activation
=
activation
,
in
n
er_activation
=
activation
,
dropout
_rate
=
dropout_rate
,
output_
dropout
=
dropout_rate
,
attention_dropout
_rate
=
attention_dropout_rate
,
attention_dropout
=
attention_dropout_rate
,
kernel_initializer
=
initializer
,
kernel_initializer
=
initializer
,
name
=
'transformer'
)
name
=
'transformer'
)
for
_
in
range
(
num_layers
):
for
_
in
range
(
num_layers
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment