Skip to content

Commit

Permalink
tb streaming example
Browse files Browse the repository at this point in the history
  • Loading branch information
holgerroth committed Mar 8, 2024
1 parent beb280b commit 7ed0660
Show file tree
Hide file tree
Showing 12 changed files with 1,219 additions and 1,100 deletions.
1,580 changes: 585 additions & 995 deletions examples/advanced/flower/fedprox/flower_fedprox.ipynb

Large diffs are not rendered by default.

97 changes: 0 additions & 97 deletions examples/advanced/flower/fedprox/flwr_scripts/client.py

This file was deleted.

7 changes: 0 additions & 7 deletions examples/advanced/flower/fedprox/flwr_scripts/server.py

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

import flwr as fl
from flwr_datasets import FederatedDataset
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
{
# version of the configuration
format_version = 2

# Client Computing Executors.
executors = [
{
# tasks the executors are defined to handle
tasks = ["train"]

# This particular executor
executor {

# Executor name : ClientAPILauncherExecutor
# This is an executor for Client API. The underline data exchange is using Pipe.
path = "nvflare.app_common.executors.client_api_launcher_executor.ClientAPILauncherExecutor"

args {

# This executor take an component named "launcher"
launcher_id = "launcher"

# This executor needs Pipe component
pipe_id = "pipe"

# Timeout in seconds for waiting for a heartbeat from the training script. Defaults to 30 seconds.
# Please refer to the class docstring for all available arguments
heartbeat_timeout = 60

# format of the exchange parameters
params_exchange_format = "numpy"

# if the transfer_type is FULL, then it will be sent directly
# if the transfer_type is DIFF, then we will calculate the
# difference VS received parameters and send the difference
params_transfer_type = "FULL"

# if train_with_evaluation is true, the executor will expect
# the custom code need to send back both the trained parameters and the evaluation metric
# otherwise only trained parameters are expected
train_with_evaluation = true

}
}
}
],

# this defined an array of task data filters. If provided, it will control the data from server controller to client executor
task_data_filters = []

# this defined an array of task result filters. If provided, it will control the result from client executor to server controller
task_result_filters = []

components = [
{
# component id is "launcher"
id = "launcher"

# the class path of this component
path = "nvflare.app_common.launchers.subprocess_launcher.SubprocessLauncher"

args {
# the launcher will invoke the script
script = "python3 custom/client.py --node-id 0"
# if launch_once is true, the SubprocessLauncher will launch once for the whole job
# if launch_once is false, the SubprocessLauncher will launch a process for each task it receives from server
launch_once = true
}
},
{
id = "pipe"
path = "nvflare.fuel.utils.pipe.cell_pipe.CellPipe"
args {
mode = "PASSIVE"
site_name = "{SITE_NAME}"
token = "{JOB_ID}"
root_url = "{ROOT_URL}"
secure_mode = "{SECURE_MODE}"
workspace_dir = "{WORKSPACE}"
}
},
{
id = "metrics_pipe"
path = "nvflare.fuel.utils.pipe.cell_pipe.CellPipe"
args {
mode = "PASSIVE"
site_name = "{SITE_NAME}"
token = "{JOB_ID}"
root_url = "{ROOT_URL}"
secure_mode = "{SECURE_MODE}"
workspace_dir = "{WORKSPACE}"
}
},
{
id = "metric_relay"
path = "nvflare.app_common.widgets.metric_relay.MetricRelay"
args {
pipe_id = "metrics_pipe"
event_type = "fed.analytix_log_stats"
# how fast should it read from the peer
read_interval = 0.1
}
},
{
# we use this component so the client api `flare.init()` can get required information
id = "client_api_config_preparer"
path = "nvflare.app_common.widgets.external_configurator.ExternalConfigurator"
args {
component_ids = ["metric_relay"]
}
}
]
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
format_version = 2
task_data_filters = []
task_result_filters = []
workflows = [
{
id = "controller_launcher"
path = "controller_launcher.ControllerLauncher"
args {
launcher_id = "launcher"
}
}
]
components = [
{
id = "launcher"
path = "nvflare.app_common.launchers.subprocess_launcher.SubprocessLauncher"
args {
script = "python3 custom/server.py"
launch_once = true
}
},
{
id = "tb_analytics_receiver"
path = "nvflare.app_opt.tracking.tb.tb_receiver.TBAnalyticsReceiver"
args.events = ["fed.analytix_log_stats"]
}
]
}
Loading

0 comments on commit 7ed0660

Please sign in to comment.