Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
chenpangpang
transformers
Commits
dda1adad
Commit
dda1adad
authored
Oct 07, 2019
by
Rémi Louf
Browse files
rename BertLayer to BertEncoderLayer
parent
0053c0e0
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
transformers/modeling_bert.py
transformers/modeling_bert.py
+3
-3
No files found.
transformers/modeling_bert.py
View file @
dda1adad
...
@@ -315,9 +315,9 @@ class BertOutput(nn.Module):
...
@@ -315,9 +315,9 @@ class BertOutput(nn.Module):
return
hidden_states
return
hidden_states
class
BertLayer
(
nn
.
Module
):
class
Bert
Encoder
Layer
(
nn
.
Module
):
def
__init__
(
self
,
config
):
def
__init__
(
self
,
config
):
super
(
BertLayer
,
self
).
__init__
()
super
(
Bert
Encoder
Layer
,
self
).
__init__
()
self
.
attention
=
BertAttention
(
config
)
self
.
attention
=
BertAttention
(
config
)
self
.
intermediate
=
BertIntermediate
(
config
)
self
.
intermediate
=
BertIntermediate
(
config
)
self
.
output
=
BertOutput
(
config
)
self
.
output
=
BertOutput
(
config
)
...
@@ -336,7 +336,7 @@ class BertEncoder(nn.Module):
...
@@ -336,7 +336,7 @@ class BertEncoder(nn.Module):
super
(
BertEncoder
,
self
).
__init__
()
super
(
BertEncoder
,
self
).
__init__
()
self
.
output_attentions
=
config
.
output_attentions
self
.
output_attentions
=
config
.
output_attentions
self
.
output_hidden_states
=
config
.
output_hidden_states
self
.
output_hidden_states
=
config
.
output_hidden_states
self
.
layer
=
nn
.
ModuleList
([
BertLayer
(
config
)
for
_
in
range
(
config
.
num_hidden_layers
)])
self
.
layer
=
nn
.
ModuleList
([
Bert
Encoder
Layer
(
config
)
for
_
in
range
(
config
.
num_hidden_layers
)])
def
forward
(
self
,
hidden_states
,
attention_mask
=
None
,
head_mask
=
None
):
def
forward
(
self
,
hidden_states
,
attention_mask
=
None
,
head_mask
=
None
):
all_hidden_states
=
()
all_hidden_states
=
()
...
...
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