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
f2adc5ef
Commit
f2adc5ef
authored
Feb 25, 2022
by
Zihan Wang
Browse files
fix argument passing
parent
5ad1d93f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
17 deletions
+4
-17
official/projects/longformer/longformer.py
official/projects/longformer/longformer.py
+4
-4
official/projects/longformer/longformer_encoder.py
official/projects/longformer/longformer_encoder.py
+0
-13
No files found.
official/projects/longformer/longformer.py
View file @
f2adc5ef
...
@@ -54,10 +54,10 @@ def get_encoder(encoder_cfg: LongformerEncoderConfig):
...
@@ -54,10 +54,10 @@ def get_encoder(encoder_cfg: LongformerEncoderConfig):
hidden_size
=
encoder_cfg
.
hidden_size
,
hidden_size
=
encoder_cfg
.
hidden_size
,
num_layers
=
encoder_cfg
.
num_layers
,
num_layers
=
encoder_cfg
.
num_layers
,
num_attention_heads
=
encoder_cfg
.
num_attention_heads
,
num_attention_heads
=
encoder_cfg
.
num_attention_heads
,
in
t
er
mediate_size
=
encoder_cfg
.
intermediate_size
,
in
n
er
_dim
=
encoder_cfg
.
intermediate_size
,
activation
=
tf_utils
.
get_activation
(
encoder_cfg
.
hidden_activation
),
inner_
activation
=
tf_utils
.
get_activation
(
encoder_cfg
.
hidden_activation
),
dropout
_rate
=
encoder_cfg
.
dropout_rate
,
output_
dropout
=
encoder_cfg
.
dropout_rate
,
attention_dropout
_rate
=
encoder_cfg
.
attention_dropout_rate
,
attention_dropout
=
encoder_cfg
.
attention_dropout_rate
,
max_sequence_length
=
encoder_cfg
.
max_position_embeddings
,
max_sequence_length
=
encoder_cfg
.
max_position_embeddings
,
type_vocab_size
=
encoder_cfg
.
type_vocab_size
,
type_vocab_size
=
encoder_cfg
.
type_vocab_size
,
initializer
=
tf
.
keras
.
initializers
.
TruncatedNormal
(
initializer
=
tf
.
keras
.
initializers
.
TruncatedNormal
(
...
...
official/projects/longformer/longformer_encoder.py
View file @
f2adc5ef
...
@@ -106,19 +106,6 @@ class LongformerEncoder(tf.keras.layers.Layer):
...
@@ -106,19 +106,6 @@ class LongformerEncoder(tf.keras.layers.Layer):
embedding_layer
:
Optional
[
tf
.
keras
.
layers
.
Layer
]
=
None
,
embedding_layer
:
Optional
[
tf
.
keras
.
layers
.
Layer
]
=
None
,
norm_first
:
bool
=
False
,
norm_first
:
bool
=
False
,
**
kwargs
):
**
kwargs
):
# Pops kwargs that are used in V1 implementation.
if
'dict_outputs'
in
kwargs
:
kwargs
.
pop
(
'dict_outputs'
)
if
'return_all_encoder_outputs'
in
kwargs
:
kwargs
.
pop
(
'return_all_encoder_outputs'
)
if
'intermediate_size'
in
kwargs
:
inner_dim
=
kwargs
.
pop
(
'intermediate_size'
)
if
'activation'
in
kwargs
:
inner_activation
=
kwargs
.
pop
(
'activation'
)
if
'dropout_rate'
in
kwargs
:
output_dropout
=
kwargs
.
pop
(
'dropout_rate'
)
if
'attention_dropout_rate'
in
kwargs
:
attention_dropout
=
kwargs
.
pop
(
'attention_dropout_rate'
)
super
().
__init__
(
**
kwargs
)
super
().
__init__
(
**
kwargs
)
# Longformer args
# Longformer args
self
.
_attention_window
=
attention_window
self
.
_attention_window
=
attention_window
...
...
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