Comments (3)
Hi @jafermarq please note that the documentation is highly misleading because the title of that section is "configuring individual clients" and the example does not achieve what the title suggests. The workaround you cited is the one I am using right now. I want to point out that this procedure is extremely inefficient because it implies copying N times all the fields inside FitIns
, among which there are the parameters, ending up in poor memory usage. Don't you think it would be a good idea to use another dictionary other than FitIns
to pass configuration parameters so that we don't need to copy the model parameters?
Thank you for your reply!
from flower.
This can be achieved by customizing an existing strategy or by implementing a custom strategy from scratch. Here’s a nonsensical example that customizes FedAvg by adding a custom "hello": "world" configuration key/value pair to the config dict of a single client (only the first client in the list, the other clients in this round to not receive this “special” config value):
# Add special "hello": "world" config key/value pair, # but only to the first client in the list _, fit_ins = client_instructions[0] # First (ClientProxy, FitIns) pair fit_ins.config["hello"] = "world" # Change config for this client only
I think the code needs to be updated so that it is in fact only the first client receives {"hello": "world"}
, such as:
_, fit_ins = client_instructions[0]
fit_ins = FitIns(parameters=fit_ins.parameters, fit_ins.config | {"hello": "world"})
Is this a Pythonic behavior or somewhere else in the codebase would have required such workarounds in the first place?
EDIT: I was wrong, using copy
would solve the problem but would result in poor memory usage as well:
client_instructions = [(client, copy(fit_ins)) for client, fit_ins in client_instructions]
_, fit_ins = client_instructions[0]
fit_ins.config = fit_ins.config | {"hello": "world"})
from flower.
Hey @gioperin, that part of the documentation indicates (as you point out) how to configure clients, but not individually. You can still achieve what you want by implementing a custom strategy and overriding the configure_fit()
method and assign a different FitIns
object to each client that has been sampled.
from flower.
Related Issues (20)
- example run failed HOT 3
- Add Flower Baseline: FedGen HOT 1
- Add Flower Baseline: FedDebug HOT 3
- I cant run code on the Flower Tutorial : Get started with Flower HOT 4
- Run simulation_pytorch example, there are some questions HOT 6
- How to add data augmentation in clients' local datasets? HOT 1
- pip install flwr, but there are some ImportErrors HOT 4
- how to load the mnist dataset locally HOT 3
- Inplace update error in loading state_dict for YOLOV8 HOT 5
- Unable to start federated training on CUDA when using YOLOv8 model
- Can a client call a server-side function?
- cryptography 42
- Arduino Client for federated learning with Flower HOT 1
- Label and feature skew Partitioner HOT 1
- Does the Flower support decentralized federated learning?
- Memory error in Flower simulation with 10 clients MNIST task HOT 2
- Problem when running examples/llm-flowertune/main.py HOT 3
- “evaluate_fn” appearance of test results nan issues HOT 1
- After passing the TRAIN function, the model parameters were not updated, resulting in the final evaluation criteria output of the TEST function being the same as the initial stage HOT 4
- Fatal Python error: Aborted HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flower.