flip.flower.strategy
FLIP’s Flower base strategy — FedAvg plus Central Hub telemetry.
FlipFedAvg is the durable home for everything a FLIP Flower server app
reports to the hub: the RUNNING status, per-client metric and
exception forwarding (flip.flower.metrics), and the typed round events
(flip.flower.progress). App templates subclass it and keep only their
app-specific behaviour; the telemetry evolves here, in flip-utils, without
touching uploaded apps.
Round events attach to the phase the strategy actually runs: training rounds
emit around configure_train/aggregate_train; an evaluation-only strategy
(fraction_train=0.0) emits around the evaluate phase instead, so every job
type yields a coherent round timeline without double-emission.
Unlike the rest of flip.flower, importing this module requires the flwr
package (present in the Flower fl-server images) — it subclasses the real
FedAvg. Keep logic in the helpers; this class is wiring.
Classes
FedAvg with FLIP hub telemetry: status, metrics/exceptions, round events. |
Module Contents
- class flip.flower.strategy.FlipFedAvg(flip: flip.FLIP, model_id: str, *args, **kwargs)
Bases:
flwr.serverapp.strategy.FedAvgFedAvg with FLIP hub telemetry: status, metrics/exceptions, round events.
- Parameters:
flip – FLIP instance used by the fl-server to reach the Central Hub.
model_id – FLIP model ID (UUID) for the current run.
*args – Passed through to
FedAvg.**kwargs – Passed through to
FedAvg.
- flip
- model_id
- num_rounds: int | None = None
- _telemetry
- start(grid: flwr.serverapp.Grid, initial_arrays: flwr.app.ArrayRecord, num_rounds: int = 3, **kwargs)
Capture the round total and mark the run as executing on the hub.
- configure_train(server_round: int, arrays: flwr.app.ArrayRecord, config: flwr.common.ConfigRecord, grid: flwr.serverapp.Grid) collections.abc.Iterable[flwr.app.Message]
Dispatch the round’s train tasks, reporting the round start.
- aggregate_train(server_round: int, replies: collections.abc.Iterable[flwr.app.Message]) flwr.app.ArrayRecord | None
Forward per-client telemetry, aggregate, then report the round aggregated.
- configure_evaluate(server_round: int, arrays: flwr.app.ArrayRecord, config: flwr.common.ConfigRecord, grid: flwr.serverapp.Grid) collections.abc.Iterable[flwr.app.Message]
Dispatch the round’s evaluate tasks; owns the round events when nothing trains.
- aggregate_evaluate(server_round: int, replies: collections.abc.Iterable[flwr.app.Message]) flwr.app.MetricRecord | None
Forward per-client telemetry, aggregate, and close evaluation-only rounds.