-
Notifications
You must be signed in to change notification settings - Fork 228
Convert job_template to recipe for GNN example #3891
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
base: main
Are you sure you want to change the base?
Conversation
Greptile SummaryConverted GNN example from job_template to recipe-based approach using Key improvements:
The changes maintain backward compatibility in functionality while modernizing the implementation approach. Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant job.py
participant FedAvgRecipe
participant SimEnv/ProdEnv
participant Server
participant Client1
participant Client2
User->>job.py: Run with --task_type (protein/finance)
job.py->>FedAvgRecipe: create_protein_job() or create_finance_job()
FedAvgRecipe->>FedAvgRecipe: Configure initial_model, train_script, train_args
FedAvgRecipe->>FedAvgRecipe: Add IntimeModelSelector to server
FedAvgRecipe-->>job.py: Return configured recipe
job.py->>job.py: Export job to job_dir
job.py->>SimEnv/ProdEnv: Create environment with client names
job.py->>FedAvgRecipe: Execute recipe with environment
loop For each round (num_rounds)
Server->>Client1: Send global model (flare.receive)
Server->>Client2: Send global model (flare.receive)
Client1->>Client1: Load model, train for epochs_per_round
Client2->>Client2: Load model, train for epochs_per_round
Client1->>Client1: Evaluate on global model
Client2->>Client2: Evaluate on global model
Client1->>Server: Send updated weights + metrics (flare.send)
Client2->>Server: Send updated weights + metrics (flare.send)
Server->>Server: Aggregate using FedAvg
Server->>Server: Model selection based on validation metric
end
FedAvgRecipe-->>job.py: Return run result
job.py-->>User: Display job status and result
|
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.
9 files reviewed, no comments
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 converts the GNN example from using traditional NVFlare job templates to a modern recipe-based approach using FedAvgRecipe. The conversion provides a cleaner, more programmatic API for creating federated GNN training jobs for two tasks: protein classification (PPI dataset) and financial transaction classification (Elliptic++ dataset).
Key Changes
- Introduced recipe-based job creation using
FedAvgRecipewith task-specific functions (create_protein_job()andcreate_finance_job()) - Added new utility files for data processing and local training baselines
- Updated documentation and notebook to reflect the new recipe-based workflow
Reviewed changes
Copilot reviewed 5 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
utils/process_elliptic.py |
New data preprocessing utility for Elliptic++ dataset |
utils/graphsage_protein_local.py |
New local training script for protein classification baseline |
utils/graphsage_finance_local.py |
Updated imports to use new model location |
model.py |
New SAGE model definition for finance task |
job.py |
New recipe-based job creation with task-specific functions |
client_protein.py |
New FL client implementation for protein classification |
client_finance.py |
Updated imports to use new utilities location |
README.md |
Updated documentation to explain recipe-based approach |
gnn_examples.ipynb |
Updated notebook with recipe-based workflow instructions |
Comments suppressed due to low confidence (2)
examples/advanced/gnn/utils/graphsage_finance_local.py:24
- The import uses a typo: "process_ellipitc" should be "process_elliptic" (missing 'p' in "elliptic"). This needs to match the corrected function name in process_elliptic.py.
examples/advanced/gnn/client_finance.py:27 - The import uses a typo: "process_ellipitc" should be "process_elliptic" (missing 'p' in "elliptic"). This needs to match the corrected function name in process_elliptic.py.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
9 files reviewed, no comments
|
@YuanTingHsieh Ziyue is not coming back to fix until next year. You can take over to fix them if you are free |
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.
Additional Comments (2)
-
examples/advanced/gnn/client_finance.py, line 96-103 (link)logic:
ifon line 98 should beelifto avoid overwritingtrain_data_subwhenclient_id == 1Currently when
client_id == 1, line 97 setstrain_data_sub, but then line 98'sifcondition also evaluates to true and overwrites it again. -
examples/advanced/gnn/utils/graphsage_finance_local.py, line 97-104 (link)logic:
ifon line 99 should beelifto avoid overwritingtrain_data_subwhenclient_id == 1
9 files reviewed, 2 comments
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.
Additional Comments (2)
-
examples/advanced/gnn/client_finance.py, line 96-103 (link)style: Missing
elifcausesclient_id == 0branch to fall through. Whenclient_idis 0, the code setstrain_data_sub = train_dataon line 97, but then line 98'sif args.client_id == 1is evaluated (notelif), and finally line 101'selifis checked. This works but is inconsistent. -
examples/advanced/gnn/utils/graphsage_finance_local.py, line 97-104 (link)style: Missing
elifcausesclient_id == 0branch to fall through. Whenclient_idis 0, the code setstrain_data_sub = train_dataon line 98, but then line 99'sif args.client_id == 1is evaluated (notelif), and finally line 102'selifis checked. This works but is inconsistent.
9 files reviewed, 2 comments
Greptile's behavior is changing!From now on, if a review finishes with no comments, we will not post an additional "statistics" comment to confirm that our review found nothing to comment on. However, you can confirm that we reviewed your changes in the status check section. This feature can be toggled off in your Code Review Settings by deselecting "Create a status check for each PR". |
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.
Additional Comments (1)
-
examples/advanced/gnn/client_finance.py, line 136-151 (link)logic:
evaluatefunction is defined inside the epoch loop (line 123), causing it to be redefined every epoch. Move the function definition outside the loop
9 files reviewed, 1 comment
|
/build |
Fixes # .
Description
GNN exmaple with job template convert to recipe using FedAvgRecipe
Types of changes
./runtest.sh.