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
8f8bbd4a
Unverified
Commit
8f8bbd4a
authored
Feb 01, 2019
by
Thomas Wolf
Committed by
GitHub
Feb 01, 2019
Browse files
Merge pull request #244 from deepset-ai/prettify_lm_masking
Avoid confusion of inplace LM masking
parents
e2d53d95
ce75b169
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
examples/run_lm_finetuning.py
examples/run_lm_finetuning.py
+2
-2
No files found.
examples/run_lm_finetuning.py
View file @
8f8bbd4a
...
@@ -328,8 +328,8 @@ def convert_example_to_features(example, max_seq_length, tokenizer):
...
@@ -328,8 +328,8 @@ def convert_example_to_features(example, max_seq_length, tokenizer):
# Account for [CLS], [SEP], [SEP] with "- 3"
# Account for [CLS], [SEP], [SEP] with "- 3"
_truncate_seq_pair
(
tokens_a
,
tokens_b
,
max_seq_length
-
3
)
_truncate_seq_pair
(
tokens_a
,
tokens_b
,
max_seq_length
-
3
)
t
1_random
,
t1_label
=
random_word
(
tokens_a
,
tokenizer
)
t
okens_a
,
t1_label
=
random_word
(
tokens_a
,
tokenizer
)
t
2_random
,
t2_label
=
random_word
(
tokens_b
,
tokenizer
)
t
okens_b
,
t2_label
=
random_word
(
tokens_b
,
tokenizer
)
# concatenate lm labels and account for CLS, SEP, SEP
# concatenate lm labels and account for CLS, SEP, SEP
lm_label_ids
=
([
-
1
]
+
t1_label
+
[
-
1
]
+
t2_label
+
[
-
1
])
lm_label_ids
=
([
-
1
]
+
t1_label
+
[
-
1
]
+
t2_label
+
[
-
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