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
8aa3b753
Unverified
Commit
8aa3b753
authored
Oct 15, 2019
by
Thomas Wolf
Committed by
GitHub
Oct 15, 2019
Browse files
Merge pull request #1434 from bryant1410/patch-1
Remove unnecessary use of FusedLayerNorm in XLNet
parents
621e7a25
1dea291a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
5 deletions
+2
-5
transformers/modeling_xlnet.py
transformers/modeling_xlnet.py
+2
-5
No files found.
transformers/modeling_xlnet.py
View file @
8aa3b753
...
@@ -188,11 +188,8 @@ def swish(x):
...
@@ -188,11 +188,8 @@ def swish(x):
ACT2FN
=
{
"gelu"
:
gelu
,
"relu"
:
torch
.
nn
.
functional
.
relu
,
"swish"
:
swish
}
ACT2FN
=
{
"gelu"
:
gelu
,
"relu"
:
torch
.
nn
.
functional
.
relu
,
"swish"
:
swish
}
try
:
XLNetLayerNorm
=
nn
.
LayerNorm
from
apex.normalization.fused_layer_norm
import
FusedLayerNorm
as
XLNetLayerNorm
except
(
ImportError
,
AttributeError
)
as
e
:
logger
.
info
(
"Better speed can be achieved with apex installed from https://www.github.com/nvidia/apex ."
)
from
torch.nn
import
LayerNorm
as
XLNetLayerNorm
class
XLNetRelativeAttention
(
nn
.
Module
):
class
XLNetRelativeAttention
(
nn
.
Module
):
def
__init__
(
self
,
config
):
def
__init__
(
self
,
config
):
...
...
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