Skip to content
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

kaplan-meier-he example not working #3192

Closed
shammimore opened this issue Jan 30, 2025 · 3 comments
Closed

kaplan-meier-he example not working #3192

shammimore opened this issue Jan 30, 2025 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@shammimore
Copy link

shammimore commented Jan 30, 2025

Describe the bug
kaplan-meier-he example gives an error.
fl_model.params send to server from client is empty
fl_model.params {}

Warning message:
2025-01-30 10:25:12,710 - InProcessClientAPI - INFO - Try to send local model back to peer
2025-01-30 10:25:12,908 - PTToNumpyParamsConverter - WARNING - 2 vars excluded as they were non-tensor type: ['hist_obs', 'hist_cen']

Error message:
File "kaplan-meier-he/src/kaplan_meier_wf.py", line 51, in aggr_hist
hist = fl_model.params["hist_obs"]
~~~~~~~~~~~~~~~^^^^^^^^^^^^
KeyError: 'hist_obs'

To Reproduce
Steps to reproduce the behavior:

  1. Go to 'https://github.com/NVIDIA/NVFlare/tree/main/examples/advanced/kaplan-meier-he'
  2. Run 'python km_job.py '

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots

Desktop (please complete the following information):

  • OS: Ubuntu 24.04.1 LTS
  • Python Version [3.12.3]
  • NVFlare Version [2.5.2]

Additional context
Add any other context about the problem here.

@shammimore shammimore added the bug Something isn't working label Jan 30, 2025
@ZiyueXu77
Copy link
Collaborator

could you try install nvflare from main branch?

pip uninstall nvflare
pip install -e . 

The error seems to be caused by the exchange_format, which is specified here
https://github.com/NVIDIA/NVFlare/blob/main/examples/advanced/kaplan-meier-he/km_job.py#L66

@ZiyueXu77 ZiyueXu77 self-assigned this Jan 30, 2025
@shammimore
Copy link
Author

shammimore commented Jan 30, 2025

Thanks! It works after installing nvflare from main branch.

Note:
There was another error 'unable to import torch'. It was quickly fixed by installing torch. Maybe it's good to add that to the requirement.txt.

Error message:

File "/home/smore/nvflare_trial/NVFlare/nvflare/job_config/script_runner.py", line 314, in init
super().init(
File "/home/smore/nvflare_trial/NVFlare/nvflare/job_config/script_runner.py", line 123, in init
raise ValueError("Using FrameworkType.PYTORCH, but unable to import torch")
ValueError: Using FrameworkType.PYTORCH, but unable to import torch

@ZiyueXu77
Copy link
Collaborator

Thanks for the update! I also realized the issue and created a PR (#3194) to specify the framework, torch is not necessary in this example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants