Skip to content
This repository has been archived by the owner on Nov 8, 2018. It is now read-only.

Commit

Permalink
Move shuffling procedure
Browse files Browse the repository at this point in the history
  • Loading branch information
Joeri Hermans committed Oct 18, 2016
1 parent 2bc70de commit 8f3c45f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions distkeras/distributed.py
Original file line number Diff line number Diff line change
Expand Up @@ -424,9 +424,6 @@ def allocate_worker(self):
def train(self, data, shuffle=False):
# Start the communication service.
self.start_service()
# Check if the data needs to be shuffled.
if shuffle:
data = shuffle(data)
# Allocate a worker program.
worker = self.allocate_worker()
# Fetch the current number of partitions.
Expand All @@ -436,6 +433,9 @@ def train(self, data, shuffle=False):
data = data.coalesce(self.num_workers)
else:
data = data.repartition(self.num_workers)
# Check if the data needs to be shuffled.
if shuffle:
data = shuffle(data)
for i in range(0, self.num_epoch):
data.rdd.mapPartitionsWithIndex(worker.train).collect()
# Stop the communication service.
Expand Down

0 comments on commit 8f3c45f

Please sign in to comment.