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
chenpangpang
transformers
Commits
98dd19b9
Unverified
Commit
98dd19b9
authored
Sep 22, 2019
by
Santiago Castro
Committed by
GitHub
Sep 22, 2019
Browse files
Remove unnecessary use of FusedLayerNorm
parent
a2d4950f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
5 deletions
+1
-5
pytorch_transformers/modeling_bert.py
pytorch_transformers/modeling_bert.py
+1
-5
No files found.
pytorch_transformers/modeling_bert.py
View file @
98dd19b9
...
@@ -133,11 +133,7 @@ def swish(x):
...
@@ -133,11 +133,7 @@ def swish(x):
ACT2FN
=
{
"gelu"
:
gelu
,
"relu"
:
torch
.
nn
.
functional
.
relu
,
"swish"
:
swish
}
ACT2FN
=
{
"gelu"
:
gelu
,
"relu"
:
torch
.
nn
.
functional
.
relu
,
"swish"
:
swish
}
try
:
BertLayerNorm
=
torch
.
nn
.
LayerNorm
from
apex.normalization.fused_layer_norm
import
FusedLayerNorm
as
BertLayerNorm
except
(
ImportError
,
AttributeError
)
as
e
:
logger
.
info
(
"Better speed can be achieved with apex installed from https://www.github.com/nvidia/apex ."
)
BertLayerNorm
=
torch
.
nn
.
LayerNorm
class
BertEmbeddings
(
nn
.
Module
):
class
BertEmbeddings
(
nn
.
Module
):
"""Construct the embeddings from word, position and token_type embeddings.
"""Construct the embeddings from word, position and token_type embeddings.
...
...
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