Skip to content

Commit

Permalink
Update simulation examples to use flwr_datasets (#2381)
Browse files Browse the repository at this point in the history
Co-authored-by: Adam Narozniak <[email protected]>
  • Loading branch information
jafermarq and adam-narozniak authored Dec 7, 2023
1 parent 229341b commit 7d18323
Show file tree
Hide file tree
Showing 12 changed files with 259 additions and 478 deletions.
2 changes: 2 additions & 0 deletions doc/source/ref-changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Unreleased

- **General updates to Flower Examples** ([#2381](https://github.com/adap/flower/pull/2381))

- **Update Flower Baselines**

- HFedXGBoost [#2226](https://github.com/adap/flower/pull/2226)
Expand Down
6 changes: 3 additions & 3 deletions examples/simulation-pytorch/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Flower Simulation example using PyTorch

This introductory example uses the simulation capabilities of Flower to simulate a large number of clients on either a single machine or a cluster of machines. Take a look at the [Documentation](https://flower.dev/docs/framework/how-to-run-simulations.html) for a deep dive on how Flower simulation works.
This introductory example uses the simulation capabilities of Flower to simulate a large number of clients on a single machine. Take a look at the [Documentation](https://flower.dev/docs/framework/how-to-run-simulations.html) for a deep dive into how Flower simulation works. This example uses [Flower Datasets](https://flower.dev/docs/datasets/) to download, partition and preprocess the MNIST dataset. This examples uses 100 clients by default.

## Running the example (via Jupyter Notebook)

Expand Down Expand Up @@ -41,7 +41,7 @@ poetry shell
Poetry will install all your dependencies in a newly created virtual environment. To verify that everything works correctly you can run the following command:

```shell
poetry run python3 -c "import flwr"
poetry run python -c "import flwr"
```

If you don't see any errors you're good to go!
Expand All @@ -58,7 +58,7 @@ pip install -r requirements.txt

```bash
# You can run the example without activating your environemnt
poetry run python3 sim.py
poetry run python sim.py

# Or by first activating it
poetry shell
Expand Down
9 changes: 7 additions & 2 deletions examples/simulation-pytorch/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,10 @@ authors = ["The Flower Authors <[email protected]>"]
[tool.poetry.dependencies]
python = ">=3.8,<3.11"
flwr = { extras = ["simulation"], version = ">=1.0,<2.0" }
torch = "1.13.1"
torchvision = "0.14.1"
flwr-datasets = { extras = ["vision"], version = ">=0.0.2,<1.0.0" }
torch = "2.1.1"
torchvision = "0.16.1"

[tool.poetry.group.dev.dependencies]
ipykernel = "^6.27.0"

5 changes: 3 additions & 2 deletions examples/simulation-pytorch/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
flwr[simulation]>=1.0, <2.0
torch==1.13.1
torchvision==0.14.1
torch==2.1.1
torchvision==0.16.1
flwr-datasets[vision]>=0.0.2, <1.0.0
Loading

0 comments on commit 7d18323

Please sign in to comment.