Skip to content

Commit

Permalink
change FedIoT APIs to FedMLRunner
Browse files Browse the repository at this point in the history
  • Loading branch information
chaoyanghe committed Jul 13, 2022
1 parent 87c7dee commit c9e1ef7
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 61 deletions.
4 changes: 2 additions & 2 deletions iot/anomaly_detection_for_cybersecurity/build_mlops_pkg.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
SOURCE=.
ENTRY=torch_client.py
ENTRY=fedml_iot.py
CONFIG=config
DEST=./mlops
fedml build -t client -sf $SOURCE -ep $ENTRY -cf $CONFIG -df $DEST


SOURCE=.
ENTRY=torch_server.py
ENTRY=fedml_iot.py
CONFIG=config
DEST=./mlops
fedml build -t server -sf $SOURCE -ep $ENTRY -cf $CONFIG -df $DEST
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import fedml
from fedml.cross_silo import Client
from data.data_loader import load_data
from fedml import FedMLRunner
from model.autoencoder import AutoEncoder
from trainer.fed_detect_trainer import MyModelTrainer


if __name__ == "__main__":
# init FedML framework
args = fedml.init()
Expand All @@ -22,5 +21,5 @@
trainer = MyModelTrainer(model)

# start training
client = Client(args, device, dataset, model, trainer)
client.run()
fedml_runner = FedMLRunner(args, device, dataset, model, trainer)
fedml_runner.run()
2 changes: 1 addition & 1 deletion iot/anomaly_detection_for_cybersecurity/run_client.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/usr/bin/env bash
RANK=$1
python3 torch_client.py --cf config/fedml_config.yaml --rank $RANK
python3 fedml_iot.py --cf config/fedml_config.yaml --rank $RANK --role client
2 changes: 1 addition & 1 deletion iot/anomaly_detection_for_cybersecurity/run_server.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/usr/bin/env bash

python3 torch_server.py --cf config/fedml_config.yaml --rank 0
python3 fedml_iot.py --cf config/fedml_config.yaml --rank 0 --role server
2 changes: 1 addition & 1 deletion iot/anomaly_detection_for_cybersecurity/run_simulation.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ hostname > mpi_host_file

$(which mpirun) -np $PROCESS_NUM \
-hostfile mpi_host_file \
python torch_centralized_simulation.py --cf config_simulation/fedml_config.yaml
python fedml_iot.py --cf config_simulation/fedml_config.yaml

This file was deleted.

26 changes: 0 additions & 26 deletions iot/anomaly_detection_for_cybersecurity/torch_server.py

This file was deleted.

0 comments on commit c9e1ef7

Please sign in to comment.