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
ec6fb25c
"docs/zh_cn/vscode:/vscode.git/clone" did not exist on "74bbc075fa79356abcd8ed773dae31d082124192"
Commit
ec6fb25c
authored
Dec 10, 2019
by
LysandreJik
Browse files
Patch documentation
parent
41858924
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
1 deletion
+1
-1
transformers/modeling_bert.py
transformers/modeling_bert.py
+1
-1
No files found.
transformers/modeling_bert.py
View file @
ec6fb25c
...
...
@@ -891,7 +891,7 @@ class BertForMaskedLM(BertPreTrainedModel):
# 2. If `lm_labels` is provided we are in a causal scenario where we
# try to predict the next token for each input in the decoder.
if
masked_lm_labels
is
not
None
:
loss_fct
=
CrossEntropyLoss
()
# -1 index = padding token
loss_fct
=
CrossEntropyLoss
()
# -1
00
index = padding token
masked_lm_loss
=
loss_fct
(
prediction_scores
.
view
(
-
1
,
self
.
config
.
vocab_size
),
masked_lm_labels
.
view
(
-
1
))
outputs
=
(
masked_lm_loss
,)
+
outputs
...
...
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