Skip to content

Save trained FedCA checkpoint and add standalone test.py - #2

Open
hongleizhang wants to merge 3 commits into
mainfrom
codex/fedca
Open

Save trained FedCA checkpoint and add standalone test.py#2
hongleizhang wants to merge 3 commits into
mainfrom
codex/fedca

Conversation

@hongleizhang

Copy link
Copy Markdown
Owner

Motivation

  • Persist the full personalized federated state after training so evaluations and downstream use can reload exact model and client parameters.
  • Provide a standalone evaluation entry point that can load a saved checkpoint and compute test metrics without retraining.
  • Document checkpoint/save-and-evaluate workflow for reproducible experiments.

Description

  • Added Engine.saveCheckpoint and Engine.loadCheckpoint to model/engine.py to save and restore config, model_state_dict, client_model_params, server_model_param, and agg_participant_index_map.
  • Added a --model_path argument to train.py and call engine.saveCheckpoint(config['model_path']) after training to write the checkpoint file (default checkpoints/fedca.pt).
  • Added a new standalone test.py which loads the checkpoint, restores engine state, rebuilds dataset splits with SampleGenerator, and runs engine.federatedEvaluate to report HR and NDCG (supports --use_cuda, --device_id, and --top_k).
  • Updated README.md with examples for saving a checkpoint and running the independent evaluator (python train.py --model_path=... and python test.py --model_path=...).

Testing

  • Ran git diff --check, which passed without issues.
  • Byte-compiled train.py, test.py, and model/engine.py with python -m py_compile, which succeeded.
  • Tried python test.py --help in this environment but it failed to import torch (ModuleNotFoundError: No module named 'torch'), so end-to-end loading/evaluation was not executed here.
  • Changes were committed and the working tree is clean after the commit.

Codex Task

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant