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
9e376e15
"...git@developer.sourcefind.cn:OpenDAS/autoawq_kernels.git" did not exist on "8907d182531718f88d5202c0dfccde90edecfc59"
Unverified
Commit
9e376e15
authored
Sep 16, 2020
by
Donna Choi
Committed by
GitHub
Sep 16, 2020
Browse files
Add condition (#7161)
parent
f8590c56
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
2 deletions
+3
-2
src/transformers/data/data_collator.py
src/transformers/data/data_collator.py
+3
-2
No files found.
src/transformers/data/data_collator.py
View file @
9e376e15
...
@@ -505,10 +505,11 @@ class DataCollatorForNextSentencePrediction:
...
@@ -505,10 +505,11 @@ class DataCollatorForNextSentencePrediction:
# This should rarely go for more than one iteration for large
# This should rarely go for more than one iteration for large
# corpora. However, just to be careful, we try to make sure that
# corpora. However, just to be careful, we try to make sure that
# the random document is not the same as the document
# the random document is not the same as the document
# we're processing.
# we're processing. Also check to make sure that the random document
# is not empty.
for
_
in
range
(
10
):
for
_
in
range
(
10
):
random_document_index
=
random
.
randint
(
0
,
len
(
examples
)
-
1
)
random_document_index
=
random
.
randint
(
0
,
len
(
examples
)
-
1
)
if
random_document_index
!=
doc_index
:
if
random_document_index
!=
doc_index
and
len
(
examples
[
random_document_index
])
>
0
:
break
break
random_document
=
examples
[
random_document_index
]
random_document
=
examples
[
random_document_index
]
...
...
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