Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test/v0.7.0 #503

Merged
merged 3 commits into from
Aug 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -49,23 +49,23 @@ jobs:
- name: server - cross-silo - attack
run: |
cd examples/cross_silo/mqtt_s3_fedavg_attack_mnist_lr_example
run_id=cross-silo-attack-${{ format('{0}{1}{2}', matrix.os, matrix.arch, matrix.python-version) }}
run_id=cross-silo-attack-${{ format('{0}{1}{2}{3}', github.run_id, matrix.os, matrix.arch, matrix.python-version) }}
echo ${run_id}
bash run_server.sh $run_id
if: ${{ matrix.client-index == '0' }}

- name: client 1 - cross-silo - attack
run: |
cd examples/cross_silo/mqtt_s3_fedavg_attack_mnist_lr_example
run_id=cross-silo-attack-${{ format('{0}{1}{2}', matrix.os, matrix.arch, matrix.python-version) }}
run_id=cross-silo-attack-${{ format('{0}{1}{2}{3}', github.run_id, matrix.os, matrix.arch, matrix.python-version) }}
echo run_id
bash run_client.sh 1 $run_id
if: ${{ matrix.client-index == '1' }}

- name: client 2 - cross-silo - attack
run: |
cd examples/cross_silo/mqtt_s3_fedavg_attack_mnist_lr_example
run_id=cross-silo-attack-${{ format('{0}{1}{2}', matrix.os, matrix.arch, matrix.python-version) }}
run_id=cross-silo-attack-${{ format('{0}{1}{2}{3}', github.run_id, matrix.os, matrix.arch, matrix.python-version) }}
echo run_id
bash run_client.sh 2 $run_id
if: ${{ matrix.client-index == '2' }}
Original file line number Diff line number Diff line change
Expand Up @@ -49,23 +49,23 @@ jobs:
- name: server - cross-silo - defense
run: |
cd examples/cross_silo/mqtt_s3_fedavg_defense_mnist_lr_example
run_id=cross-silo-defense-${{ format('{0}{1}{2}', matrix.os, matrix.arch, matrix.python-version) }}
run_id=cross-silo-defense-${{ format('{0}{1}{2}{3}', github.run_id, matrix.os, matrix.arch, matrix.python-version) }}
echo ${run_id}
bash run_server.sh $run_id
if: ${{ matrix.client-index == '0' }}

- name: client 1 - cross-silo - defense
run: |
cd examples/cross_silo/mqtt_s3_fedavg_defense_mnist_lr_example
run_id=cross-silo-defense-${{ format('{0}{1}{2}', matrix.os, matrix.arch, matrix.python-version) }}
run_id=cross-silo-defense-${{ format('{0}{1}{2}{3}', github.run_id, matrix.os, matrix.arch, matrix.python-version) }}
echo run_id
bash run_client.sh 1 $run_id
if: ${{ matrix.client-index == '1' }}

- name: client 2 - cross-silo - defense
run: |
cd examples/cross_silo/mqtt_s3_fedavg_defense_mnist_lr_example
run_id=cross-silo-defense-${{ format('{0}{1}{2}', matrix.os, matrix.arch, matrix.python-version) }}
run_id=cross-silo-defense-${{ format('{0}{1}{2}{3}', github.run_id, matrix.os, matrix.arch, matrix.python-version) }}
echo run_id
bash run_client.sh 2 $run_id
if: ${{ matrix.client-index == '2' }}
6 changes: 3 additions & 3 deletions .github/workflows/smoke_test_cross_silo_fedavg_dp_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,23 +49,23 @@ jobs:
- name: server - cross-silo - cdp
run: |
cd examples/cross_silo/mqtt_s3_fedavg_central_dp_mnist_lr_example
run_id=cross-silo-ho-${{ format('{0}{1}{2}', matrix.os, matrix.arch, matrix.python-version) }}
run_id=cross-silo-ho-${{ format('{0}{1}{2}{3}', github.run_id, matrix.os, matrix.arch, matrix.python-version) }}
echo ${run_id}
bash run_server.sh $run_id
if: ${{ matrix.client-index == '0' }}

- name: client 1 - cross-silo - cdp
run: |
cd examples/cross_silo/mqtt_s3_fedavg_central_dp_mnist_lr_example
run_id=cross-silo-ho-${{ format('{0}{1}{2}', matrix.os, matrix.arch, matrix.python-version) }}
run_id=cross-silo-ho-${{ format('{0}{1}{2}{3}', github.run_id, matrix.os, matrix.arch, matrix.python-version) }}
echo run_id
bash run_client.sh 1 $run_id
if: ${{ matrix.client-index == '1' }}

- name: client 2 - cross-silo - cdp
run: |
cd examples/cross_silo/mqtt_s3_fedavg_central_dp_mnist_lr_example
run_id=cross-silo-ho-${{ format('{0}{1}{2}', matrix.os, matrix.arch, matrix.python-version) }}
run_id=cross-silo-ho-${{ format('{0}{1}{2}{3}', github.run_id, matrix.os, matrix.arch, matrix.python-version) }}
echo run_id
bash run_client.sh 2 $run_id
if: ${{ matrix.client-index == '2' }}
6 changes: 3 additions & 3 deletions .github/workflows/smoke_test_cross_silo_ho_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,23 +49,23 @@ jobs:
- name: server - cross-silo - ho
run: |
cd quick_start/octopus
run_id=cross-silo-ho-${{ format('{0}{1}{2}', matrix.os, matrix.arch, matrix.python-version) }}
run_id=cross-silo-ho-${{ format('{0}{1}{2}{3}', github.run_id, matrix.os, matrix.arch, matrix.python-version) }}
echo ${run_id}
bash run_server.sh $run_id
if: ${{ matrix.client-index == '0' }}

- name: client 1 - cross-silo - ho
run: |
cd quick_start/octopus
run_id=cross-silo-ho-${{ format('{0}{1}{2}', matrix.os, matrix.arch, matrix.python-version) }}
run_id=cross-silo-ho-${{ format('{0}{1}{2}{3}', github.run_id, matrix.os, matrix.arch, matrix.python-version) }}
echo run_id
bash run_client.sh 1 $run_id
if: ${{ matrix.client-index == '1' }}

- name: client 2 - cross-silo - ho
run: |
cd quick_start/octopus
run_id=cross-silo-ho-${{ format('{0}{1}{2}', matrix.os, matrix.arch, matrix.python-version) }}
run_id=cross-silo-ho-${{ format('{0}{1}{2}{3}', github.run_id, matrix.os, matrix.arch, matrix.python-version) }}
echo run_id
bash run_client.sh 2 $run_id
if: ${{ matrix.client-index == '2' }}
6 changes: 3 additions & 3 deletions .github/workflows/smoke_test_cross_silo_ho_win.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,17 @@ jobs:
- name: server - cross-silo - ho
run: |
cd quick_start/octopus
.\run_server.bat ${{ format('{0}{1}{2}', matrix.os, matrix.arch, matrix.python-version) }}
.\run_server.bat ${{ format('{0}{1}{2}{3}', github.run_id, matrix.os, matrix.arch, matrix.python-version) }}
if: ${{ matrix.client-index == '0' }}

- name: client 1 - cross-silo - ho
run: |
cd quick_start/octopus
.\run_client.bat 1 ${{ format('{0}{1}{2}', matrix.os, matrix.arch, matrix.python-version) }}
.\run_client.bat 1 ${{ format('{0}{1}{2}{3}', github.run_id, matrix.os, matrix.arch, matrix.python-version) }}
if: ${{ matrix.client-index == '1' }}

- name: client 2 - cross-silo - ho
run: |
cd quick_start/octopus
.\run_client.bat 2 ${{ format('{0}{1}{2}', matrix.os, matrix.arch, matrix.python-version) }}
.\run_client.bat 2 ${{ format('{0}{1}{2}{3}', github.run_id, matrix.os, matrix.arch, matrix.python-version) }}
if: ${{ matrix.client-index == '2' }}
6 changes: 3 additions & 3 deletions .github/workflows/smoke_test_cross_silo_lightsecagg_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,23 +49,23 @@ jobs:
- name: server - cross-silo - lightsecagg
run: |
cd examples/cross_silo/light_sec_agg_example
run_id=cross-silo-lightsecagg-${{ format('{0}{1}{2}', matrix.os, matrix.arch, matrix.python-version) }}
run_id=cross-silo-lightsecagg-${{ format('{0}{1}{2}{3}', github.run_id, matrix.os, matrix.arch, matrix.python-version) }}
echo ${run_id}
bash run_server.sh $run_id
if: ${{ matrix.client-index == '0' }}

- name: client 1 - cross-silo - lightsecagg
run: |
cd examples/cross_silo/light_sec_agg_example
run_id=cross-silo-lightsecagg-${{ format('{0}{1}{2}', matrix.os, matrix.arch, matrix.python-version) }}
run_id=cross-silo-lightsecagg-${{ format('{0}{1}{2}{3}', github.run_id, matrix.os, matrix.arch, matrix.python-version) }}
echo run_id
bash run_client.sh 1 $run_id
if: ${{ matrix.client-index == '1' }}

- name: client 2 - cross-silo - lightsecagg
run: |
cd examples/cross_silo/light_sec_agg_example
run_id=cross-silo-lightsecagg-${{ format('{0}{1}{2}', matrix.os, matrix.arch, matrix.python-version) }}
run_id=cross-silo-lightsecagg-${{ format('{0}{1}{2}{3}', github.run_id, matrix.os, matrix.arch, matrix.python-version) }}
echo run_id
bash run_client.sh 2 $run_id
if: ${{ matrix.client-index == '2' }}
6 changes: 3 additions & 3 deletions .github/workflows/smoke_test_cross_silo_lightsecagg_win.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,17 @@ jobs:
- name: server - cross-silo - ho
run: |
cd examples/cross_silo/light_sec_agg_example
.\run_server.bat cross-silo-lightsecagg-${{ format('{0}{1}{2}', matrix.os, matrix.arch, matrix.python-version) }}
.\run_server.bat cross-silo-lightsecagg-${{ format('{0}{1}{2}{3}', github.run_id, matrix.os, matrix.arch, matrix.python-version) }}
if: ${{ matrix.client-index == '0' }}

- name: client 1 - cross-silo - ho
run: |
cd examples/cross_silo/light_sec_agg_example
.\run_client.bat 1 cross-silo-lightsecagg-${{ format('{0}{1}{2}', matrix.os, matrix.arch, matrix.python-version) }}
.\run_client.bat 1 cross-silo-lightsecagg-${{ format('{0}{1}{2}{3}', github.run_id, matrix.os, matrix.arch, matrix.python-version) }}
if: ${{ matrix.client-index == '1' }}

- name: client 2 - cross-silo - lightsecagg
run: |
cd examples/cross_silo/light_sec_agg_example
.\run_client.bat 2 cross-silo-lightsecagg-${{ format('{0}{1}{2}', matrix.os, matrix.arch, matrix.python-version) }}
.\run_client.bat 2 cross-silo-lightsecagg-${{ format('{0}{1}{2}{3}', github.run_id, matrix.os, matrix.arch, matrix.python-version) }}
if: ${{ matrix.client-index == '2' }}
6 changes: 3 additions & 3 deletions .github/workflows/smoke_test_ml_engines_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,23 +103,23 @@ jobs:
- name: server - jax - fedavg
run: |
cd examples/cross_silo/jax_haiku_mqtt_s3_fedavg_mnist_lr_example
run_id=jax-ml-engine-${{ format('{0}{1}{2}', matrix.os, matrix.arch, matrix.python-version) }}
run_id=jax-ml-engine-${{ format('{0}{1}{2}{3}', github.run_id, matrix.os, matrix.arch, matrix.python-version) }}
echo ${run_id}
bash run_server.sh $run_id
if: ${{ matrix.client-index == '0' }}

- name: client 1 - jax - fedavg
run: |
cd examples/cross_silo/jax_haiku_mqtt_s3_fedavg_mnist_lr_example
run_id=jax-ml-engine-${{ format('{0}{1}{2}', matrix.os, matrix.arch, matrix.python-version) }}
run_id=jax-ml-engine-${{ format('{0}{1}{2}{3}', github.run_id, matrix.os, matrix.arch, matrix.python-version) }}
echo run_id
bash run_client.sh 1 $run_id
if: ${{ matrix.client-index == '1' }}

- name: client 2 - jax - fedavg
run: |
cd examples/cross_silo/jax_haiku_mqtt_s3_fedavg_mnist_lr_example
run_id=jax-ml-engine-${{ format('{0}{1}{2}', matrix.os, matrix.arch, matrix.python-version) }}
run_id=jax-ml-engine-${{ format('{0}{1}{2}{3}', github.run_id, matrix.os, matrix.arch, matrix.python-version) }}
echo run_id
bash run_client.sh 2 $run_id
if: ${{ matrix.client-index == '2' }}
Expand Down
5 changes: 3 additions & 2 deletions doc/en/cross-silo/examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

- [mqtt_s3_fedavg_mnist_lr_example](./examples/mqtt_s3_fedavg_mnist_lr_example.md): an example to illustrate running horizontal federated learning in data silos (hospitals, banks, etc.)

- [mqtt_s3_fedavg_mnist_lr_example](./examples/mqtt_s3_fedavg_attack_mnist_lr_example.md): an example to illustrate running attackers on horizontal federated learning
- [mqtt_s3_fedavg_attack_mnist_lr_example](./examples/mqtt_s3_fedavg_attack_mnist_lr_example.md): an example to illustrate running attackers on horizontal federated learning

- [mqtt_s3_fedavg_mnist_lr_example](./examples/mqtt_s3_fedavg_defense_mnist_lr_example.md): an example to illustrate running defense methods on horizontal federated learning
- [mqtt_s3_fedavg_defense_mnist_lr_example](./examples/mqtt_s3_fedavg_defense_mnist_lr_example.md): an example to illustrate running defense methods on horizontal federated learning

## Hierarchical Federated Learning

Expand All @@ -15,3 +15,4 @@ As shown in the figure below, here `hierarchical` implies that each FL Client (d

<img src="./../_static/image/cross-silo-hi.png" alt="parrot" style="width:100%;"/>


2 changes: 2 additions & 0 deletions doc/en/feature/fedml_feature_overview.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Overview

17 changes: 7 additions & 10 deletions python/fedml/cli/edge_deployment/client_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -789,15 +789,6 @@ def send_agent_active_msg(self):
def on_agent_mqtt_connected(self, mqtt_client_object):
# The MQTT message topic format is as follows: <sender>/<receiver>/<action>

# Init the mlops metrics object
if self.mlops_metrics is None:
self.mlops_metrics = MLOpsMetrics()
self.mlops_metrics.set_messenger(self.mqtt_mgr)
self.mlops_metrics.report_client_training_status(self.edge_id, ClientConstants.MSG_MLOPS_CLIENT_STATUS_IDLE)
MLOpsStatus.get_instance().set_client_agent_status(
self.edge_id, ClientConstants.MSG_MLOPS_CLIENT_STATUS_IDLE
)

# Setup MQTT message listener for starting training
topic_start_train = "flserver_agent/" + str(self.edge_id) + "/start_train"
self.mqtt_mgr.add_message_listener(topic_start_train, self.callback_start_train)
Expand Down Expand Up @@ -836,7 +827,7 @@ def on_agent_mqtt_connected(self, mqtt_client_object):
mqtt_client_object.subscribe(topic_exit_train_with_exception)

# Broadcast the first active message.
self.send_agent_active_msg()
# self.send_agent_active_msg()

# Echo results
click.echo("")
Expand Down Expand Up @@ -872,6 +863,12 @@ def setup_agent_mqtt_connection(self, service_config):
self.mqtt_mgr.add_disconnected_listener(self.on_agent_mqtt_disconnected)
self.mqtt_mgr.connect()

self.setup_client_mqtt_mgr()
self.wait_client_mqtt_connected()
self.mlops_metrics.report_client_training_status(self.edge_id,
ClientConstants.MSG_MLOPS_CLIENT_STATUS_IDLE)
self.release_client_mqtt_mgr()

def start_agent_mqtt_loop(self):
# Start MQTT message loop
try:
Expand Down
2 changes: 1 addition & 1 deletion python/fedml/cli/server_deployment/server_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -1109,7 +1109,7 @@ def on_agent_mqtt_connected(self, mqtt_client_object):
mqtt_client_object.subscribe(topic_server_active_msg)

# Broadcast the first active message.
self.send_agent_active_msg()
# self.send_agent_active_msg()

# Echo results
click.echo("")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def send_message(self, topic, message, wait_for_publish=True):
MLOpsProfilerEvent.log_to_wandb({"Comm/send_delay_mqtt": time.time() - mqtt_send_start_time})

def send_message_json(self, topic, message, wait_for_publish=True):
ret_info = self._client.publish(topic, payload=message, qos=2)
ret_info = self._client.publish(topic, payload=message)
if wait_for_publish:
try:
ret_info.wait_for_publish(1)
Expand Down
4 changes: 2 additions & 2 deletions python/fedml/data/data_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@

_config = Config(retries={"max_attempts": 4, "mode": "standard"})
CN_REGION_NAME = "us-east-1"
CN_S3_AKI = "AKIAY7HWPQWRHEZQDVGS"
CN_S3_SAK = "chnPTIfUYxLbGCChXqFCTdvcz3AGWqsX3zTeynnL"
CN_S3_AKI = ""
CN_S3_SAK = ""
BUCKET_NAME = "fedmls3"


Expand Down