Skip to content

Commit f9254b9

Browse files
authored
Merge pull request #328 from kinghuin/fix15bug
fix data_feeder bug
2 parents ab06f63 + db45f4c commit f9254b9

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

paddlehub/finetune/task/base_task.py

+9-2
Original file line numberDiff line numberDiff line change
@@ -836,9 +836,16 @@ def _run_with_data_feeder(self, do_eval=False):
836836
global_run_states = []
837837
period_run_states = []
838838

839+
parallel_batch = []
839840
for run_step, batch in enumerate(self.reader(), start=1):
840-
if self.config.use_data_parallel and len(batch) < self.device_count:
841-
continue
841+
if self.config.use_data_parallel:
842+
parallel_batch += batch
843+
if len(parallel_batch) < self.device_count:
844+
continue
845+
else:
846+
batch = parallel_batch
847+
parallel_batch = []
848+
842849
step_run_state = RunState(len(self.fetch_list))
843850
step_run_state.run_step = 1
844851
num_batch_examples = len(batch)

0 commit comments

Comments
 (0)