From 50507efb42f6308998aab6af6080497b631a9ce9 Mon Sep 17 00:00:00 2001
From: Rishi Sharma <rishi.sharma@epfl.ch>
Date: Tue, 11 Jan 2022 10:24:34 +0100
Subject: [PATCH] log_dir moved to sharing

---
 eval/main.ipynb                            | 2 +-
 src/decentralizepy/sharing/PartialModel.py | 5 ++---
 src/decentralizepy/sharing/Sharing.py      | 5 ++++-
 3 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/eval/main.ipynb b/eval/main.ipynb
index 2f23eea..e25d47c 100644
--- a/eval/main.ipynb
+++ b/eval/main.ipynb
@@ -3724,7 +3724,7 @@
    "name": "python",
    "nbconvert_exporter": "python",
    "pygments_lexer": "ipython3",
-   "version": "3.9.9"
+   "version": "3.9.7"
   },
   "orig_nbformat": 4
  },
diff --git a/src/decentralizepy/sharing/PartialModel.py b/src/decentralizepy/sharing/PartialModel.py
index 0836d78..52e002e 100644
--- a/src/decentralizepy/sharing/PartialModel.py
+++ b/src/decentralizepy/sharing/PartialModel.py
@@ -41,14 +41,13 @@ class PartialModel(Sharing):
         model : decentralizepy.models.Model
             Model to train
         dataset : decentralizepy.datasets.Dataset
-            Dataset for sharing data. Not implemented yer! TODO
+            Dataset for sharing data. Not implemented yet! TODO
         log_dir : str
             Location to write shared_params (only writing for 2 procs per machine)
         """
         super().__init__(
-            rank, machine_id, communication, mapping, graph, model, dataset
+            rank, machine_id, communication, mapping, graph, model, dataset, log_dir
         )
-        self.log_dir = log_dir
         self.alpha = alpha
         self.dict_ordered = dict_ordered
         self.save_shared = save_shared
diff --git a/src/decentralizepy/sharing/Sharing.py b/src/decentralizepy/sharing/Sharing.py
index 25167ff..c8ef9f1 100644
--- a/src/decentralizepy/sharing/Sharing.py
+++ b/src/decentralizepy/sharing/Sharing.py
@@ -11,7 +11,9 @@ class Sharing:
     API defining who to share with and what, and what to do on receiving
     """
 
-    def __init__(self, rank, machine_id, communication, mapping, graph, model, dataset):
+    def __init__(
+        self, rank, machine_id, communication, mapping, graph, model, dataset, log_dir
+    ):
         """
         Constructor
         Parameters
@@ -42,6 +44,7 @@ class Sharing:
         self.model = model
         self.dataset = dataset
         self.communication_round = 0
+        self.log_dir = log_dir
 
         self.peer_deques = dict()
         my_neighbors = self.graph.neighbors(self.uid)
-- 
GitLab