-
Notifications
You must be signed in to change notification settings - Fork 215
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Federated Runtime - Initial Implementation (#1190)
* Introduction to FederatedRuntime Signed-off-by: Ishant Thakare <[email protected]> * Updated aggregator Signed-off-by: Ishant Thakare <[email protected]> * updated collaborator & added 101_MNIST federated_runtime tutorial Signed-off-by: Ishant Thakare <[email protected]> * Updated code & fixed stream_stdout Signed-off-by: Ishant Thakare <[email protected]> * Adding testcases for FederatedRuntime Signed-off-by: Ishant Thakare <[email protected]> * Fixed formatting issues Signed-off-by: Ishant Thakare <[email protected]> * Fix formatting issues Signed-off-by: Ishant Thakare <[email protected]> * Incorporated internal review comments Signed-off-by: Ishant Thakare <[email protected]> * Fix checkpoint issue Signed-off-by: Ishant Thakare <[email protected]> * Updated FederatedRuntime Tutorials Signed-off-by: Ishant Thakare <[email protected]> * Updated tutorial Signed-off-by: Ishant Thakare <[email protected]> * Incorporated Teo's review comments Signed-off-by: Ishant Thakare <[email protected]> * Incorporated Teo's review comments Signed-off-by: Ishant Thakare <[email protected]> * Incorporated review comment Signed-off-by: Ishant Thakare <[email protected]> * Incorporate review comment Co-authored-by: Patrick Foley <[email protected]> * Updated Workflow Interface documentation Signed-off-by: Ishant Thakare <[email protected]> * Fix certificates for federated_runtime.py Signed-off-by: Ishant Thakare <[email protected]> --------- Signed-off-by: Ishant Thakare <[email protected]> Co-authored-by: Patrick Foley <[email protected]>
- Loading branch information
Showing
153 changed files
with
8,955 additions
and
277 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
...-tutorials/experimental/workflow/FederatedRuntime/101_MNIST/Portland/Portland_config.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Portland: | ||
private_attributes: private_attributes.portland_attrs |
50 changes: 50 additions & 0 deletions
50
...tutorials/experimental/workflow/FederatedRuntime/101_MNIST/Portland/private_attributes.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# Copyright (C) 2020-2024 Intel Corporation | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
from copy import deepcopy | ||
|
||
import torch | ||
import torchvision | ||
|
||
# Download Train and Test datasets | ||
mnist_train = torchvision.datasets.MNIST( | ||
"../files/", | ||
train=True, | ||
download=True, | ||
transform=torchvision.transforms.Compose( | ||
[ | ||
torchvision.transforms.ToTensor(), | ||
torchvision.transforms.Normalize((0.1307,), (0.3081,)), | ||
] | ||
), | ||
) | ||
|
||
mnist_test = torchvision.datasets.MNIST( | ||
"../files/", | ||
train=False, | ||
download=True, | ||
transform=torchvision.transforms.Compose( | ||
[ | ||
torchvision.transforms.ToTensor(), | ||
torchvision.transforms.Normalize((0.1307,), (0.3081,)), | ||
] | ||
), | ||
) | ||
|
||
# shard the dataset according to collaborator index | ||
portland_col_idx = 0 | ||
n_collaborators = 2 | ||
batch_size = 32 | ||
|
||
train = deepcopy(mnist_train) | ||
test = deepcopy(mnist_test) | ||
|
||
train.data = mnist_train.data[portland_col_idx::n_collaborators] | ||
train.targets = mnist_train.targets[portland_col_idx::n_collaborators] | ||
test.data = mnist_test.data[portland_col_idx::n_collaborators] | ||
test.targets = mnist_test.targets[portland_col_idx::n_collaborators] | ||
|
||
portland_attrs = { | ||
"train_loader": torch.utils.data.DataLoader(train, batch_size=batch_size, shuffle=False), | ||
"test_loader": torch.utils.data.DataLoader(test, batch_size=batch_size, shuffle=False), | ||
} |
6 changes: 6 additions & 0 deletions
6
openfl-tutorials/experimental/workflow/FederatedRuntime/101_MNIST/Portland/start_envoy.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/bash | ||
set -e | ||
ENVOY_NAME=$1 | ||
ENVOY_CONF=$2 | ||
|
||
fx envoy start -n "$ENVOY_NAME" --disable-tls --envoy-config-path "$ENVOY_CONF" -dh localhost -dp 50050 |
Oops, something went wrong.