From fe4e183feab6fc6dfecbcbb6ac9fa9229e917bf3 Mon Sep 17 00:00:00 2001 From: Yibing Liu Date: Tue, 16 Apr 2019 02:42:48 +0000 Subject: [PATCH] Fix data yield --- BERT/reader/cls.py | 5 +++-- BERT/reader/squad.py | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/BERT/reader/cls.py b/BERT/reader/cls.py index cebd583..2c75479 100644 --- a/BERT/reader/cls.py +++ b/BERT/reader/cls.py @@ -196,10 +196,11 @@ class DataProcessor(object): return_num_token=False) if len(all_dev_batches) < dev_count: all_dev_batches.append(batch_data) - else: + + if len(all_dev_batches) == dev_count: for batch in all_dev_batches: yield batch - all_dev_batches = [batch_data] + all_dev_batches = [] return wrapper diff --git a/BERT/reader/squad.py b/BERT/reader/squad.py index 4c69763..90c3496 100644 --- a/BERT/reader/squad.py +++ b/BERT/reader/squad.py @@ -566,10 +566,11 @@ class DataProcessor(object): return_num_token=False) if len(all_dev_batches) < dev_count: all_dev_batches.append(batch_data) - else: + + if len(all_dev_batches) == dev_count: for batch in all_dev_batches: yield batch - all_dev_batches = [batch_data] + all_dev_batches = [] return wrapper -- GitLab