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

Add FedAvgM baseline #2246

Merged
merged 138 commits into from Dec 28, 2023
Merged

Add FedAvgM baseline #2246

merged 138 commits into from Dec 28, 2023

Conversation

gubertoli
Copy link
Contributor

@gubertoli gubertoli commented Aug 23, 2023

Issue

Description

Related issues/PRs

Implements #2052

Proposal

Explanation

Checklist

  • Implement proposed change
  • Write tests
  • Update documentation
  • Update changelog
  • Make CI checks pass
  • Ping maintainers on Slack (channel #contributions)

Any other comments?

Copy link
Contributor

@jafermarq jafermarq left a comment

Choose a reason for hiding this comment

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

Hi @gubertoli, just a couple of small comments.

baselines/fedavgm/README.md Outdated Show resolved Hide resolved
baselines/fedavgm/README.md Outdated Show resolved Hide resolved
baselines/fedavgm/README.md Outdated Show resolved Hide resolved
baselines/fedavgm/README.md Outdated Show resolved Hide resolved
baselines/fedavgm/pyproject.toml Outdated Show resolved Hide resolved
gubertoli and others added 9 commits October 8, 2023 10:08
Co-authored-by: Javier <jafermarq@users.noreply.github.com>
Co-authored-by: Javier <jafermarq@users.noreply.github.com>
Error from test-baseline:

fedavgm/strategy.py:46: error: Incompatible default for argument "initial_parameters" (default has type "None", argument has type "Parameters")  [assignment]
@gubertoli
Copy link
Contributor Author

@jafermarq as a final touch, I am running the test-baseline.sh for FedAvgM and getting the following errors:

fedavgm/strategy.py:143: error: Argument 1 to "parameters_to_ndarrays" has incompatible type "Parameters | None"; expected "Parameters"  [arg-type]
fedavgm/strategy.py:172: error: Argument 1 to "parameters_to_ndarrays" has incompatible type "Parameters | None"; expected "Parameters"  [arg-type]

However, I inspected the strategy.py, and the definition for parameters_to_ndarrays in CustomFedAvgM is set to initial_parameters: Parameters (this custom strategy inherits from FedAvg, that uses parameters_to_ndarrays as Parameters | None").

Inspecting the code with VSCode shows this correct definition (non optional) - but different from mypy output:

Screenshot from 2023-11-21 10-55-46

The simulation is running, I am not sure about this mypy errors, have you ever faced similar issues?

Copy link
Contributor

@jafermarq jafermarq left a comment

Choose a reason for hiding this comment

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

Hi @gubertoli,

Find below the reason why you get that mypy error. Once fixed you'll see a few pylint errors, they are easy to fix but let me know if you need some help.

baselines/fedavgm/fedavgm/strategy.py Outdated Show resolved Hide resolved
baselines/fedavgm/fedavgm/strategy.py Show resolved Hide resolved
@gubertoli
Copy link
Contributor Author

Hi @gubertoli,

Find below the reason why you get that mypy error. Once fixed you'll see a few pylint errors, they are easy to fix but let me know if you need some help.

@jafermarq as you said, there are still a few pylint errors:

- pylint: start
************* Module fedavgm.main
fedavgm/main.py:23:0: R0914: Too many local variables (23/15) (too-many-locals)
************* Module fedavgm.client
fedavgm/client.py:13:4: R0913: Too many arguments (7/5) (too-many-arguments)
************* Module fedavgm.utils
fedavgm/utils.py:14:0: R0914: Too many local variables (26/15) (too-many-locals)
************* Module fedavgm.models
fedavgm/models.py:7:0: E0401: Unable to import 'tensorflow.nn' (import-error)
************* Module fedavgm.server
fedavgm/server.py:13:22: W0613: Unused argument 'server_round' (unused-argument)
fedavgm/server.py:31:51: W0613: Unused argument 'config' (unused-argument)

------------------------------------------------------------------
Your code has been rated at 9.73/10 (previous run: 9.67/10, +0.05)

Is it expected to clear all of them? Because some would required a deeper review (too-many-locals / too-many-arguments), the import-error is not the case during tests, and for the unused-argument I think would be good for them to be present in the server.py part for future customization.

@jafermarq
Copy link
Contributor

too-many-locals

Those are fine to be ingored. But you need to tell pylint to do so. You can use this syntax on the line (or above) the one with the error:

# pylint: disable=too-many-locals

etc for the other errors

@gubertoli
Copy link
Contributor Author

too-many-locals

Those are fine to be ingored. But you need to tell pylint to do so. You can use this syntax on the line (or above) the one with the error:

# pylint: disable=too-many-locals

etc for the other errors

@jafermarq, thank you once again 👍
Now addressed the previous pending pylint findings.

@jafermarq jafermarq changed the title FedAvgM Baseline Add FedAvgM baseline Dec 28, 2023
Copy link
Contributor

@jafermarq jafermarq left a comment

Choose a reason for hiding this comment

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

Hey @gubertoli, FedAvgM looks ready. Thanks for taking part in the Flower Summer of Reproducibility!!

@jafermarq jafermarq merged commit 1a04718 into adap:main Dec 28, 2023
27 checks passed
@gubertoli gubertoli deleted the fedavgm-baseline branch December 30, 2023 01:21
mohammadnaseri added a commit that referenced this pull request Jan 9, 2024
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
summer-of-reproducibility About a baseline for Summer of Reproducibility
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants