更新日志¶
v1.12.0 (2024-10-14)¶
感谢我们的贡献者¶
在此,我们要特别感谢所有为 Flower 的新版本做出贡献的人员(按 git shortlog
顺序排列):
Adam Narozniak
, Audris
, Charles Beauville
, Chong Shen Ng
, Daniel J. Beutel
, Daniel Nata Nugraha
, Heng Pan
, Javier
, Jiahao Tan
, Julian Rußmeyer
, Mohammad Naseri
, Ray Sun
, Robert Steiner
, Yan Gao
, xiliguguagua
有什么新内容?¶
Introduce SuperExec log streaming (#3577, #3584, #4242, #3611, #3613)
Flower now supports log streaming from a remote SuperExec using the
flwr log
command. This new feature allows you to monitor logs from SuperExec in real time viaflwr log <run-id>
(orflwr log <run-id> <app-dir> <federation>
).Improve
flwr new
templates (#4291, #4292, #4293, #4294, #4295)The
flwr new
command templates for MLX, NumPy, sklearn, JAX, and PyTorch have been updated to improve usability and consistency across frameworks.Migrate ID handling to use unsigned 64-bit integers (#4170, #4237, #4243)
Node IDs, run IDs, and related fields have been migrated from signed 64-bit integers (
sint64
) to unsigned 64-bit integers (uint64
). To support this change, theuint64
type is fully supported in all communications. You may now useuint64
values in config and metric dictionaries. For Python users, that means usingint
values larger than the maximum value ofsint64
but less than the maximum value ofuint64
.Add Flower architecture explanation (#3270)
A new Flower architecture explainer page introduces Flower components step-by-step. Check out the
EXPLANATIONS
section of the Flower documentation if you're interested.Introduce FedRep baseline (#3790)
FedRep is a federated learning algorithm that learns shared data representations across clients while allowing each to maintain personalized local models, balancing collaboration and individual adaptation. Read all the details in the paper: "Exploiting Shared Representations for Personalized Federated Learning" (arxiv)
Improve FlowerTune template and LLM evaluation pipelines (#4286, #3769, #4272, #4257, #4220, #4282, #4171, #4228, #4258, #4296, #4287, #4217, #4249, #4324, #4219, #4327)
Refined evaluation pipelines, metrics, and documentation for the upcoming FlowerTune LLM Leaderboard across multiple domains including Finance, Medical, and general NLP. Stay tuned for the official launch—we welcome all federated learning and LLM enthusiasts to participate in this exciting challenge!
Enhance Docker Support and Documentation (#4191, #4251, #4190, #3928, #4298, #4192, #4136, #4187, #4261, #4177, #4176, #4189, #4297, #4226)
Upgraded Ubuntu base image to 24.04, added SBOM and gcc to Docker images, and comprehensively updated Docker documentation including quickstart guides and distributed Docker Compose instructions.
Introduce Flower glossary (#4165, #4235)
Added the Federated Learning glossary to the Flower repository, located under the
flower/glossary/
directory. This resource aims to provide clear definitions and explanations of key FL concepts. Community contributions are highly welcomed to help expand and refine this knowledge base — this is probably the easiest way to become a Flower contributor!Implement Message Time-to-Live (TTL) (#3620, #3596, #3615, #3609, #3635)
Added comprehensive TTL support for messages in Flower's SuperLink. Messages are now automatically expired and cleaned up based on configurable TTL values, available through the low-level API (and used by default in the high-level API).
Improve FAB handling (#4303, #4264, #4305, #4304)
An 8-character hash is now appended to the FAB file name. The
flwr install
command installs FABs with a more flattened folder structure, reducing it from 3 levels to 1.Update documentation (#3341, #3338, #3927, #4152, #4151, #3993)
Updated quickstart tutorials (PyTorch Lightning, TensorFlow, Hugging Face, Fastai) to use the new
flwr run
command and removed default title from documentation base template. A new blockchain example has been added to FAQ.Update example projects (#3716, #4007, #4130, #4234, #4206, #4188, #4247, #4331)
Refreshed multiple example projects including vertical FL, PyTorch (advanced), Pandas, Secure Aggregation, and XGBoost examples. Optimized Hugging Face quickstart with a smaller language model and removed legacy simulation examples.
Update translations (#4070, #4316, #4252, #4256, #4210, #4263, #4259)
General improvements (#4239, 4276, 4204, 4184, 4227, 4183, 4202, 4250, 4267, 4246, 4240, 4265, 4238, 4275, 4318, #4178, #4315, #4241, #4289, #4290, #4181, #4208, #4225, #4314, #4174, #4203, #4274, #3154, #4201, #4268, #4254, #3990, #4212, #2938, #4205, #4222, #4313, #3936, #4278, #4319, #4332, #4333)
As always, many parts of the Flower framework and quality infrastructure were improved and updated.
不兼容的更改¶
Drop Python 3.8 support and update minimum version to 3.9 (#4180, #4213, #4193, #4199, #4196, #4195, #4198, #4194)
Python 3.8 support was deprecated in Flower 1.9, and this release removes support. Flower now requires Python 3.9 or later (Python 3.11 is recommended). CI and documentation were updated to use Python 3.9 as the minimum supported version. Flower now supports Python 3.9 to 3.12.
v1.11.1 (2024-09-11)¶
感谢我们的贡献者¶
在此,我们要特别感谢所有为 Flower 的新版本做出贡献的人员(按 git shortlog
顺序排列):
Charles Beauville
, Chong Shen Ng
, Daniel J. Beutel
, Heng Pan
, Javier
, Robert Steiner
, Yan Gao
Improvements¶
Implement
keys/values/items
methods forTypedDict
(#4146)Fix parsing of
--executor-config
if present (#4125)Adjust framework name in templates docstrings (#4127)
Update
flwr new
Hugging Face template (#4169)Fix
flwr new
FlowerTune template (#4123)Add buffer time after
ServerApp
thread initialization (#4119)Handle unsuitable resources for simulation (#4143)
Update example READMEs (#4117)
Update SuperNode authentication docs (#4160)
不兼容的更改¶
无
v1.11.0 (2024-08-30)¶
感谢我们的贡献者¶
在此,我们要特别感谢所有为 Flower 的新版本做出贡献的人员(按 git shortlog
顺序排列):
Adam Narozniak
, Charles Beauville
, Chong Shen Ng
, Daniel J. Beutel
, Daniel Nata Nugraha
, Danny
, Edoardo Gabrielli
, Heng Pan
, Javier
, Meng Yan
, Michal Danilowski
, Mohammad Naseri
, Robert Steiner
, Steve Laskaridis
, Taner Topal
, Yan Gao
有什么新内容?¶
Deliver Flower App Bundle (FAB) to SuperLink and SuperNodes (#4006, #3945, #3999, #4027, #3851, #3946, #4003, #4029, #3942, #3957, #4020, #4044, #3852, #4019, #4031, #4036, #4049, #4017, #3943, #3944, #4011, #3619)
Dynamic code updates are here!
flwr run
can now ship and install the latest version of yourServerApp
andClientApp
to an already-running federation (SuperLink and SuperNodes).How does it work?
flwr run
bundles your Flower app into a single FAB (Flower App Bundle) file. It then ships this FAB file, via the SuperExec, to both the SuperLink and those SuperNodes that need it. This allows you to keep SuperExec, SuperLink and SuperNodes running as permanent infrastructure, and then ship code updates (including completely new projects!) dynamically.flwr run
is all you need.Introduce isolated
ClientApp
execution (#3970, #3976, #4002, #4001, #4034, #4037, #3977, #4042, #3978, #4039, #4033, #3971, #4035, #3973, #4032)The SuperNode can now run your
ClientApp
in a fully isolated way. In an enterprise deployment, this allows you to set strict limits on what theClientApp
can and cannot do.flower-supernode
supports three--isolation
modes:Unset: The SuperNode runs the
ClientApp
in the same process (as in previous versions of Flower). This is the default mode.--isolation=subprocess
: The SuperNode starts a subprocess to run theClientApp
.--isolation=process
: The SuperNode expects an externally-managed process to run theClientApp
. This external process is not managed by the SuperNode, so it has to be started beforehand and terminated manually. The common way to use this isolation mode is via the newflwr/clientapp
Docker image.
Improve Docker support for enterprise deployments (#4050, #4090, #3784, #3998, #4094, #3722)
Flower 1.11 ships many Docker improvements that are especially useful for enterprise deployments:
flwr/supernode
comes with a new Alpine Docker image.flwr/clientapp
is a new image to be used with the--isolation=process
option. In this mode, SuperNode andClientApp
run in two different Docker containers.flwr/supernode
(preferably the Alpine version) runs the long-running SuperNode with--isolation=process
.flwr/clientapp
runs theClientApp
. This is the recommended way to deploy Flower in enterprise settings.New all-in-one Docker Compose enables you to easily start a full Flower Deployment Engine on a single machine.
Completely new Docker documentation: https://flower.ai/docs/framework/docker/index.html
Improve SuperNode authentication (#4043, #4047, #4074)
SuperNode auth has been improved in several ways, including improved logging, improved testing, and improved error handling.
Update
flwr new
templates (#3933, #3894, #3930, #3931, #3997, #3979, #3965, #4013, #4064)All
flwr new
templates have been updated to show the latest recommended use of Flower APIs.Improve Simulation Engine (#4095, #3913, #4059, #3954, #4071, #3985, #3988)
The Flower Simulation Engine comes with several updates, including improved run config support, verbose logging, simulation backend configuration via
flwr run
, and more.Improve
RecordSet
(#4052, #3218, #4016)RecordSet
is the core object to exchange model parameters, configuration values and metrics betweenClientApp
andServerApp
. This release ships several smaller improvements toRecordSet
and related*Record
types.Update documentation (#3972, #3925, #4061, #3984, #3917, #3900, #4066, #3765, #4021, #3906, #4063, #4076, #3920, #3916)
Many parts of the documentation, including the main tutorial, have been migrated to show new Flower APIs and other new Flower features like the improved Docker support.
Migrate code example to use new Flower APIs (#3758, #3701, #3919, #3918, #3934, #3893, #3833, #3922, #3846, #3777, #3874, #3873, #3935, #3754, #3980, #4089, #4046, #3314, #3316, #3295, #3313)
Many code examples have been migrated to use new Flower APIs.
Update Flower framework, framework internals and quality infrastructure (#4018, #4053, #4098, #4067, #4105, #4048, #4107, #4069, #3915, #4101, #4108, #3914, #4068, #4041, #4040, #3986, #4026, #3961, #3975, #3983, #4091, #3982, #4079, #4073, #4060, #4106, #4080, #3974, #3996, #3991, #3981, #4093, #4100, #3939, #3955, #3940, #4038)
As always, many parts of the Flower framework and quality infrastructure were improved and updated.
停用¶
Deprecate accessing
Context
viaClient.context
(#3797)Now that both
client_fn
andserver_fn
receive aContext
object, accessingContext
viaClient.context
is deprecated.Client.context
will be removed in a future release. If you need to accessContext
in yourClient
implementation, pass it manually when creating theClient
instance inclient_fn
:def client_fn(context: Context) -> Client: return FlowerClient(context).to_client()
不兼容的更改¶
Update CLIs to accept an app directory instead of
ClientApp
andServerApp
(#3952, #4077, #3850)The CLI commands
flower-supernode
andflower-server-app
now accept an app directory as argument (instead of references to aClientApp
orServerApp
). An app directory is any directory containing apyproject.toml
file (with the appropriate Flower config fields set). The easiest way to generate a compatible project structure is to useflwr new
.Disable
flower-client-app
CLI command (#4022)flower-client-app
has been disabled. Useflower-supernode
instead.Use spaces instead of commas for separating config args (#4000)
When passing configs (run config, node config) to Flower, you now need to separate key-value pairs using spaces instead of commas. For example:
flwr run . --run-config "learning-rate=0.01 num_rounds=10" # Works
Previously, you could pass configs using commas, like this:
flwr run . --run-config "learning-rate=0.01,num_rounds=10" # Doesn't work
Remove
flwr example
CLI command (#4084)The experimental
flwr example
CLI command has been removed. Useflwr new
to generate a project and then run it usingflwr run
.
v1.10.0 (2024-07-24)¶
感谢我们的贡献者¶
在此,我们要特别感谢所有为 Flower 的新版本做出贡献的人员(按 git shortlog
顺序排列):
Adam Narozniak
, Charles Beauville
, Chong Shen Ng
, Daniel J. Beutel
, Daniel Nata Nugraha
, Danny
, Gustavo Bertoli
, Heng Pan
, Ikko Eltociear Ashimine
, Javier
, Jiahao Tan
, Mohammad Naseri
, Robert Steiner
, Sebastian van der Voort
, Taner Topal
, Yan Gao
有什么新内容?¶
Introduce
flwr run
(beta) (#3810, #3826, #3880, #3807, #3800, #3814, #3811, #3809, #3819)Flower 1.10 ships the first beta release of the new
flwr run
command.flwr run
can run different projects usingflwr run path/to/project
, it enables you to easily switch between different federations usingflwr run . federation
and it runs your Flower project using either local simulation or the new (experimental) SuperExec service. This allows Flower to scale federatated learning from fast local simulation to large-scale production deployment, seamlessly. All projects generated withflwr new
are immediately runnable usingflwr run
. Give it a try: useflwr new
to generate a project and then run it usingflwr run
.Introduce run config (#3751, #3750, #3845, #3824, #3746, #3728, #3730, #3725, #3729, #3580, #3578, #3576, #3798, #3732, #3815)
The new run config feature allows you to run your Flower project in different configurations without having to change a single line of code. You can now build a configurable
ServerApp
andClientApp
that read configuration values at runtime. This enables you to specify config values likelearning-rate=0.01
inpyproject.toml
(under the[tool.flwr.app.config]
key). These config values can then be easily overridden viaflwr run --run-config learning-rate=0.02
, and read fromContext
usinglr = context.run_config["learning-rate"]
. Create a new project usingflwr new
to see run config in action.Generalize
client_fn
signature toclient_fn(context: Context) -> Client
(#3779, #3697, #3694, #3696)The
client_fn
signature has been generalized toclient_fn(context: Context) -> Client
. It now receives aContext
object instead of the (now depreacated)cid: str
.Context
allows accessingnode_id
,node_config
andrun_config
, among other things. This enables you to build a configurableClientApp
that leverages the new run config system.The previous signature
client_fn(cid: str)
is now deprecated and support for it will be removed in a future release. Useclient_fn(context: Context) -> Client
everywhere.Introduce new
server_fn(context)
(#3773, #3796, #3771)In addition to the new
client_fn(context:Context)
, a newserver_fn(context: Context) -> ServerAppComponents
can now be passed toServerApp
(instead of passing, for example,Strategy
, directly). This enables you to leverage the fullContext
on the server-side to build a configurableServerApp
.Relaunch all
flwr new
templates (#3877, #3821, #3587, #3795, #3875, #3859, #3760)All
flwr new
templates have been significantly updated to showcase new Flower features and best practices. This includes usingflwr run
and the new run config feature. You can now easily create a new project usingflwr new
and, after following the instructions to install it,flwr run
it.Introduce
flower-supernode
(preview) (#3353)The new
flower-supernode
CLI is here to replaceflower-client-app
.flower-supernode
brings full multi-app support to the Flower client-side. It also allows to pass--node-config
to the SuperNode, which is accessible in yourClientApp
viaContext
(using the newclient_fn(context: Context)
signature).Introduce node config (#3782, #3780, #3695, #3886)
A new node config feature allows you to pass a static configuration to the SuperNode. This configuration is read-only and available to every
ClientApp
running on that SuperNode. AClientApp
can access the node config viaContext
(context.node_config
).Introduce SuperExec (experimental) (#3605, #3723, #3731, #3589, #3604, #3622, #3838, #3720, #3606, #3602, #3603, #3555, #3808, #3724, #3658, #3629)
This is the first experimental release of Flower SuperExec, a new service that executes your runs. It's not ready for production deployment just yet, but don't hesitate to give it a try if you're interested.
Add new federated learning with tabular data example (#3568)
A new code example exemplifies a federated learning setup using the Flower framework on the Adult Census Income tabular dataset.
Create generic adapter layer (preview) (#3538, #3536, #3540)
A new generic gRPC adapter layer allows 3rd-party frameworks to integrate with Flower in a transparent way. This makes Flower more modular and allows for integration into other federated learning solutions and platforms.
Refactor Flower Simulation Engine (#3581, #3471, #3804, #3468, #3839, #3806, #3861, #3543, #3472, #3829, #3469)
The Simulation Engine was significantly refactored. This results in faster and more stable simulations. It is also the foundation for upcoming changes that aim to provide the next level of performance and configurability in federated learning simulations.
Optimize Docker containers (#3591)
Flower Docker containers were optimized and updated to use that latest Flower framework features.
Improve logging (#3776, #3789)
Improved logging aims to be more concise and helpful to show you the details you actually care about.
Refactor framework internals (#3621, #3792, #3772, #3805, #3583, #3825, #3597, #3802, #3569)
As always, many parts of the Flower framework and quality infrastructure were improved and updated.
Documentation improvements¶
Add 🇰🇷 Korean translations (#3680)
Update translations (#3586, #3679, #3570, #3681, #3617, #3674, #3671, #3572, #3631)
Update documentation (#3864, #3688, #3562, #3641, #3384, #3634, #3823, #3793, #3707)
Updated documentation includes new install instructions for different shells, a new Flower Code Examples documentation landing page, new
flwr
CLI docs and an updated federated XGBoost code example.
停用¶
Deprecate
client_fn(cid: str)
client_fn
used to have a signatureclient_fn(cid: str) -> Client
. This signature is now deprecated. Use the new signatureclient_fn(context: Context) -> Client
instead. The new argumentcontext
allows accessingnode_id
,node_config
,run_config
and otherContext
features. When running using the simulation engine (or usingflower-supernode
with a custom--node-config partition-id=...
),context.node_config["partition-id"]
will return anint
partition ID that can be used with Flower Datasets to load a different partition of the dataset on each simulated or deployed SuperNode.Deprecate passing
Server/ServerConfig/Strategy/ClientManager
toServerApp
directlyCreating
ServerApp
usingServerApp(config=config, strategy=strategy)
is now deprecated. Instead of passingServer/ServerConfig/Strategy/ClientManager
toServerApp
directly, pass them wrapped in aserver_fn(context: Context) -> ServerAppComponents
function, like this:ServerApp(server_fn=server_fn)
.ServerAppComponents
can hold references toServer/ServerConfig/Strategy/ClientManager
. In addition to that,server_fn
allows you to accessContext
(for example, to read therun_config
).
不兼容的更改¶
Remove support for
client_ids
instart_simulation
(#3699)The (rarely used) feature that allowed passing custom
client_ids
to thestart_simulation
function was removed. This removal is part of a bigger effort to refactor the simulation engine and unify how the Flower internals work in simulation and deployment.Remove
flower-driver-api
andflower-fleet-api
(#3418)The two deprecated CLI commands
flower-driver-api
andflower-fleet-api
were removed in an effort to streamline the SuperLink developer experience. Useflower-superlink
instead.
v1.9.0 (2024-06-10)¶
感谢我们的贡献者¶
在此,我们要特别感谢所有为 Flower 的新版本做出贡献的人员(按 git shortlog
顺序排列):
Adam Narozniak
, Charles Beauville
, Chong Shen Ng
, Daniel J. Beutel
, Daniel Nata Nugraha
, Heng Pan
, Javier
, Mahdi Beitollahi
, Robert Steiner
, Taner Topal
, Yan Gao
, bapic
, mohammadnaseri
有什么新内容?¶
Introduce built-in authentication (preview) (#2946, #3388, #2948, #2917, #3386, #3308, #3001, #3409, #2999, #2979, #3389, #3503, #3366, #3357)
Flower 1.9 introduces the first build-in version of client node authentication. In previous releases, users often wrote glue code to connect Flower to external authentication systems. With this release, the SuperLink can authenticate SuperNodes using a built-in authentication system. A new how-to guide and a new code example help you to get started.
This is the first preview release of the Flower-native authentication system. Many additional features are on the roadmap for upcoming Flower releases - stay tuned.
Introduce end-to-end Docker support (#3483, #3266, #3390, #3283, #3285, #3391, #3403, #3458, #3533, #3453, #3486, #3290)
Full Flower Next Docker support is here! With the release of Flower 1.9, Flower provides stable Docker images for the Flower SuperLink, the Flower SuperNode, and the Flower
ServerApp
. This set of images enables you to run all Flower components in Docker. Check out the new how-to guide to get stated.Re-architect Flower Next simulation engine (#3307, #3355, #3272, #3273, #3417, #3281, #3343, #3326)
Flower Next simulations now use a new in-memory
Driver
that improves the reliability of simulations, especially in notebook environments. This is a significant step towards a complete overhaul of the Flower Next simulation architecture.Upgrade simulation engine (#3354, #3378, #3262, #3435, #3501, #3482, #3494)
The Flower Next simulation engine comes with improved and configurable logging. The Ray-based simulation backend in Flower 1.9 was updated to use Ray 2.10.
Introduce FedPFT baseline (#3268)
FedPFT allows you to perform one-shot Federated Learning by leveraging widely available foundational models, dramatically reducing communication costs while delivering high performing models. This is work led by Mahdi Beitollahi from Huawei Noah's Ark Lab (Montreal, Canada). Read all the details in their paper: "Parametric Feature Transfer: One-shot Federated Learning with Foundation Models" (arxiv)
Launch additional
flwr new
templates for Apple MLX, Hugging Face Transformers, scikit-learn and TensorFlow (#3291, #3139, #3284, #3251, #3376, #3287)The
flwr
CLI'sflwr new
command is starting to become everone's favorite way of creating new Flower projects. This release introduces additionalflwr new
templates for Apple MLX, Hugging Face Transformers, scikit-learn and TensorFlow. In addition to that, existing templates also received updates.Refine
RecordSet
API (#3209, #3331, #3334, #3335, #3375, #3368)RecordSet
is part of the Flower Next low-level API preview release. In Flower 1.9,RecordSet
received a number of usability improvements that make it easier to buildRecordSet
-basedServerApp
s andClientApp
s.Beautify logging (#3379, #3430, #3461, #3360, #3433)
Logs received a substantial update. Not only are logs now much nicer to look at, but they are also more configurable.
Improve reliability (#3564, #3561, #3566, #3462, #3225, #3514, #3535, #3372)
Flower 1.9 includes reliability improvements across many parts of the system. One example is a much improved SuperNode shutdown procedure.
Update Swift and C++ SDKs (#3321, #2763)
In the C++ SDK, communication-related code is now separate from main client logic. A new abstract class
Communicator
has been introduced alongside a gRPC implementation of it.Improve testing, tooling and CI/CD infrastructure (#3294, #3282, #3311, #2878, #3333, #3255, #3349, #3400, #3401, #3399, #3346, #3398, #3397, #3347, #3502, #3387, #3542, #3396, #3496, #3465, #3473, #3484, #3521, #3363, #3497, #3464, #3495, #3478, #3271)
As always, the Flower tooling, testing, and CI/CD infrastructure has received many updates.
Improve documentation (#3530, #3539, #3425, #3520, #3286, #3516, #3523, #3545, #3498, #3439, #3440, #3382, #3559, #3432, #3278, #3371, #3519, #3267, #3204, #3274)
As always, the Flower documentation has received many updates. Notable new pages include:
General updates to Flower Examples (#3205, #3226, #3211, #3252, #3427, #3410, #3426, #3228, #3342, #3200, #3202, #3394, #3488, #3329, #3526, #3392, #3474, #3269)
As always, Flower code examples have received many updates.
General improvements (#3532, #3318, #3565, #3296, #3305, #3246, #3224, #3475, #3297, #3317, #3429, #3196, #3534, #3240, #3365, #3407, #3563, #3344, #3330, #3436, #3300, #3327, #3254, #3253, #3419, #3289, #3208, #3245, #3319, #3203, #3423, #3352, #3292, #3261)
停用¶
Deprecate Python 3.8 support
Python 3.8 will stop receiving security fixes in October 2024. Support for Python 3.8 is now deprecated and will be removed in an upcoming release.
Deprecate (experimental)
flower-driver-api
andflower-fleet-api
(#3416, #3420)Flower 1.9 deprecates the two (experimental) commands
flower-driver-api
andflower-fleet-api
. Both commands will be removed in an upcoming release. Useflower-superlink
instead.Deprecate
--server
in favor of--superlink
(#3518)The commands
flower-server-app
andflower-client-app
should use--superlink
instead of the now deprecated--server
. Support for--server
will be removed in a future release.
不兼容的更改¶
Replace
flower-superlink
CLI option--certificates
with--ssl-ca-certfile
,--ssl-certfile
and--ssl-keyfile
(#3512, #3408)SSL-related
flower-superlink
CLI arguments were restructured in an incompatible way. Instead of passing a single--certificates
flag with three values, you now need to pass three flags (--ssl-ca-certfile
,--ssl-certfile
and--ssl-keyfile
) with one value each. Check out the SSL connections documentation page for details.Remove SuperLink
--vce
option (#3513)Instead of separately starting a SuperLink and a
ServerApp
for simulation, simulations must now be started using the singleflower-simulation
command.Merge
--grpc-rere
and--rest
SuperLink options (#3527)To simplify the usage of
flower-superlink
, previously separate sets of CLI options for gRPC and REST were merged into one unified set of options. Consult the Flower CLI reference documentation for details.
v1.8.0 (2024-04-03)¶
感谢我们的贡献者¶
在此,我们要特别感谢所有为 Flower 的新版本做出贡献的人员(按 git shortlog
顺序排列):
Adam Narozniak
, Charles Beauville
, Daniel J. Beutel
, Daniel Nata Nugraha
, Danny
, Gustavo Bertoli
, Heng Pan
, Ikko Eltociear Ashimine
, Jack Cook
, Javier
, Raj Parekh
, Robert Steiner
, Sebastian van der Voort
, Taner Topal
, Yan Gao
, mohammadnaseri
, tabdar-khan
有什么新内容?¶
Introduce Flower Next high-level API (stable) (#3002, #2934, #2958, #3173, #3174, #2923, #2691, #3079, #2961, #2924, #3166, #3031, #3057, #3000, #3113, #2957, #3183, #3180, #3035, #3189, #3185, #3190, #3191, #3195, #3197)
The Flower Next high-level API is stable! Flower Next is the future of Flower - all new features (like Flower Mods) will be built on top of it. You can start to migrate your existing projects to Flower Next by using
ServerApp
andClientApp
(check outquickstart-pytorch
orquickstart-tensorflow
, a detailed migration guide will follow shortly). Flower Next allows you to run multiple projects concurrently (we call this multi-run) and execute the same project in either simulation environments or deployment environments without having to change a single line of code. The best part? It's fully compatible with existing Flower projects that useStrategy
,NumPyClient
& co.Introduce Flower Next low-level API (preview) (#3062, #3034, #3069)
In addition to the Flower Next high-level API that uses
Strategy
,NumPyClient
& co, Flower 1.8 also comes with a preview version of the new Flower Next low-level API. The low-level API allows for granular control of every aspect of the learning process by sending/receiving individual messages to/from client nodes. The newServerApp
supports registering a custommain
function that allows writing custom training loops for methods like async FL, cyclic training, or federated analytics. The newClientApp
supports registeringtrain
,evaluate
andquery
functions that can access the raw message received from theServerApp
. New abstractions likeRecordSet
,Message
andContext
further enable sending multiple models, multiple sets of config values and metrics, stateful computations on the client node and implementations of custom SMPC protocols, to name just a few.Introduce Flower Mods (preview) (#3054, #2911, #3083)
Flower Modifiers (we call them Mods) can intercept messages and analyze, edit or handle them directly. Mods can be used to develop pluggable modules that work across different projects. Flower 1.8 already includes mods to log the size of a message, the number of parameters sent over the network, differential privacy with fixed clipping and adaptive clipping, local differential privacy and secure aggregation protocols SecAgg and SecAgg+. The Flower Mods API is released as a preview, but researchers can already use it to experiment with arbirtrary SMPC protocols.
Fine-tune LLMs with LLM FlowerTune (#3029, #3089, #3092, #3100, #3114, #3162, #3172)
We are introducing LLM FlowerTune, an introductory example that demonstrates federated LLM fine-tuning of pre-trained Llama2 models on the Alpaca-GPT4 dataset. The example is built to be easily adapted to use different models and/or datasets. Read our blog post LLM FlowerTune: Federated LLM Fine-tuning with Flower for more details.
Introduce built-in Differential Privacy (preview) (#2798, #2959, #3038, #3147, #2909, #2893, #2892, #3039, #3074)
Built-in Differential Privacy is here! Flower supports both central and local differential privacy (DP). Central DP can be configured with either fixed or adaptive clipping. The clipping can happen either on the server-side or the client-side. Local DP does both clipping and noising on the client-side. A new documentation page explains Differential Privacy approaches and a new how-to guide describes how to use the new Differential Privacy components in Flower.
Introduce built-in Secure Aggregation (preview) (#3120, #3110, #3108)
Built-in Secure Aggregation is here! Flower now supports different secure aggregation protocols out-of-the-box. The best part? You can add secure aggregation to your Flower projects with only a few lines of code. In this initial release, we inlcude support for SecAgg and SecAgg+, but more protocols will be implemented shortly. We'll also add detailed docs that explain secure aggregation and how to use it in Flower. You can already check out the new code example that shows how to use Flower to easily combine Federated Learning, Differential Privacy and Secure Aggregation in the same project.
Introduce
flwr
CLI (preview) (#2942, #3055, #3111, #3130, #3136, #3094, #3059, #3049, #3142)A new
flwr
CLI command allows creating new Flower projects (flwr new
) and then running them using the Simulation Engine (flwr run
).Introduce Flower Next Simulation Engine (#3024, #3061, #2997, #2783, #3184, #3075, #3047, #2998, #3009, #3008)
The Flower Simulation Engine can now run Flower Next projects. For notebook environments, there's also a new
run_simulation
function that can runServerApp
andClientApp
.Handle SuperNode connection errors (#2969)
A SuperNode will now try to reconnect indefinitely to the SuperLink in case of connection errors. The arguments
--max-retries
and--max-wait-time
can now be passed to theflower-client-app
command.--max-retries
will define the number of tentatives the client should make before it gives up trying to reconnect to the SuperLink, and,--max-wait-time
defines the time before the SuperNode gives up trying to reconnect to the SuperLink.General updates to Flower Baselines (#2904, #2482, #2985, #2968)
There's a new FedStar baseline. Several other baselined have been updated as well.
Improve documentation and translations (#3050, #3044, #3043, #2986, #3041, #3046, #3042, #2978, #2952, #3167, #2953, #3045, #2654, #3082, #2990, #2989)
As usual, we merged many smaller and larger improvements to the documentation. A special thank you goes to Sebastian van der Voort for landing a big documentation PR!
General updates to Flower Examples (3134, 2996, 2930, 2967, 2467, 2910, #2918, #2773, #3063, #3116, #3117)
Two new examples show federated training of a Vision Transformer (ViT) and federated learning in a medical context using the popular MONAI library.
quickstart-pytorch
andquickstart-tensorflow
demonstrate the new Flower NextServerApp
andClientApp
. Many other examples received considerable updates as well.General improvements (#3171, 3099, 3003, 3145, 3017, 3085, 3012, 3119, 2991, 2970, 2980, 3086, 2932, 2928, 2941, 2933, 3181, 2973, 2992, 2915, 3040, 3022, 3032, 2902, 2931, 3005, 3132, 3115, 2944, 3064, 3106, 2974, 3178, 2993, 3186, 3091, 3125, 3093, 3013, 3033, 3133, 3068, 2916, 2975, 2984, 2846, 3077, 3143, 2921, 3101, 2927, 2995, 2972, 2912, 3065, 3028, 2922, 2982, 2914, 3179, 3080, 2994, 3187, 2926, 3018, 3144, 3011, #3152, #2836, #2929, #2943, #2955, #2954)
不兼容的更改¶
无
v1.7.0 (2024-02-05)¶
感谢我们的贡献者¶
在此,我们要特别感谢所有为 Flower 的新版本做出贡献的人员(按 git shortlog
顺序排列):
Aasheesh Singh
, Adam Narozniak
, Aml Hassan Esmil
, Charles Beauville
, Daniel J. Beutel
, Daniel Nata Nugraha
, Edoardo Gabrielli
, Gustavo Bertoli
, HelinLin
, Heng Pan
, Javier
, M S Chaitanya Kumar
, Mohammad Naseri
, Nikos Vlachakis
, Pritam Neog
, Robert Kuska
, Robert Steiner
, Taner Topal
, Yahia Salaheldin Shaaban
, Yan Gao
, Yasar Abbas
有什么新内容?¶
Introduce stateful clients (experimental) (#2770, #2686, #2696, #2643, #2769)
Subclasses of
Client
andNumPyClient
can now store local state that remains on the client. Let's start with the highlight first: this new feature is compatible with both simulated clients (viastart_simulation
) and networked clients (viastart_client
). It's also the first preview of new abstractions likeContext
andRecordSet
. Clients can access state of typeRecordSet
viastate: RecordSet = self.context.state
. Changes to thisRecordSet
are preserved across different rounds of execution to enable stateful computations in a unified way across simulation and deployment.Improve performance (#2293)
Flower is faster than ever. All
FedAvg
-derived strategies now use in-place aggregation to reduce memory consumption. The Flower client serialization/deserialization has been rewritten from the ground up, which results in significant speedups, especially when the client-side training time is short.Support Federated Learning with Apple MLX and Flower (#2693)
Flower has official support for federated learning using Apple MLX via the new
quickstart-mlx
code example.Introduce new XGBoost cyclic strategy (#2666, #2668)
A new strategy called
FedXgbCyclic
supports a client-by-client style of training (often called cyclic). Thexgboost-comprehensive
code example shows how to use it in a full project. In addition to that,xgboost-comprehensive
now also supports simulation mode. With this, Flower offers best-in-class XGBoost support.Support Python 3.11 (#2394)
Framework tests now run on Python 3.8, 3.9, 3.10, and 3.11. This will ensure better support for users using more recent Python versions.
Update gRPC and ProtoBuf dependencies (#2814)
The
grpcio
andprotobuf
dependencies were updated to their latest versions for improved security and performance.Introduce Docker image for Flower server (#2700, #2688, #2705, #2695, #2747, #2746, #2680, #2682, #2701)
The Flower server can now be run using an official Docker image. A new how-to guide explains how to run Flower using Docker. An official Flower client Docker image will follow.
Introduce
flower-via-docker-compose
example (#2626)Introduce
quickstart-sklearn-tabular
example (#2719)Introduce
custom-metrics
example (#1958)Update code examples to use Flower Datasets (#2450, #2456, #2318, #2712)
Several code examples were updated to use Flower Datasets.
General updates to Flower Examples (#2381, #2805, #2782, #2806, #2829, #2825, #2816, #2726, #2659, #2655)
Many Flower code examples received substantial updates.
更新 Flower Baselines
Improve documentation (#2674, #2480, #2826, #2727, #2761, #2900)
Improved testing and development infrastructure (#2797, #2676, #2644, #2656, #2848, #2675, #2735, #2767, #2732, #2744, #2681, #2699, #2745, #2734, #2731, #2652, #2720, #2721, #2717, #2864, #2694, #2709, #2658, #2796, #2692, #2657, #2813, #2661, #2398)
The Flower testing and development infrastructure has received substantial updates. This makes Flower 1.7 the most tested release ever.
Update dependencies (#2753, #2651, #2739, #2837, #2788, #2811, #2774, #2790, #2751, #2850, #2812, #2872, #2736, #2756, #2857, #2757, #2810, #2740, #2789)
General improvements (#2803, #2847, #2877, #2690, #2889, #2874, #2819, #2689, #2457, #2870, #2669, #2876, #2885, #2858, #2867, #2351, #2886, #2860, #2828, #2869, #2875, #2733, #2488, #2646, #2879, #2821, #2855, #2800, #2807, #2801, #2804, #2851, #2787, #2852, #2672, #2759)
不兼容的更改¶
Deprecate
start_numpy_client
(#2563, #2718)Until now, clients of type
NumPyClient
needed to be started viastart_numpy_client
. In our efforts to consolidate framework APIs, we have introduced changes, and now all client types should start viastart_client
. To continue usingNumPyClient
clients, you simply need to first call the.to_client()
method and then pass returnedClient
object tostart_client
. The examples and the documentation have been updated accordingly.Deprecate legacy DP wrappers (#2749)
Legacy DP wrapper classes are deprecated, but still functional. This is in preparation for an all-new pluggable version of differential privacy support in Flower.
Make optional arg
--callable
inflower-client
a required positional arg (#2673)Rename
certificates
toroot_certificates
inDriver
(#2890)Drop experimental
Task
fields (#2866, #2865)Experimental fields
sa
,legacy_server_message
andlegacy_client_message
were removed fromTask
message. The removed fields are superseded by the newRecordSet
abstraction.Retire MXNet examples (#2724)
The development of the MXNet fremework has ended and the project is now archived on GitHub. Existing MXNet examples won't receive updates.
v1.6.0 (2023-11-28)¶
感谢我们的贡献者¶
在此,我们要特别感谢所有为 Flower 的新版本做出贡献的人员(按 git shortlog
顺序排列):
Aashish Kolluri
, Adam Narozniak
, Alessio Mora
, Barathwaja S
, Charles Beauville
, Daniel J. Beutel
, Daniel Nata Nugraha
, Gabriel Mota
, Heng Pan
, Ivan Agarský
, JS.KIM
, Javier
, Marius Schlegel
, Navin Chandra
, Nic Lane
, Peterpan828
, Qinbin Li
, Shaz-hash
, Steve Laskaridis
, Taner Topal
, William Lindskog
, Yan Gao
, cnxdeveloper
, k3nfalt
有什么新内容?¶
** 增加对 Python 3.12 的实验支持** (#2565)
Add new XGBoost examples (#2612, #2554, #2617, #2618, #2619, #2567)
We have added a new
xgboost-quickstart
example alongside a newxgboost-comprehensive
example that goes more in-depth.Add Vertical FL example (#2598)
We had many questions about Vertical Federated Learning using Flower, so we decided to add an simple example for it on the Titanic dataset alongside a tutorial (in the README).
在*
start_driver()
中支持自定义***`ClientManager(#2292)更新 REST API 以支持创建和删除节点 (#2283)
Update the Android SDK (#2187)
Add gRPC request-response capability to the Android SDK.
Update the C++ SDK (#2537, #2528, #2523, #2522)
为 C++ SDK 添加 gRPC 请求-响应功能。
Make HTTPS the new default (#2591, #2636)
Flower is moving to HTTPS by default. The new
flower-server
requires passing--certificates
, but users can enable--insecure
to use HTTP for prototyping. The same applies toflower-client
, which can either use user-provided credentials or gRPC-bundled certificates to connect to an HTTPS-enabled server or requires opt-out via passing--insecure
to enable insecure HTTP connections.For backward compatibility,
start_client()
andstart_numpy_client()
will still start in insecure mode by default. In a future release, insecure connections will require user opt-in by passinginsecure=True
.** 统一客户端应用程序接口** (#2303, #2390, #2493)
Using the
client_fn
, Flower clients can interchangeably run as standalone processes (i.e. viastart_client
) or in simulation (i.e. viastart_simulation
) without requiring changes to how the client class is defined and instantiated. Theto_client()
function is introduced to convert aNumPyClient
to aClient
.-
新的 "Bulyan"策略通过[El Mhamdi 等人,2018](https://arxiv.org/abs/1802.07927)实现
Add new
XGB Bagging
strategy (#2611)更新 Flower Baselines
General updates to Flower Examples (#2384, #2425, #2526, #2302, #2545)
General updates to Flower Baselines (#2301, #2305, #2307, #2327, #2435, #2462, #2463, #2461, #2469, #2466, #2471, #2472, #2470)
General updates to the simulation engine (#2331, #2447, #2448, #2294)
General updates to Flower SDKs (#2288, #2429, #2555, #2543, #2544, #2597, #2623)
General improvements (#2309, #2310, #2313, #2316, #2317, #2349, #2360, #2402, #2446, #2561, #2273, #2267, #2274, #2275, #2432, #2251, #2321, #1936, #2408, #2413, #2401, #2531, #2534, #2535, #2521, #2553, #2596)
Flower 进行了许多改进,这里就不一一列举了。
不兼容的更改¶
v1.5.0 (2023-08-31)¶
感谢我们的贡献者¶
在此,我们要特别感谢所有为 Flower 的新版本做出贡献的人员(按 git shortlog
顺序排列):
Adam Narozniak
, Anass Anhari
, Charles Beauville
, Dana-Farber
, Daniel J. Beutel
, Daniel Nata Nugraha
, Edoardo Gabrielli
, Gustavo Bertoli
, Heng Pan
, Javier
, Mahdi
, Steven Hé (Sīchàng)
, Taner Topal
, achiverram28
, danielnugraha
, eunchung
, ruthgal
有什么新内容?¶
引入新的模拟引擎 (#1969, #2221, #2248)
新的模拟引擎从头开始重新编写,但仍完全向后兼容。它的稳定性和内存处理能力大大提高,尤其是在使用 GPU 时。仿真可透明地适应不同的设置,以在仅 CPU、CPU+GPU、多 GPU 或多节点多 GPU 环境中扩展模拟。
综合文档包括新的how-to run simulations guide, new simulation-pytorch and simulation-tensorflow notebooks, and a new YouTube tutorial series。
重构 Flower 文档 (#1824, #1865, #1884, #1887, #1919, #1922, #1920, #1923, #1924, #1962, #2006, #2133, #2203, #2215, #2122, #2223, #2219, #2232, #2233, #2234, #2235, #2237, #2238, #2242, #2231, #2243, #2227)
Much effort went into a completely restructured Flower docs experience. The documentation on flower.ai/docs is now divided into Flower Framework, Flower Baselines, Flower Android SDK, Flower iOS SDK, and code example projects.
介绍 Flower Swift SDK (#1858, #1897)
这是 Flower Swift SDK 的首个预览版。Flower 对 iOS 的支持正在不断改进,除了 Swift SDK 和代码示例外,现在还有 iOS 快速入门教程。
介绍Flower Android SDK (#2131)
这是 Flower Kotlin SDK 的首个预览版。Flower 对 Android 的支持正在不断改进,除了 Kotlin SDK 和代码示例,现在还有 Android 快速入门教程。
介绍新的端到端测试* (#1842, #2071, #2072, #2068, #2067, #2069, #2073, #2070, #2074, #2082, #2084, #2093, #2109, #2095, #2140, #2137, #2165)
新的测试设施可确保新的变更与现有的框架集成或策略保持兼容。
** 过时的 Python 3.7**
由于 Python 3.7 已于 2023-06-27 弃用 (EOL),对 Python 3.7 的支持现已废弃,并将在即将发布的版本中移除。
添加新的
FedTrimmedAvg
策略(#1769, #1853新的 "FedTrimmedAvg "策略实现了[Dong Yin, 2018](https://arxiv.org/abs/1803.01498)的 "Trimmed Mean"。
引入 start_driver(#1697)
除了
start_server
和使用原始驱动 API 之外,还有一个新的start_driver
函数,只需修改一行代码,就能将start_server
脚本作为 Flower 驱动程序运行。请查看mt-pytorch
代码示例,了解使用start_driver
的工作示例。为
mt-pytorch
代码示例添加参数聚合 (#1785)mt-pytorch
示例展示了如何在编写驱动程序脚本时聚合参数。附带的driver.py
和server.py
已经进行了调整,以演示构建服务器端逻辑的低级方法和高级方法。将实验性 REST API 移植到 Starlette (2171)
REST API(试验性)曾在 FastAPI 中实现,但现在已迁移到直接使用 Starlette 。
请注意:REST 请求-响应 API 仍处于试验阶段,随着时间的推移可能会发生重大变化。
引入实验性 gRPC 请求-响应 API (#1867, #1901
除了现有的 gRPC 应用程序接口(基于双向流)和试验性 REST 应用程序接口外,现在还有一个新的 gRPC 应用程序接口,它使用请求-响应模型与客户端节点通信。
请注意:gRPC 请求-响应 API 仍处于试验阶段,随着时间的推移可能会发生重大变化。
用新的
start_client(transport="rest")
替换实验性**start_client(rest=True)
(#1880)已废弃(试验性的)
start_client
参数rest
,改用新参数transport
。start_client(transport="rest")
将产生与以前的start_client(rest=True)
相同的行为。所有代码都应迁移到新参数transport
。过时的参数rest
将在今后的版本中删除。** 添加一个新的 gRPC 选项**(#2197)
现在我们启动一个 gRPC 服务器,并将
grpc.keepalive_permit_without_calls
选项默认设置为 0。这将防止客户端在没有未处理数据流时发送 keepalive pings。改进示例笔记 (#2005)
有一个新的 30 分钟的联邦学习 PyTorch 教程!
更新Example (#1772, #1873, #1981, #1988, #1984, #1982, #2112, #2144, #2174, #2225, #2183)
许多示例都进行了重大更新,包括简化了 advanced-tensorflow 和 advanced-pytorch 示例,改进了 TensorFlow 示例的 macOS 兼容性,以及模拟代码示例。一项重大升级是所有代码示例现在都有了 "requirements.txt"(除 "pyproject.toml "外)。
普通改进(#1872, #1866, #1884, #1837, #1477, #2171)
Flower 进行了许多改进,这里就不一一列举了。
不兼容的更改¶
无
v1.4.0 (2023-04-21)¶
感谢我们的贡献者¶
在此,我们要特别感谢所有为 Flower 的新版本做出贡献的人员(按 git shortlog
顺序排列):
Adam Narozniak
, Alexander Viala Bellander
, Charles Beauville
, Chenyang Ma (Danny)
, Daniel J. Beutel
, Edoardo
, Gautam Jajoo
, Iacob-Alexandru-Andrei
, JDRanpariya
, Jean Charle Yaacoub
, Kunal Sarkhel
, L. Jiang
, Lennart Behme
, Max Kapsecker
, Michał
, Nic Lane
, Nikolaos Episkopos
, Ragy
, Saurav Maheshkar
, Semo Yang
, Steve Laskaridis
, Steven Hé (Sīchàng)
, Taner Topal
有什么新内容?¶
引入对XGBoost的支持(
FedXgbNnAvg
策略和示例) (#1694, #1709, #1715, #1717, #1763, #1795)XGBoost 是一种基于树的集合机器学习算法,它使用梯度提升来提高模型的准确性。我们添加了一个新的 "FedXgbNnAvg"策略和一个代码示例,演示如何在 XGBoost 项目中使用这个新策略。
介绍 iOS SDK(预览版) (#1621, #1764)
对于想要在 iOS 移动设备上实施联邦学习的人来说,这是一次重大更新。现在,我们在 src/swift/flwr 下提供了一个迅捷的 iOS SDK,这将大大方便应用程序的创建过程。为了展示其使用情况,我们还更新了 iOS 示例!
引入新的 "什么是联邦学习?"教程(#1657, #1721
我们的文档中新增了一个入门级教程,解释了联邦学习的基础知识。它让任何不熟悉联邦学习的人都能开始 Flower 之旅。请转发给对联邦学习感兴趣的人!
引入新的 Flower Baseline: FedProx MNIST (#1513, #1680, #1681, #1679
这条新Baseline复现了论文Federated Optimization in Heterogeneous Networks (Li et al., 2018)中的 MNIST+CNN 任务。它使用 "FedProx "策略,旨在使收敛在异构环境中更加稳健。
引入新的 Flower Baseline: FedAvg FEMNIST (#1655)
这一新Baseline复现了论文LEAF: A Benchmark for Federated Settings(Caldas 等人,2018 年)中评估 FedAvg 算法在 FEMNIST 数据集上性能的实验。
引入(试验性)REST API (#1594, #1690, #1695, #1712, #1802, #1770, #1733)
作为基于 gRPC 的通信栈的替代方案,我们引入了新的 REST API。在初始版本中,REST API 仅支持匿名客户端。
请注意:REST API 仍处于试验阶段,随着时间的推移可能会发生重大变化。
改进(试验性)驱动程序应用程序接口 (#1663, #1666, #1667, #1664, #1675, #1676, #1693, #1662, #1794)
驱动程序应用程序接口(Driver API)仍是一项试验性功能,但这一版本引入了一些重大升级。主要改进之一是引入了 SQLite 数据库,将服务器状态存储在磁盘上(而不是内存中)。另一项改进是,已交付的任务(指令或结果)现在将被删除。这大大提高了长期运行的 Flower 服务器的内存效率。
修复模拟过程中与Ray有关的溢出问题 (#1698)
在运行长时间模拟时,
ray
有时会溢出大量数据,导致训练无法继续。现在这个问题已经解决!🎉** 添加使用**
TabNet
** 的新示例** (#1725)TabNet 是一个强大而灵活的框架,用于在表格数据上训练机器学习模型。我们现在有一个使用 Flower 的联邦示例:quickstart-tabnet。
** 添加新的模拟监控指南** (#1649)
我们现在有一份文档指南,可帮助用户在模拟过程中监控其性能。
在模拟过程中为*
历史
对象添加训练指标 (#1696)fit_metrics_aggregation_fn
可用于汇总训练指标,但以前的版本不会将结果保存在 "History "对象中。现在可以了!普通改进 (#1659, #1646, #1647, #1471, #1648, #1651, #1652, #1653, #1659, #1665, #1670, #1672, #1677, #1684, #1683, #1686, #1682, #1685, #1692, #1705, #1708, #1711, #1713, #1714, #1718, #1716, #1723, #1735, #1678, #1750, #1753, #1736, #1766, #1760, #1775, #1776, #1777, #1779, #1784, #1773, #1755, #1789, #1788, #1798, #1799, #1739, #1800, #1804, #1805)
Flower 进行了许多改进,这里就不一一列举了。
不兼容的更改¶
无
v1.3.0 (2023-02-06)¶
感谢我们的贡献者¶
在此,我们要特别感谢所有为 Flower 的新版本做出贡献的人员(按 git shortlog
顺序排列):
Adam Narozniak
, Alexander Viala Bellander
, Charles Beauville
, Daniel J. Beutel
, JDRanpariya
, Lennart Behme
, Taner Topal
有什么新内容?¶
在驱动程序应用程序接口中添加对
workload_id
和group_id
的支持 (#1595)驱动程序 API(试验性)现在支持
workload_id
,可用于识别任务所属的工作量。它还支持新的group_id
,例如,可用于指示当前的训练轮次。通过workload_id
和group_id
客户端节点可以决定是否要处理某个任务。使Driver API 和Fleet API地址可配置(#1637)
长期运行的 Flower 服务器(Driver API 和 Fleet API)现在可以在启动时配置 Driver API(通过
--driver-api-address
)和 Fleet API(通过-fleet-api-address
)的服务器地址:flower-server --driver-api-address "0.0.0.0:8081" --fleet-api-address "0.0.0.0:8086"
支持 IPv4 和 IPv6 地址。
** 添加使用 fastai 和 Flower 进行联邦学习的新示例** (#1598)
一个新的代码示例(
quickstart-fastai
)演示了使用 fastai 和 Flower 的联邦学习。您可以在这里找到它: quickstart-fastai。使安卓示例兼容
flwr >= 1.0.0
和最新版本的安卓 (#1603)Android 代码示例已进行了大幅更新:项目兼容 Flower 1.0(及更高版本),用户界面已全面刷新,项目已更新为兼容较新的 Android 工具。
添加新的
FedProx
策略 (#1619)该策略与
FedAvg
几乎相同,但可以帮助用户复现本论文中的描述。它的本质是添加一个名为proximal_mu
的参数,使局部模型与全局模型正则化。为遥测事件添加新指标(#1640)
例如,更新后的事件结构可以将同一工作负载中的事件集中在一起。
添加新的自定义策略教程部分 #1623
Flower 教程新增了一个章节,介绍如何从零开始实施自定义策略: 在 Colab 中打开
** 添加新的自定义序列化教程部分** (#1622)
Flower 教程现在新增了一个章节,介绍自定义序列化: 在 Colab 中打开
普通改进 (#1638, #1634, #1636, #1635, #1633, #1632, #1631, #1630, [#1627](https://github. com/adap/flower/pull/1627), #1593, #1616, #1615, #1607, #1609, #1608, #1603, [#1590](https://github. com/adap/flower/pull/1590), #1580, #1599, #1600, #1601, #1597, #1595, #1591, [#1588](https://github. com/adap/flower/pull/1588), #1589, #1587, #1573, #1581, #1578, #1574, #1572, #1586)
Flower 进行了许多改进,这里就不一一列举了。
** 更新文档** (#1629, #1628, #1620, #1618, #1617, #1613, #1614))
和往常一样,我们的文档有了很大的改进。这是我们努力使 Flower 文档成为所有项目中最好文档的又一步骤。请继续关注,并随时提供反馈意见!
不兼容的更改¶
无
v1.2.0 (2023-01-13)¶
感谢我们的贡献者¶
在此,我们要特别感谢所有为 Flower 的新版本做出贡献的人员(按 git shortlog
顺序排列):
Adam Narozniak
, Charles Beauville
, Daniel J. Beutel
, Edoardo
, L. Jiang
, Ragy
, Taner Topal
, dannymcy
有什么新内容?¶
引入新的 Flower Baseline: FedAvg MNIST (#1497, #1552)
在未来几周内,我们将发布一些新的参考,特别是对 FL 新手有用的方法。它们通常会重温文献中的知名论文,适合集成到您自己的应用程序中或用于实验,以加深您对 FL 的总体了解。今天发布的是该系列中的第一篇。阅读全文
改进模拟中的 GPU 支持(#1555)
基于 Ray 的虚拟客户端引擎 (
start_simulation
)已更新,以改进对 GPU 的支持。此次更新包含了在 GPU 集群环境中扩展模拟的一些经验教训。新的默认设置使基于 GPU 的模拟运行更加稳健。改进 Jupyter Notebook 教程中的 GPU 支持 (#1527, #1558)
一些用户报告说,在 GPU 实例上使用 Jupyter 笔记本并不是很方便。我们听取了他们的意见,并对所有 Jupyter 笔记本进行了改进!点击这里查看更新后的笔记本:
-
在社区发出反馈请求之后,Flower 开放源码项目引入了可选的匿名使用指标收集,以便在充分知情的情况下做出改进 Flower 的决定。这样做能让 Flower 团队了解 Flower 的使用情况以及用户可能面临的挑战。
Flower 是一个用于协作式人工智能和数据科学的友好框架。 Flower 遵循这一声明,让不想分享匿名使用指标的用户可以轻松禁用遥测技术。阅读全文。
引入(试验性)Driver API (#1520, #1525, #1545, #1546, #1550, #1551, #1567)
Flower 现在有了一个新的(试验性的)驱动程序应用程序接口(Driver API),它将支持完全可编程、异步和多租户的联邦学习(Federated Learning)和联邦分析(Federated Analytics)应用程序。展望未来,Driver API 将成为许多即将推出的功能的抽象基础,您现在就可以开始构建这些功能。
驱动程序应用程序接口还支持一种新的执行模式,在这种模式下,服务器可无限期运行。多个单独的工作负载可以同时运行,并独立于服务器启动和停止执行。这对于希望在生产中部署 Flower 的用户来说尤其有用。
要了解更多信息,请查看
mt-pytorch
代码示例。我们期待您的反馈!请注意:Driver API仍处于试验阶段,随着时间的推移可能会发生重大变化。*
** 添加新的使用 Pandas 的联邦分析示例**(#1469, #1535
新代码示例(
quickstart-pandas
)演示了使用 Pandas 和 Flower 进行联邦分析。您可以在此处找到它: quickstart-pandas。添加新策略: Krum 和 MultiKrum (#1481)
罗马萨皮恩扎大学(Sapienza University)计算机科学专业的学生埃多尔多(Edoardo)提出了一种新的 "Krum "策略,使用户能够在其工作负载中轻松使用 Krum 和 MultiKrum。
** 更新 C++ 示例,与 Flower v1.2.0 兼容** (#1495)
为了与最新版本的 Flower 兼容,C++ 示例代码进行了大幅更新。
普通改进 (#1491, #1504, #1506, #1514, #1522, #1523, [#1526](https://github. com/adap/flower/pull/1526), #1528, #1547, #1549, #1560, #1564, #1566)
Flower 进行了许多改进,这里就不一一列举了。
** 更新文档** (#1494, #1496, #1500, #1503, #1505, #1524, #1518, #1519, #1515)
和往常一样,我们的文档有了很大的改进。这是我们努力使 Flower 文档成为所有项目中最好文档的又一步骤。请继续关注,并随时提供反馈意见!
其中一个亮点是新的首次贡献者指南:如果你以前从未在 GitHub 上做过贡献,这将是一个完美的开始!
不兼容的更改¶
无
v1.1.0 (2022-10-31)¶
感谢我们的贡献者¶
在此,我们向所有促成 Flower 新版本的贡献者致以**特别的谢意(按 "git shortlog "顺序排列):
Akis Linardos
, Christopher S
, Daniel J. Beutel
, George
, Jan Schlicht
, Mohammad Fares
, Pedro Porto Buarque de Gusmão
, Philipp Wiesner
, Rob Luke
, Taner Topal
, VasundharaAgarwal
, danielnugraha
, edogab33
有什么新内容?¶
-
可插拔差分隐私封装器的首个(实验性)预览版可轻松配置和使用差分隐私(DP)。可插拔的差分隐私封装器可实现客户端差分隐私和服务器端差分隐私的框架无关以及策略无关的使用。请访问 Flower 文档,新的解释器会提供更多细节。
新的 iOS CoreML 代码示例(#1289)
Flower 进入 iOS!大量新代码示例展示了如何为 iOS 构建 Flower 客户端。该代码示例包含可用于多种任务的 Flower iOS SDK 组件,以及在 CoreML 上运行的一个任务示例。
新的联邦医疗策略 (#1461)
新的 "FedMedian "战略实现了[Yin 等人,2018]的联邦中值(FedMedian)(https://arxiv.org/pdf/1803.01498v1.pdf)。
虚拟客户端引擎中的日志**
客户端
**异常(#1493)VCE 中发生的所有 "客户端 "异常现在都会被默认记录下来,而不只是暴露给配置的
Strategy
(通过failures
参数)。-
虚拟客户端引擎的部分内部结构已进行了修改。VCE 现在使用 Ray 2.0,"client_resources "字典的值类型改为 "float",以允许分配分数资源。
支持虚拟客户端引擎中的可选
Client
/NumPyClient
方法虚拟客户端引擎现在完全支持可选的
Client
(和NumPyClient
)方法。使用
flwr
向软件包提供类型信息 (#1377)软件包
flwr
现在捆绑了一个py.typed
文件,表明该软件包是类型化的。这样,使用flwr
的项目或软件包就可以使用mypy
等静态类型检查器改进代码,从而获得类型支持。-
涵盖 scikit-learn 和 PyTorch Lightning 的代码示例已更新,以便与最新版本的 Flower 配合使用。
更新文档 (#1355, #1558, #1379, #1380, #1381, #1332, #1391, #1403, [#1364](https://github. com/adap/flower/pull/1364), #1409, #1419, #1444, #1448, #1417, #1449, #1465, #1467)
文档更新的数量之多,甚至没有必要逐一列出。
重构文档(#1387)
我们对文档进行了重组,使其更易于浏览。这只是让 Flower 文档成为所有项目中最好文档的第一步。敬请期待!
在 Colab 中打开按钮 (#1389)
Flower 联邦学习教程的四个部分现在都带有一个新的 "在 Colab 中打开 "按钮。现在,您无需在本地计算机上安装任何软件,只需点击一下,就可以在浏览器中使用和学习 Flower。
改进教程 (#1468, #1470, #1472, #1473, #1474, #1475))
Flower 联邦学习教程有两个全新的部分,涉及自定义策略(仍处于 WIP 阶段)和
Client
与NumPyClient
之间的区别。现有的第一和第二部分也得到了改进(许多小改动和修正)。
不兼容的更改¶
无
v1.0.0 (2022-07-28)¶
亮点¶
稳定的虚拟客户端引擎(可通过
start_simulation
访问)所有
Client
/NumPyClient
方法现在都是可选的了可配置的
get_parameters
对大量小型应用程序接口进行了清理,使开发人员的体验更加一致
感谢我们的贡献者¶
在此,我们谨向所有促成 Flower 1.0 的贡献者致以**特别的谢意(按GitHub 贡献者 倒序排列):
@rtaiello, @g-pichler, @rob-luke, @andreea-zaharia, @kinshukdua, @nfnt, @tatiana-s, @TParcollet, @vballoli, @negedng, @RISHIKESHAVAN, @hei411, @SebastianSpeitel, @AmitChaulwar, @Rubiel1, @FANTOME-PAN, @Rono-BC, @lbhm, @sishtiaq, @remde, @Jueun-Park, @architjen, @PratikGarai, @mrinaald, @zliel, @MeiruiJiang, @sancarlim, @gubertoli, @Vingt100, @MakGulati, @cozek, @jafermarq, @sisco0, @akhilmathurs, @CanTuerk, @mariaboerner1987, @pedropgusmao, @tanertopal, @danieljanes.
不兼容的更改¶
** 所有参数必须作为关键字参数传递** (#1338)
以关键字参数传递所有参数,不再支持位置参数。使用位置参数的代码(例如,
start_client("127.0.0.1:8080", FlowerClient())
)必须为每个位置参数添加关键字(例如,start_client(server_address="127.0.0.1:8080", client=FlowerClient())
)。在*
start_server
和start_simulation
中引入配置对象***ServerConfig
(#1317)并非配置字典
{"num_rounds": 3, "round_timeout": 600.0}
,start_server
和start_simulation
现在用一个类型为flwr.server.ServerConfig
的配置对象。ServerConfig
接收的参数与之前的 config dict 相同,但它使编写类型安全代码变得更容易,默认参数值也更加透明。重新命名内置策略参数,使其更加清晰 (#1334)
以下内置策略参数已重新命名,以提高可读性并与其他 API 保持一致:
fraction_eval
-->fraction_evaluate
min_eval_clients
-->min_evaluate_clients
eval_fn
-->evaluate_fn
更新内置策略的默认参数 (#1278)
所有内置策略现在都使用 "fraction_fit=1.0 "和 "fraction_evaluate=1.0",这意味着它们会选择所有当前可用的客户端进行训练和评估。依赖以前默认值的项目可以通过以下方式初始化策略,获得以前的行为:
strategy = FedAvg(fraction_fit=0.1, fraction_evaluate=0.1)
添加*
server_round
到Strategy.evaluate
(#1334)Strategy
的evaluate
方法现在会接收当前一轮联邦学习/评估作为第一个参数。将*
server_round
和*config
参数添加到*evaluate_fn
(#1334)传递给内置策略(如
FedAvg
)的evaluate_fn
现在需要三个参数:(1) 当前一轮联邦学习/评估 (server_round
),(2) 要评估的模型参数 (parameters
),(3) 配置字典 (config
)。重新命名
rnd
** to**server_round
(#1321)几个 Flower 方法和函数(
evaluate_fn
、configure_fit
、aggregate_fit
、configure_evaluate
、aggregate_evaluate
)的第一个参数是当前一轮的联邦学习/评估。为提高可重复性并避免与 random 混淆,该参数已从rnd
更名为server_round
。移动*
flwr.dataset
到*flwr_baselines
(#1273)实验软件包
flwr.dataset
已迁移至 Flower Baselines。删除实验策略 (#1280)
移除未维护的试验性策略(
FastAndSlow
、FedFSv0
、FedFSv1
)。重新命名
Weights
到NDArrays
(#1258, #1259)flwr.common.Weights "更名为 "flwr.common.NDArrays",以更好地反映该类型的含义。
从
start_server
中移除过时的**force_final_distributed_eval
(#1258, #1259)start_server "参数 "force_final_distributed_eval "长期以来一直是个历史遗留问题,在此版本中终于永远消失了。
使
get_parameters
可配置 (#1242)现在,"get_parameters "方法与 "get_properties"、"fit "和 "evaluate "一样,都接受配置字典。
用新的
config
参数** 替换**num_rounds
** in**start_simulation
** (#1281)现在,
start_simulation
(开始模拟)函数接受配置字典
config而不是
num_rounds整数。这改进了
start_simulation和
start_server` 之间的一致性,并使两者之间的转换更容易。
有什么新内容?¶
** 支持 Python 3.10** (#1320)
上一个 Flower 版本引入了对 Python 3.10 的实验支持,而本版本则宣布对 Python 3.10 的支持为稳定支持。
使所有
Client
和NumPyClient
方法成为可选 (#1260, #1277)Client
/NumPyClient
的 "get_properties"、"get_parameters"、"fit "和 "evaluate "方法都是可选的。这样就可以编写只实现fit
而不实现其他方法的客户端。使用集中评估时,无需实现evaluate
!启用向
start_simulation
传递**Server
实例 (#1281)与
start_server
类似,start_simulation
现在也接受一个完整的Server
实例。这使得用户可以对实验的执行进行大量自定义,并为使用虚拟客户端引擎运行异步 FL 等打开了大门。-
许多代码示例都进行了小规模甚至大规模的维护更新,其中包括
scikit-learn
simulation_pytorch
quickstart_pytorch
quickstart_simulation
quickstart_tensorflow
advanced_tensorflow
删除过时的模拟示例 (#1328)
删除过时的 "simulation "示例,并将 "quickstart_simulation "重命名为 "simulation_tensorflow",使其与 "simulation_pytorch "的命名一致
更新文档 (#1223, #1209, #1251, #1257, #1267, #1268, #1300, #1304, #1305, #1307)
其中一个实质性的文档更新修复了多个较小的渲染问题,使标题更加简洁以改善导航,删除了一个已废弃的库,更新了文档依赖关系,在 API 参考中包含了
flwr.common
模块,包含了对基于 markdown 的文档的支持,将更新日志从.rst
移植到了.md
,并修复了一些较小的细节!小规模更新
v0.19.0 (2022-05-18)¶
有什么新内容?¶
Flower Baselines(预览): FedOpt、FedBN、FedAvgM (#919, #1127, #914)
The first preview release of Flower Baselines has arrived! We're kickstarting Flower Baselines with implementations of FedOpt (FedYogi, FedAdam, FedAdagrad), FedBN, and FedAvgM. Check the documentation on how to use Flower Baselines. With this first preview release we're also inviting the community to contribute their own baselines.
C++客户端SDK(预览版)和代码示例(#1111)
预览版支持用 C++ 编写的 Flower 客户端。C++ 预览版包括一个 Flower 客户端 SDK 和一个快速入门代码示例,使用 SDK 演示了一个简单的 C++ 客户端。
** 增加对 Python 3.10 和 Python 3.11 的实验支持** (#1135)
Python 3.10 是 Python 的最新稳定版本,Python 3.11 将于 10 月份发布。Flower 版本增加了对这两个 Python 版本的实验支持。
通过用户提供的函数聚合自定义指标(#1144)
现在无需定制策略即可聚合自定义度量(如
准确度
)。内置策略支持两个新参数:fit_metrics_aggregation_fn
和evaluate_metrics_aggregation_fn
,允许传递自定义度量聚合函数。用户可配置的回合超时(#1162)
新的配置值允许为
start_server
和start_simulation
设置回合超时。如果config
字典中包含一个round_timeout
键(以秒为单位的float
值),服务器将至少等待 **round_timeout
秒后才关闭连接。允许在所有内置策略中同时使用联邦评价和集中评估 (#1091)
内置策略现在可以在同一轮中同时执行联邦评估(即客户端)和集中评估(即服务器端)。可以通过将
fraction_eval
设置为0.0
来禁用联邦评估。两本新的 Jupyter Notebook 教程 (#1141)
两本 Jupyter Notebook 教程(与 Google Colab 兼容)介绍了 Flower 的基本和中级功能:
联邦学习简介: 在 Colab 中打开
在联邦学习中使用策略: 在 Colab 中打开
新的 FedAvgM 策略(带服务器动量的联邦平均) (#1076)
新的 "FedAvgM "策略实现了带服务器动量的联邦平均[Hsu et al., 2019].
新的 PyTorch 高级代码示例 (#1007)
新代码示例 (
advanced_pytorch
) 演示了 PyTorch 的高级 Flower 概念。-
新代码示例(
jax_from_centralized_to_federated
)展示了使用 JAX 和 Flower 的联邦学习。 小规模更新
不兼容的更改¶
v0.18.0 (2022-02-28)¶
有什么新内容?¶
改进了虚拟客户端引擎与 Jupyter Notebook / Google Colab 的兼容性 (#866, #872, #833, #1036)
通过
start_simulation
在 Jupyter 笔记本(包括 Google Colab)上安装 Flower 并附加simulation
(pip install 'flwr[simulation]'
)后,模拟(通过start_simulation
使用虚拟客户端引擎)现在可以更流畅地运行。新的 Jupyter Notebook 代码示例 (#833)
新代码示例(
quickstart_simulation
)通过 Jupyter Notebook(包括 Google Colab)演示了使用虚拟客户端引擎进行 Flower 模拟。客户端属性(功能预览) (#795)
客户端可以实现一个新方法
get_properties
,以启用服务器端策略来查询客户端属性。** 使用 TFLite 实验性支持安卓系统** (#865)
main
终于支持 Android 了!Flower 的设计与客户端和框架无关。我们可以集成任意客户端平台,有了这个版本,在安卓系统上使用 Flower 就变得更容易了。该示例在客户端使用了 TFLite 以及新的
FedAvgAndroid
策略。Android 客户端和FedAvgAndroid
仍处于试验阶段,但这是向成熟的 Android SDK 和集成了FedAvgAndroid
新功能的统一FedAvg
实现迈出的第一步。使 gRPC 保持连接时间可由用户配置,并缩短默认保持连接时间 (#1069)
为提高 Flower 与更多云环境(如 Microsoft Azure)的兼容性,缩短了默认 gRPC 保持时间。用户可以根据具体要求配置 keepalive 时间,自定义 gRPC 堆栈。
使用 Opacus 和 PyTorch 的新差分隐私示例 (#805)
一个新的代码示例("opacus")演示了使用 Opacus、PyTorch 和 Flower 进行差分隐私的联邦学习。
新的Hugging Face Transformers代码示例 (#863)
新的代码示例(
quickstart_huggingface
)证明了结合Flower和Hugging Face Transformers的实用性。新的 MLCube 代码示例 (#779, #1034, #1065, #1090)
新代码示例("quickstart_mlcube")演示了 MLCube 与 Flower 的用法。
** 支持 SSL 的服务器和客户端** (#842, #844, #845, #847, #993, #994)
SSL 可实现客户端与服务器之间的安全加密连接。该版本开源了 Flower 安全 gRPC 实现,使所有 Flower 用户都能访问加密通信通道。
更新
FedAdam
和FedYogi
战略 (#885, #895)FedAdam "和 "FedAdam "与最新版本的 "自适应联邦优化 "论文相匹配。
初始化
start_simulation
使用客户端 ID 列表 (#860)现在可以使用客户端 ID 列表(
clients_ids
,类型:List[str]
)调用start_simulation
。每当需要初始化客户端时,这些 ID 就会被传递到client_fn
中,这样就能更轻松地加载无法通过int
标识符访问的数据分区。小规模更新
不兼容的更改¶
从发布版中删除
flwr_example
和flwr_experimental
** (#869)自 Flower 0.12.0 起,软件包
flwr_example
和flwr_experimental
已被弃用,它们不再包含在 Flower 的发布版本中。相关的额外包(baseline
,examples-pytorch
,examples-tensorflow
,http-logger
,ops
)现在已不再使用,并将在即将发布的版本中移除。
v0.17.0 (2021-09-24)¶
有什么新内容?¶
-
Flower 的目标之一是实现大规模研究。这一版本首次(试验性地)展示了代号为 "虚拟客户端引擎 "的重要新功能。虚拟客户端可以在单台机器或计算集群上对大量客户端进行模拟。测试新功能的最简单方法是查看名为 "quickstart_simulation "和 "simulation_pytorch "的两个新代码示例。
该功能仍处于试验阶段,因此无法保证 API 的稳定性。此外,它还没有完全准备好进入黄金时间,并有一些已知的注意事项。不过,我们鼓励好奇的用户尝试使用并分享他们的想法。
-
FedYogi - 在服务器端使用 Yogi 的联邦学习策略。基于 https://arxiv.org/abs/2003.00295 实现
FedAdam - 在服务器端使用 Adam 的联邦学习策略。基于 https://arxiv.org/abs/2003.00295 实现
新的 PyTorch Lightning 代码示例 (#617)
新的变分自动编码器代码示例 (#752)
新的 scikit-learn 代码示例 (#748)
新的实验性 TensorBoard 策略(#789)
小规模更新
不兼容的更改¶
禁用最终分布式评价 (#800)
之前的行为是在所有连接的客户端上执行最后一轮分布式评估,而这通常是不需要的(例如,在使用服务器端评估时)。可以通过向
start_server
传递force_final_distributed_eval=True
来启用之前的行为。更名为 q-FedAvg 策略 (#802)
名为
QffedAvg
的策略已更名为QFedAvg
,以更好地反映原始论文中给出的符号(q-FFL 是优化目标,q-FedAvg 是建议的求解器)。请注意,出于兼容性原因,原始(现已废弃)的QffedAvg
类仍然可用(它将在未来的版本中移除)。删除并重命名代码示例
simulation_pytorch
为simulation_pytorch_legacy
(#791)该示例已被新示例取代。新示例基于试验性虚拟客户端引擎,它将成为在 Flower 中进行大多数类型大规模模拟的新的默认方式。现有示例将作为参考保留,但将来可能会删除。
v0.16.0 (2021-05-11)¶
有什么新内容?¶
新的内置策略 (#549)
(摘要) FedOpt
FedAdagrad
服务器和策略的自定义指标 (#717)
Flower 服务器现在完全与任务无关,所有剩余的任务特定度量(如 "准确度")都已被自定义度量字典取代。Flower 0.15 引入了从客户端向服务器传递包含自定义指标的字典的功能。从本版本开始,自定义指标将取代服务器上的特定任务指标。
自定义度量字典现在可在两个面向用户的 API 中使用:它们可从策略方法
aggregate_fit
/aggregate_evaluate
返回,还可使传递给内置策略(通过eval_fn
)的评估函数返回两个以上的评估度量。策略甚至可以返回 aggregated 指标字典,以便服务器跟踪。Strategy 实现应将其
aggregate_fit
和aggregate_evaluate
方法迁移到新的返回类型(例如,只需返回空的{}
),服务器端评估函数应从return loss, accuracy
迁移到return loss, {"accuracy": accuracy}
。Flower 0.15 风格的返回类型已被弃用(但仍受支持),兼容性将在未来的版本中移除。
** 过时功能的迁移警告** (#690)
Flower 早期版本通常会迁移到新的应用程序接口,同时保持与旧版应用程序接口的兼容。如果检测到使用了过时的 API,本版本将引入详细的警告信息。新的警告信息通常会详细说明如何迁移到更新的 API,从而简化从一个版本到另一个版本的过渡。
MXNet 示例和文档
不兼容的更改¶
序列化无关服务器 (#721)
Flower 服务器现在完全不依赖序列化。之前使用的
Weights
类(以反序列化的 NumPy ndarrays 表示参数)已被Parameters
类取代(例如在Strategy
中)。参数 "对象与序列化完全无关,它以字节数组的形式表示参数,"tensor_type "属性表示如何解释这些字节数组(例如,用于序列化/反序列化)。内置策略通过在内部处理序列化和反序列化到/从
Weights
来实现这种方法。自定义/第三方策略实现应更新为稍有改动的策略方法定义。策略作者可查阅 PR #721 以了解如何将策略轻松迁移到新格式。已弃用
flwr.server.Server.evaluate
,改用flwr.server.Server.evaluate_round
(#717
v0.15.0 (2021-03-12)¶
有什么新内容?
服务器端参数初始化 (#658)
现在可以在服务器端初始化模型参数。服务器端参数初始化通过名为 "initialize_parameters "的新 "Strategy "方法进行。
内置策略支持名为 "initial_parameters "的新构造函数参数,用于设置初始参数。内置策略会在启动时向服务器提供这些初始参数,然后删除它们以释放内存。
# Create model model = tf.keras.applications.EfficientNetB0( input_shape=(32, 32, 3), weights=None, classes=10 ) model.compile("adam", "sparse_categorical_crossentropy", metrics=["accuracy"]) # Create strategy and initialize parameters on the server-side strategy = fl.server.strategy.FedAvg( # ... (other constructor arguments) initial_parameters=model.get_weights(), ) # Start Flower server with the strategy fl.server.start_server("[::]:8080", config={"num_rounds": 3}, strategy=strategy)
如果没有向策略提供初始参数,服务器将继续使用当前行为(即向其中一个已连接的客户端询问参数,并将这些参数用作初始全局参数)。
停用
停用
flwr.server.strategy.DefaultStrategy
(迁移到等价的flwr.server.strategy.FedAvg
)
v0.14.0 (2021-02-18)¶
有什么新内容?
通用
Client.fit
和Client.evaluate
返回值 (#610 #572 #633)客户端现在可以返回一个额外的字典,将
str
键映射为以下类型的值: bool、
bytes、
float、
int、
str。这意味着我们可以从
fit/
evaluate` 返回几乎任意的值,并在服务器端使用它们!这一改进还使
fit
和evaluate
之间的返回类型更加一致:evaluate
现在应返回一个元组(float, int, dict)
,代表损失、示例数和一个包含特定问题任意值(如准确度)的字典。如果你想知道:此功能与现有项目兼容,额外的字典返回值是可选的。不过,新代码应迁移到新的返回类型,以便与即将发布的 Flower 版本兼容(
fit
:List[np.ndarray], int, Dict[str, Scalar]
,evaluate
:float, int, Dict[str, Scalar]
)。详见下面的示例。代码示例: 注意
FlwrClient.fit
和FlwrClient.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}
在
Client.fit
和Client.evaluate
中泛化**config
参数(#595)config
参数曾是 "字典[str, str]"类型,这意味着字典值应是字符串。新版本将其扩展为以下类型的值: bool、
bytes、
float、
int、
str`。这意味着现在可以使用
config
字典向fit
/evaluate
传递几乎任意的值。耶,服务器端不再需要str(epochs)
,客户端不再需要int(config["epochs"])
!代码示例: 注意
config
字典现在在Client.fit
和Client.evaluate
中都包含非str
值: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}
v0.13.0 (2021-01-08)¶
有什么新内容?
错误修正:
v0.12.0 (2020-12-07)¶
重要变更:
v0.11.0 (2020-11-30)¶
不兼容的更改:
重命名了策略方法(#486),以统一 Flower公共 API 的命名。其他公共方法/函数(例如
Client
中的每个方法,以及Strategy.evaluate
)不使用on_
前缀,这就是我们从 Strategy 中的四个方法中移除它的原因。迁移时,请相应地重命名以下Strategy
方法:on_configure_evaluate
=>configure_evaluate
on_aggregate_evaluate
=>aggregate_evaluate
on_configure_fit
=>configure_fit
on_aggregate_fit
=>aggregate_fit
重要变更: