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
5938f31f
Commit
5938f31f
authored
Mar 24, 2019
by
Catalin Voss
Browse files
Fix c/p typo from my experiment code
parent
7797d21b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
1 deletion
+1
-1
pytorch_pretrained_bert/modeling_gpt2.py
pytorch_pretrained_bert/modeling_gpt2.py
+1
-1
No files found.
pytorch_pretrained_bert/modeling_gpt2.py
View file @
5938f31f
...
@@ -619,7 +619,7 @@ class GPT2LMHeadModel(GPT2PreTrainedModel):
...
@@ -619,7 +619,7 @@ class GPT2LMHeadModel(GPT2PreTrainedModel):
if
lm_labels
is
not
None
:
if
lm_labels
is
not
None
:
# Shift so that tokens < n predict n
# Shift so that tokens < n predict n
shift_logits
=
lm_logits
[:,
:
-
1
]
shift_logits
=
lm_logits
[:,
:
-
1
]
shift_labels
=
torch_batch
[:,
1
:]
shift_labels
=
lm_labels
[:,
1
:]
# In tensorflow, it's [batch, d_0, d_1, ..., d_{r-1}, num_classes]
# In tensorflow, it's [batch, d_0, d_1, ..., d_{r-1}, num_classes]
# in pytorch, it's [batch, num_classes, d_0, d_1, ..., d_{r-1}]
# in pytorch, it's [batch, num_classes, d_0, d_1, ..., d_{r-1}]
...
...
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