-
Notifications
You must be signed in to change notification settings - Fork 1.1k
refactor(examples): Update vertical-fl example to Message API and to use flwr-datasets
#6238
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| arrc = ArrayRecord({"local-gradients": Array(embeddings_grad[pos].numpy())}) | ||
| message = Message( | ||
| content=RecordDict({"gradients": arrc}), | ||
| message_type="train.apply_gradients", # target `train` method in ClientApp |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love this!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR refactors the vertical-fl example to use the new Message API and integrate flwr-datasets for data partitioning. The refactoring modernizes the example by replacing the old NumPyClient pattern with the Message API and leveraging Flower Datasets' VerticalSizePartitioner for cleaner vertical data partitioning.
Key Changes:
- Migrated from NumPyClient to Message API with
@app.query()and@app.train()decorators - Integrated VerticalSizePartitioner from flwr-datasets to replace custom vertical partitioning logic
- Updated ServerApp to use Grid API for message-based communication
- Removed local CSV file in favor of HuggingFace dataset loading
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
vertical_fl/task.py |
Replaced custom data processing with flwr-datasets integration and simplified preprocessing; moved ServerModel definition from strategy.py |
vertical_fl/strategy.py |
Removed file entirely as custom strategy is no longer needed with Message API |
vertical_fl/server_app.py |
Complete rewrite to use Grid API and Message-based communication for coordinating vertical FL training |
vertical_fl/client_app.py |
Migrated from NumPyClient to Message API with separate query and train handlers |
pyproject.toml |
Updated dependency versions and configuration parameters |
data/train.csv |
Removed local data file (now using HuggingFace dataset) |
README.md |
Updated documentation to reflect new architecture and usage patterns |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Heng Pan <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Heng Pan <[email protected]>
panh99
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Amazing overhaul.
No description provided.