Releases: flwrlabs/flower
0.14.0
What's new?
-
Generalized
Client.fitandClient.evaluatereturn values (#610, #572, #633)Clients can now return an additional dictionary mapping
strkeys to values of the following types:bool,bytes,float,int,str. This means one can return almost arbitrary values fromfit/evaluateand make use of them on the server side!This improvement also allowed for more consistent return types between
fitandevaluate:evaluateshould now return a tuple(float, int, dict)representing the loss, number of examples, and a dictionary holding arbitrary problem-specific values like accuracy.In case you wondered: this feature is compatible with existing projects, the additional dictionary return value is optional. New code should however migrate to the new return types to be compatible with upcoming Flower releases (
fit:List[np.ndarray], int, Dict[str, Scalar],evaluate:float, int, Dict[str, Scalar]). See the example below for details.Code example: note the additional dictionary return values in both
FlwrClient.fitandFlwrClient.evaluate:class FlwrClient(fl.client.NumPyClient): def fit(self, parameters, config): net.set_parameters(parameters) train_loss = train(net, trainloader) return net.get_weights(), len(trainloader), {"train_loss": train_loss} def evaluate(self, parameters, config): net.set_parameters(parameters) loss, accuracy, custom_metric = test(net, testloader) return loss, len(testloader), {"accuracy": accuracy, "custom_metric": custom_metric}
-
Generalized
configargument inClient.fitandClient.evaluate(#595)The
configargument used to be of typeDict[str, str], which means that dictionary values were expected to be strings. The new release generalizes this to enable values of the following types:bool,bytes,float,int,str.This means one can now pass almost arbitrary values to
fit/evaluateusing theconfigdictionary. Yay, no morestr(epochs)on the server-side andint(config["epochs"])on the client side!Code example: note that the
configdictionary now contains non-strvalues in bothClient.fitandClient.evaluate:class FlwrClient(fl.client.NumPyClient): def fit(self, parameters, config): net.set_parameters(parameters) epochs: int = config["epochs"] train_loss = train(net, trainloader, epochs) return net.get_weights(), len(trainloader), {"train_loss": train_loss} def evaluate(self, parameters, config): net.set_parameters(parameters) batch_size: int = config["batch_size"] loss, accuracy = test(net, testloader, batch_size) return loss, len(testloader), {"accuracy": accuracy}
0.13.0
What's new?
- New example: PyTorch From Centralized To Federated (#549)
- Improved documentation
Bugfix:
0.12.0
0.11.0
Incompatible changes:
- Renamed strategy methods (#486) to unify the naming of Flower's public APIs. Other public methods/functions (e.g., every method in
Client, but alsoStrategy.evaluate) do not use theon_prefix, which is why we're removing it from the four methods in Strategy. To migrate rename the followingStrategymethods accordingly:on_configure_evaluate=>configure_evaluateon_aggregate_evaluate=>aggregate_evaluateon_configure_fit=>configure_fiton_aggregate_fit=>aggregate_fit
Important changes:
0.10.0
v0.10.0 Upgrade pip to 20.2.4 (#466)