Skip to content

Conversation

@Spiral-Memory
Copy link

@Spiral-Memory Spiral-Memory commented Aug 23, 2025

What type of PR is this?

/kind bug
/kind cleanup
/kind documentation

What this PR does / why we need it:

This PR provides a comprehensive fix for the federated_learning/fedavg example, which was previously unusable for new community members. The example was plagued by a cascade of issues including hardcoded absolute paths, undocumented environmental requirements (Python 3.10), a runtime code bug, and a complete lack of documentation.

This contribution restores the example to a fully functional and portable state. It introduces a centralized configuration system (config.py) to dynamically handle file paths, adds a README.md with clear setup instructions, includes a requirements.txt for a reproducible environment, and fixes the underlying code bug in basemodel.py.

Which issue(s) this PR fixes:

Fixes #252

2025-08-24.00-24-08.mp4

Signed-off-by: Zishan Ahmad <[email protected]>
Signed-off-by: Zishan Ahmad <[email protected]>
Signed-off-by: Zishan Ahmad <[email protected]>
Signed-off-by: Zishan Ahmad <[email protected]>
Signed-off-by: Zishan Ahmad <[email protected]>
@kubeedge-bot kubeedge-bot added kind/bug Categorizes issue or PR as related to a bug. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. kind/documentation Categorizes issue or PR as related to documentation. labels Aug 23, 2025
@kubeedge-bot
Copy link
Collaborator

Welcome @Spiral-Memory! It looks like this is your first PR to kubeedge/ianvs 🎉

@kubeedge-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
To complete the pull request process, please assign jaypume after the PR has been reviewed.
You can assign the PR to them by writing /assign @jaypume in a comment when ready.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubeedge-bot kubeedge-bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Aug 23, 2025
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary of Changes

Hello @Spiral-Memory, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request comprehensively addresses several critical issues within the federated_learning/fedavg example for CIFAR-100, making it fully functional and portable. It resolves problems stemming from hardcoded absolute paths, missing environmental requirements, a runtime bug, and a lack of clear documentation, ensuring new community members can easily use and reproduce the example.

Highlights

  • Centralized Path Management: Introduced config.py to define and manage all file paths dynamically, eliminating hardcoded absolute paths across various configuration files.
  • Enhanced Documentation: Added a README.md with clear, step-by-step instructions for setting up the environment, configuring paths, preparing the dataset, and running the example.
  • Reproducible Environment: Included a requirements.txt file to specify necessary Python dependencies, ensuring a consistent and reproducible environment.
  • Runtime Bug Fix: Corrected a critical bug in basemodel.py within the predict method, which previously prevented the example from running correctly.
  • Path Standardization: Updated numerous YAML configuration files (algorithm.yaml, benchmarkingjob.yaml, testenv.yaml) to utilize placeholders managed by config.py for model, output, and dataset index paths.
  • Utility Script Integration: Modified utils.py to leverage the new centralized path configurations for dataset processing and saving.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request is a great improvement for the federated_learning/fedavg example, making it portable and usable by removing hardcoded paths and adding necessary documentation and configuration. The introduction of config.py to manage paths and the fix in basemodel.py are excellent changes. I've found a critical issue in the new requirements.txt with an invalid package version, and a medium-severity issue in the new README.md where the instructions could be clearer. Addressing these will make the example fully functional as intended.

Signed-off-by: Zishan Ahmad <[email protected]>
Signed-off-by: Zishan Ahmad <[email protected]>
@Spiral-Memory
Copy link
Author

/assign

@AryanNanda17
Copy link
Contributor

@Spiral-Memory, have you tested out the changes?

@AryanNanda17
Copy link
Contributor

Can you please share screenshot of output?

@Spiral-Memory
Copy link
Author

Hi @AryanNanda17, Yes, I've tested the changes when I made this change. I've attached a video in the PR description; please have a look at that. Thanks.

@AryanNanda17
Copy link
Contributor

Can you please run it for 2 epochs and then share?

You are now ready to run the FedAvg example. Ianvs is launched via its main entry point, taking the `benchmarkingjob.yaml` as input. From the project root, run:

```bash
ianvs -f ./examples/cifar100/federated_learning/fedavg/benchmarkingjob.yaml
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please give sample output here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/bug Categorizes issue or PR as related to a bug. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. kind/documentation Categorizes issue or PR as related to documentation. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pre-Test: federated_learning/fedavg Example for KubeEdge Ianvs (LFX 2025 T3)

3 participants