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
cfb7d108
Commit
cfb7d108
authored
Feb 10, 2020
by
Lysandre
Committed by
Lysandre Debut
Feb 10, 2020
Browse files
FlauBERT lang embeddings only when n_langs > 1
parent
b4691a43
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
1 deletion
+1
-1
src/transformers/modeling_flaubert.py
src/transformers/modeling_flaubert.py
+1
-1
No files found.
src/transformers/modeling_flaubert.py
View file @
cfb7d108
...
@@ -231,7 +231,7 @@ class FlaubertModel(XLMModel):
...
@@ -231,7 +231,7 @@ class FlaubertModel(XLMModel):
inputs_embeds
=
self
.
embeddings
(
input_ids
)
inputs_embeds
=
self
.
embeddings
(
input_ids
)
tensor
=
inputs_embeds
+
self
.
position_embeddings
(
position_ids
).
expand_as
(
inputs_embeds
)
tensor
=
inputs_embeds
+
self
.
position_embeddings
(
position_ids
).
expand_as
(
inputs_embeds
)
if
langs
is
not
None
and
self
.
use_lang_emb
:
if
langs
is
not
None
and
self
.
use_lang_emb
and
self
.
config
.
n_langs
>
1
:
tensor
=
tensor
+
self
.
lang_embeddings
(
langs
)
tensor
=
tensor
+
self
.
lang_embeddings
(
langs
)
if
token_type_ids
is
not
None
:
if
token_type_ids
is
not
None
:
tensor
=
tensor
+
self
.
embeddings
(
token_type_ids
)
tensor
=
tensor
+
self
.
embeddings
(
token_type_ids
)
...
...
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