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
HeteroFL baseline #2439
HeteroFL baseline #2439
Conversation
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.
Hi @msck72,
I have completed a first review of your baseline. There are a few code suggestions, mostly minor, but that would make your code a bit better and more similar to the other baselines. In summary my changes:
- Update
pyproject.toml
to the latest version of flower and python, and also install pytorch/torchvision. - Because
poetry install
builds aheterofl
python package, it is preferable if you execute your code like thispython -m heterofl.main <options>
after activating your environment viapoetry shell
. In order for this to work, you'll need to adjust the imports in your python files (so they follow the structure:import heterofl.<your_file> ...
)
After making the changes, i was able to run your code with python -m heterofl.main
but then I encountered a bug when the strategy evaluates the initial parameters.
[2023-10-02 15:40:25,663][flwr][INFO] - Evaluating initial parameters
start of testing
end of stat, time taken = 91.22248697280884
ERROR flwr 2023-10-02 15:41:57,147 | app.py:295 | tensors used as indices must be long, byte or bool tensors
[2023-10-02 15:41:57,147][flwr][ERROR] - tensors used as indices must be long, byte or bool tensors
ERROR flwr 2023-10-02 15:41:57,147 | app.py:296 | Traceback (most recent call last):
File "/home/javier/.cache/pypoetry/virtualenvs/heterofl-n4YayD5Q-py3.10/lib/python3.10/site-packages/flwr/simulation/app.py", line 290, in start_simulation
hist = run_fl(
File "/home/javier/.cache/pypoetry/virtualenvs/heterofl-n4YayD5Q-py3.10/lib/python3.10/site-packages/flwr/server/app.py", line 224, in run_fl
hist = server.fit(num_rounds=config.num_rounds, timeout=config.round_timeout)
File "/home/javier/.cache/pypoetry/virtualenvs/heterofl-n4YayD5Q-py3.10/lib/python3.10/site-packages/flwr/server/server.py", line 92, in fit
res = self.strategy.evaluate(0, parameters=self.parameters)
File "/home/javier/projects/sor/heterofl/baselines/heterofl/heterofl/strategy.py", line 369, in evaluate
eval_res = self.evaluate_fn(server_round, parameters_ndarrays, {})
File "/home/javier/projects/sor/heterofl/baselines/heterofl/heterofl/server.py", line 78, in evaluate
client_test_res = test(
File "/home/javier/projects/sor/heterofl/baselines/heterofl/heterofl/models.py", line 501, in test
output = model(input_dict)
File "/home/javier/.cache/pypoetry/virtualenvs/heterofl-n4YayD5Q-py3.10/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1194, in _call_impl
return forward_call(*input, **kwargs)
File "/home/javier/projects/sor/heterofl/baselines/heterofl/heterofl/models.py", line 337, in forward
label_mask[input_dict["label_split"]] = 1
IndexError: tensors used as indices must be long, byte or bool tensors
Please ping me when you have a chance to make the suggested changes (and mark them as resolved when you do). If something is not clear, happy to discuss further -- or ping me on Slack.
Co-authored-by: Javier <jafermarq@users.noreply.github.com>
Co-authored-by: Javier <jafermarq@users.noreply.github.com>
Co-authored-by: Javier <jafermarq@users.noreply.github.com>
Co-authored-by: Javier <jafermarq@users.noreply.github.com>
Co-authored-by: Javier <jafermarq@users.noreply.github.com>
Co-authored-by: Javier <jafermarq@users.noreply.github.com>
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.
Hi @msck72, Great job implementing HeteroFL
!
Fix the static method error --------- Co-authored-by: Daniel J. Beutel <daniel@flower.dev> Co-authored-by: Robert Steiner <robert@flower.dev> Update types-requests requirement from ==2.31.0.2 to ==2.31.0.10 (#2739) Updates the requirements on [types-requests](https://github.com/python/typeshed) to permit the latest version. - [Commits](https://github.com/python/typeshed/commits) --- updated-dependencies: - dependency-name: types-requests dependency-type: direct:development ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Taner Topal <taner@flower.dev> Make the optional arg "--callable" in `flower-client` a required positional arg. (#2673) Co-authored-by: Javier <jafermarq@users.noreply.github.com> Update jupyterlab requirement from ==4.0.8 to ==4.0.9 (#2740) Updates the requirements on [jupyterlab](https://github.com/jupyterlab/jupyterlab) to permit the latest version. - [Release notes](https://github.com/jupyterlab/jupyterlab/releases) - [Changelog](https://github.com/jupyterlab/jupyterlab/blob/@jupyterlab/lsp@4.0.9/CHANGELOG.md) - [Commits](https://github.com/jupyterlab/jupyterlab/compare/@jupyterlab/lsp@4.0.8...@jupyterlab/lsp@4.0.9) --- updated-dependencies: - dependency-name: jupyterlab dependency-type: direct:development ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Taner Topal <taner@flower.dev> HeteroFL baseline (#2439) Co-authored-by: jafermarq <javier@flower.dev> Retire `MXNet` examples (#2724) Co-authored-by: Taner Topal <taner@flower.dev> Rename draft release workflow and create release (#2658) Update Android manifest to include internet permission (#2672) Bump lewagon/wait-on-check-action from 1.3.1 to 1.3.3 (#2756) Bumps [lewagon/wait-on-check-action](https://github.com/lewagon/wait-on-check-action) from 1.3.1 to 1.3.3. - [Release notes](https://github.com/lewagon/wait-on-check-action/releases) - [Commits](lewagon/wait-on-check-action@v1.3.1...v1.3.3) --- updated-dependencies: - dependency-name: lewagon/wait-on-check-action dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Update ruff requirement from ==0.1.4 to ==0.1.9 (#2753) Updates the requirements on [ruff](https://github.com/astral-sh/ruff) to permit the latest version. - [Release notes](https://github.com/astral-sh/ruff/releases) - [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md) - [Commits](astral-sh/ruff@v0.1.4...v0.1.9) --- updated-dependencies: - dependency-name: ruff dependency-type: direct:development ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Daniel J. Beutel <daniel@flower.dev> Add FedAvgM baseline (#2246) Co-authored-by: Daniel J. Beutel <daniel@adap.com> Co-authored-by: jafermarq <javier@flower.dev> Add dockerfile for flower client image (#2746) Add docker client image ci (#2747) Rename `workload_id` to `run_id` (#2769) Update README.md (#2771) Format code examples (#2767) Rename WorkloadState to RunState (#2770) Add in-place FedAvg (#2293) Update the error message when simulation crashes (#2759) Add tests Add tests Fix tests Fix tests
Issue
Description
Implementation of HeteroFL baseline in flower
Related issues/PRs
Proposal
Explanation
Checklist
#contributions
)Any other comments?