From 3849b18b86636ae088a90fd7eeddfb8904491744 Mon Sep 17 00:00:00 2001
From: Rishi Sharma <rishi.sharma@epfl.ch>
Date: Tue, 23 Nov 2021 16:06:34 +0100
Subject: [PATCH] DEBUG:Divide by zero

---
 config.ini                             | 2 +-
 src/decentralizepy/datasets/Femnist.py | 4 ++++
 testing.py                             | 2 +-
 3 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/config.ini b/config.ini
index 492a4c4..07a6d9b 100644
--- a/config.ini
+++ b/config.ini
@@ -16,7 +16,7 @@ lr = 0.01
 [TRAIN_PARAMS]
 training_package = decentralizepy.training.Training
 training_class = Training
-epochs_per_round = 1
+epochs_per_round = 5
 batch_size = 1024
 shuffle = True
 loss_package = torch.nn
diff --git a/src/decentralizepy/datasets/Femnist.py b/src/decentralizepy/datasets/Femnist.py
index ccafb16..13cbff2 100644
--- a/src/decentralizepy/datasets/Femnist.py
+++ b/src/decentralizepy/datasets/Femnist.py
@@ -116,6 +116,8 @@ class Femnist(Dataset):
         self.train_y = np.array(my_train_data["y"], dtype=np.dtype("int64")).reshape(-1)
         logging.debug("train_x.shape: %s", str(self.train_x.shape))
         logging.debug("train_y.shape: %s", str(self.train_y.shape))
+        assert self.train_x.shape[0] == self.train_y.shape[0]
+        assert self.train_x.shape[0] > 0
 
     def load_testset(self):
         logging.info("Loading testing set.")
@@ -135,6 +137,8 @@ class Femnist(Dataset):
         self.test_y = np.array(test_y, dtype=np.dtype("int64")).reshape(-1)
         logging.debug("test_x.shape: %s", str(self.test_x.shape))
         logging.debug("test_y.shape: %s", str(self.test_y.shape))
+        assert self.test_x.shape[0] == self.test_y.shape[0]
+        assert self.test_x.shape[0] > 0
 
     def __init__(
         self,
diff --git a/testing.py b/testing.py
index 5a50a3b..0d27c9b 100644
--- a/testing.py
+++ b/testing.py
@@ -42,5 +42,5 @@ if __name__ == "__main__":
     mp.spawn(
         fn=Node,
         nprocs=procs_per_machine,
-        args=[m_id, l, g, my_config, 20, "results", logging.DEBUG],
+        args=[m_id, l, g, my_config, 20, "results", logging.INFO],
     )
-- 
GitLab