Unverified Commit 9e376e15 authored by Donna Choi's avatar Donna Choi Committed by GitHub
Browse files

Add condition (#7161)

parent f8590c56
...@@ -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]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment