Skip to content

Commit 5c5eda9

Browse files
committed
update dependencies and added comments in the notebooks
1 parent 16fef4e commit 5c5eda9

File tree

5 files changed

+60
-74
lines changed

5 files changed

+60
-74
lines changed

projects/aries-fl/notebooks/hospital/Hospital.ipynb

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
{
44
"cell_type": "code",
55
"execution_count": 1,
6-
"id": "undefined-customs",
6+
"id": "comfortable-blowing",
77
"metadata": {},
88
"outputs": [
99
{
@@ -32,7 +32,7 @@
3232
{
3333
"cell_type": "code",
3434
"execution_count": 4,
35-
"id": "leading-madness",
35+
"id": "weird-lunch",
3636
"metadata": {},
3737
"outputs": [],
3838
"source": [
@@ -67,7 +67,7 @@
6767
},
6868
{
6969
"cell_type": "markdown",
70-
"id": "periodic-hepatitis",
70+
"id": "anonymous-president",
7171
"metadata": {},
7272
"source": [
7373
"## Copy Invite from Researcher"
@@ -76,7 +76,7 @@
7676
{
7777
"cell_type": "code",
7878
"execution_count": 5,
79-
"id": "right-guatemala",
79+
"id": "expired-double",
8080
"metadata": {},
8181
"outputs": [],
8282
"source": [
@@ -87,7 +87,7 @@
8787
{
8888
"cell_type": "code",
8989
"execution_count": 6,
90-
"id": "future-desert",
90+
"id": "finished-milan",
9191
"metadata": {},
9292
"outputs": [
9393
{
@@ -117,7 +117,7 @@
117117
{
118118
"cell_type": "code",
119119
"execution_count": null,
120-
"id": "narrow-signature",
120+
"id": "objective-fabric",
121121
"metadata": {},
122122
"outputs": [],
123123
"source": [
@@ -131,15 +131,15 @@
131131
{
132132
"cell_type": "code",
133133
"execution_count": null,
134-
"id": "bearing-tuition",
134+
"id": "spanish-officer",
135135
"metadata": {},
136136
"outputs": [],
137137
"source": []
138138
},
139139
{
140140
"cell_type": "code",
141141
"execution_count": null,
142-
"id": "encouraging-guard",
142+
"id": "laughing-demand",
143143
"metadata": {},
144144
"outputs": [],
145145
"source": [
@@ -164,7 +164,7 @@
164164
"name": "python",
165165
"nbconvert_exporter": "python",
166166
"pygments_lexer": "ipython3",
167-
"version": "3.7.6"
167+
"version": "3.8.5"
168168
}
169169
},
170170
"nbformat": 4,

projects/aries-fl/notebooks/hospital/Test DP training.ipynb

Lines changed: 38 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,9 @@
33
{
44
"cell_type": "code",
55
"execution_count": 1,
6-
"id": "excited-registration",
6+
"id": "exciting-romance",
77
"metadata": {},
8-
"outputs": [
9-
{
10-
"ename": "ImportError",
11-
"evalue": "libtorch_cpu.so: cannot open shared object file: No such file or directory",
12-
"output_type": "error",
13-
"traceback": [
14-
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
15-
"\u001b[0;31mImportError\u001b[0m Traceback (most recent call last)",
16-
"\u001b[0;32m<ipython-input-1-ebded2444677>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m 21\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0msys\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 22\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 23\u001b[0;31m \u001b[0;32mimport\u001b[0m \u001b[0mtorchcsprng\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0mcsprng\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 24\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 25\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0mopacus\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mPrivacyEngine\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
17-
"\u001b[0;32m/opt/conda/lib/python3.7/site-packages/torchcsprng/__init__.py\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m 8\u001b[0m \u001b[0;32mdel\u001b[0m \u001b[0mtorch\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 9\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 10\u001b[0;31m \u001b[0;32mfrom\u001b[0m \u001b[0mtorchcsprng\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_C\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0;34m*\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
18-
"\u001b[0;31mImportError\u001b[0m: libtorch_cpu.so: cannot open shared object file: No such file or directory"
19-
]
20-
}
21-
],
8+
"outputs": [],
229
"source": [
2310
"import numpy as np # linear algebra\n",
2411
"import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\n",
@@ -42,26 +29,16 @@
4229
"import os\n",
4330
"import sys\n",
4431
"\n",
45-
"import torchcsprng as csprng\n",
32+
"# import torchcsprng as csprng\n",
4633
"\n",
4734
"from opacus import PrivacyEngine\n",
48-
"from collections import OrderedDict"
35+
"# from collections import OrderedDict"
4936
]
5037
},
5138
{
5239
"cell_type": "code",
5340
"execution_count": 2,
54-
"id": "elegant-carolina",
55-
"metadata": {},
56-
"outputs": [],
57-
"source": [
58-
"import torch"
59-
]
60-
},
61-
{
62-
"cell_type": "code",
63-
"execution_count": 3,
64-
"id": "british-hopkins",
41+
"id": "wicked-cyprus",
6542
"metadata": {},
6643
"outputs": [
6744
{
@@ -81,19 +58,21 @@
8158
{
8259
"cell_type": "code",
8360
"execution_count": null,
84-
"id": "controlled-boxing",
61+
"id": "regulation-witch",
8562
"metadata": {},
8663
"outputs": [],
8764
"source": [
88-
"try: privacy_engine\n",
89-
"except NameError: print(\"The Privacy Engine is already Detached\")\n",
90-
"else: privacy_engine.detach()"
65+
"# This is to check if the Differential Privacy engine is attached to the optimizer.\n",
66+
"\n",
67+
"# try: privacy_engine\n",
68+
"# except NameError: print(\"The Privacy Engine is already Detached\")\n",
69+
"# else: privacy_engine.detach()"
9170
]
9271
},
9372
{
9473
"cell_type": "code",
9574
"execution_count": 3,
96-
"id": "opponent-figure",
75+
"id": "cosmetic-undergraduate",
9776
"metadata": {},
9877
"outputs": [
9978
{
@@ -236,12 +215,14 @@
236215
{
237216
"cell_type": "code",
238217
"execution_count": 4,
239-
"id": "demonstrated-problem",
218+
"id": "continental-chemistry",
240219
"metadata": {},
241220
"outputs": [],
242221
"source": [
243222
"# We could move this block to a Researcher's notebook\n",
244223
"\n",
224+
"# Define model architecture\n",
225+
"\n",
245226
"model = nn.Sequential(\n",
246227
" nn.Linear(8, 4),\n",
247228
" nn.Sigmoid(),\n",
@@ -259,7 +240,7 @@
259240
"# nn.Linear(2, 1),\n",
260241
"# nn.Sigmoid()\n",
261242
"# )\n",
262-
"# define model architecture\n",
243+
"\n",
263244
"# model = nn.Sequential(OrderedDict([\n",
264245
"# ('fc1', nn.Linear(8, 4)),\n",
265246
"# ('relu1', nn.ReLU()),\n",
@@ -269,6 +250,9 @@
269250
"# ('sigmoid', nn.Sigmoid())\n",
270251
"# ]))\n",
271252
"\n",
253+
"\n",
254+
"# Save the Model\n",
255+
"\n",
272256
"torch.save(model, \"untrained_model.pt\")\n",
273257
"\n",
274258
"# In a Researcher's notebook after saving the model, we have to send it to the Hospitals"
@@ -277,8 +261,10 @@
277261
{
278262
"cell_type": "code",
279263
"execution_count": 5,
280-
"id": "announced-witness",
281-
"metadata": {},
264+
"id": "amateur-allowance",
265+
"metadata": {
266+
"scrolled": true
267+
},
282268
"outputs": [
283269
{
284270
"name": "stdout",
@@ -303,7 +289,7 @@
303289
{
304290
"cell_type": "code",
305291
"execution_count": 6,
306-
"id": "hungarian-consumption",
292+
"id": "focal-radical",
307293
"metadata": {
308294
"scrolled": true
309295
},
@@ -334,7 +320,7 @@
334320
{
335321
"cell_type": "code",
336322
"execution_count": 7,
337-
"id": "changing-ivory",
323+
"id": "sized-proceeding",
338324
"metadata": {},
339325
"outputs": [],
340326
"source": [
@@ -367,23 +353,23 @@
367353
{
368354
"cell_type": "code",
369355
"execution_count": 8,
370-
"id": "appreciated-tender",
356+
"id": "alternative-logan",
371357
"metadata": {},
372358
"outputs": [
373359
{
374360
"name": "stdout",
375361
"output_type": "stream",
376362
"text": [
377-
"loss at epoch 0 : tensor(0.2560)\n",
378-
"loss at epoch 5000 : tensor(0.1331)\n",
379-
"loss at epoch 10000 : tensor(0.1229)\n",
380-
"loss at epoch 15000 : tensor(0.1140)\n",
381-
"loss at epoch 20000 : tensor(0.1120)\n",
382-
"loss at epoch 25000 : tensor(0.1109)\n",
383-
"loss at epoch 30000 : tensor(0.1102)\n",
384-
"loss at epoch 35000 : tensor(0.1094)\n",
385-
"loss at epoch 40000 : tensor(0.1088)\n",
386-
"loss at epoch 45000 : tensor(0.1084)\n"
363+
"loss at epoch 0 : tensor(0.2467)\n",
364+
"loss at epoch 5000 : tensor(0.1213)\n",
365+
"loss at epoch 10000 : tensor(0.1138)\n",
366+
"loss at epoch 15000 : tensor(0.1111)\n",
367+
"loss at epoch 20000 : tensor(0.1095)\n",
368+
"loss at epoch 25000 : tensor(0.1082)\n",
369+
"loss at epoch 30000 : tensor(0.1073)\n",
370+
"loss at epoch 35000 : tensor(0.1064)\n",
371+
"loss at epoch 40000 : tensor(0.1056)\n",
372+
"loss at epoch 45000 : tensor(0.1049)\n"
387373
]
388374
}
389375
],
@@ -394,7 +380,7 @@
394380
{
395381
"cell_type": "code",
396382
"execution_count": null,
397-
"id": "rubber-insight",
383+
"id": "instant-insulin",
398384
"metadata": {},
399385
"outputs": [],
400386
"source": []
@@ -416,7 +402,7 @@
416402
"name": "python",
417403
"nbconvert_exporter": "python",
418404
"pygments_lexer": "ipython3",
419-
"version": "3.7.6"
405+
"version": "3.8.5"
420406
}
421407
},
422408
"nbformat": 4,

projects/aries-fl/notebooks/researcher/Researcher.ipynb

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
{
44
"cell_type": "code",
55
"execution_count": 1,
6-
"id": "coastal-assembly",
6+
"id": "adjacent-reference",
77
"metadata": {},
88
"outputs": [
99
{
@@ -34,7 +34,7 @@
3434
{
3535
"cell_type": "code",
3636
"execution_count": 2,
37-
"id": "opposed-nerve",
37+
"id": "piano-duplicate",
3838
"metadata": {},
3939
"outputs": [],
4040
"source": [
@@ -71,7 +71,7 @@
7171
{
7272
"cell_type": "code",
7373
"execution_count": 3,
74-
"id": "secret-saskatchewan",
74+
"id": "compressed-advancement",
7575
"metadata": {},
7676
"outputs": [
7777
{
@@ -100,7 +100,7 @@
100100
},
101101
{
102102
"cell_type": "markdown",
103-
"id": "forward-coordinate",
103+
"id": "directed-intro",
104104
"metadata": {},
105105
"source": [
106106
"## Copy the invitation output from 4 and to the hospital notebook you are connecting to."
@@ -109,7 +109,7 @@
109109
{
110110
"cell_type": "code",
111111
"execution_count": 4,
112-
"id": "requested-water",
112+
"id": "fifth-irish",
113113
"metadata": {},
114114
"outputs": [
115115
{
@@ -135,7 +135,7 @@
135135
{
136136
"cell_type": "code",
137137
"execution_count": 5,
138-
"id": "confirmed-atlantic",
138+
"id": "starting-elephant",
139139
"metadata": {},
140140
"outputs": [
141141
{
@@ -156,7 +156,7 @@
156156
{
157157
"cell_type": "code",
158158
"execution_count": null,
159-
"id": "democratic-glossary",
159+
"id": "south-cream",
160160
"metadata": {},
161161
"outputs": [],
162162
"source": [
@@ -166,7 +166,7 @@
166166
{
167167
"cell_type": "code",
168168
"execution_count": null,
169-
"id": "welcome-haiti",
169+
"id": "designed-monkey",
170170
"metadata": {},
171171
"outputs": [],
172172
"source": [
@@ -191,7 +191,7 @@
191191
"name": "python",
192192
"nbconvert_exporter": "python",
193193
"pygments_lexer": "ipython3",
194-
"version": "3.7.6"
194+
"version": "3.8.5"
195195
}
196196
},
197197
"nbformat": 4,

projects/aries-fl/requirements.hospital.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@ numpy==1.17.3
22
pandas==0.25.2
33
matplotlib==3.1.1
44
seaborn==0.9.0
5-
torch==1.3.0
6-
sklearn
5+
https://download.pytorch.org/whl/cpu/torch-1.7.0%2Bcpu-cp36-cp36m-linux_x86_64.whl
6+
sklearn
7+
opacus

projects/aries-fl/requirements.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ numpy==1.17.3
33
pandas==0.25.2
44
matplotlib==3.1.1
55
seaborn==0.9.0
6-
torch==1.3.0
6+
https://download.pytorch.org/whl/cpu/torch-1.7.0%2Bcpu-cp36-cp36m-linux_x86_64.whl
77
sklearn
88
opacus
9-
torchcsprng

0 commit comments

Comments
 (0)