-
-
Notifications
You must be signed in to change notification settings - Fork 742
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #583 from FedML-AI/dev/v0.7.0
Dev/v0.7.0
- Loading branch information
Showing
13 changed files
with
114 additions
and
66 deletions.
There are no files selected for viewing
Empty file.
Empty file.
2 changes: 1 addition & 1 deletion
2
python/examples/cross_silo/mqtt_s3_fedavg_defense_mnist_lr_example/run_server.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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
#!/usr/bin/env bash | ||
RUN_ID=$1 | ||
python3 torch_server.py --cf config/krum/fedml_config.yaml --rank 0 --role server --run_id $RUN_ID | ||
python3 torch_server.py --cf config/foolsgold/fedml_config.yaml --rank 0 --role server --run_id $RUN_ID |
12 changes: 12 additions & 0 deletions
12
...les/cross_silo/mqtt_s3_fedavg_mnist_lr_example/custom_data_and_model/config/bootstrap.bat
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,12 @@ | ||
:: ### don't modify this part ### | ||
:: ############################## | ||
|
||
|
||
:: ### please customize your script in this region #### | ||
set DATA_PATH=%userprofile%\fedml_data | ||
mkdir %DATA_PATH% | ||
|
||
|
||
:: ### don't modify this part ### | ||
echo [FedML]Bootstrap Finished | ||
:: ############################## |
Empty file modified
0
...ples/cross_silo/mqtt_s3_fedavg_mnist_lr_example/custom_data_and_model/config/bootstrap.sh
100644 → 100755
Empty file.
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
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
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
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 |
---|---|---|
|
@@ -73,7 +73,7 @@ def finalize_options(self): | |
|
||
setup( | ||
name="fedml", | ||
version="0.7.321", | ||
version="0.7.326", | ||
author="FedML Team", | ||
author_email="[email protected]", | ||
description="A research and production integrated edge-cloud library for " | ||
|
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 |
---|---|---|
@@ -1,35 +1,35 @@ | ||
import argparse | ||
|
||
import torch | ||
|
||
from fedml.core.security.defense.foolsgold_defense import FoolsGoldDefense | ||
from fedml.ml.aggregator.agg_operator import FedMLAggOperator | ||
from utils import create_fake_model_list_MNIST, create_fake_model_list | ||
|
||
|
||
def add_args(use_memory): | ||
def add_args(): | ||
parser = argparse.ArgumentParser(description="FedML") | ||
parser.add_argument( | ||
"--yaml_config_file", "--cf", help="yaml configuration file", type=str, default="", | ||
"--yaml_config_file", | ||
"--cf", | ||
help="yaml configuration file", | ||
type=str, | ||
default="", | ||
) | ||
parser.add_argument("--federated_optimizer", type=str, default="FedAvg") | ||
parser.add_argument("--use_memory", type=bool, default=use_memory) | ||
args, unknown = parser.parse_known_args() | ||
return args | ||
|
||
|
||
def test_fools_gold_score(): | ||
model_list = create_fake_model_list(5) | ||
print(f"modellist len = {len(model_list)}") | ||
grads = [grad for num, grad in model_list] | ||
print(f"fools_gold_score={FoolsGoldDefense.fools_gold_score(grads)}") | ||
|
||
|
||
def test_defense(): | ||
config = add_args(use_memory=True) | ||
model_list = create_fake_model_list_MNIST(3) | ||
config = add_args() | ||
model = torch.hub.load("pytorch/vision:v0.10.0", "vgg11", pretrained=True).state_dict() | ||
model_list = [(100, model) for i in range(4)] | ||
|
||
print(f"model_list len = {len(model_list)}") | ||
defense = FoolsGoldDefense(config) | ||
aggr_result = defense.run(model_list, base_aggregation_func=FedMLAggOperator.agg) | ||
print(f"result = {aggr_result}") | ||
# print(f"result = {aggr_result}") | ||
|
||
|
||
if __name__ == "__main__": | ||
test_fools_gold_score() | ||
test_defense() |