flwr-nightly 1.11.0.dev20240823__py3-none-any.whl → 1.12.0.dev20240906__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of flwr-nightly might be problematic. Click here for more details.

Files changed (48) hide show
  1. flwr/cli/app.py +0 -2
  2. flwr/cli/new/new.py +24 -10
  3. flwr/cli/new/templates/app/LICENSE.tpl +202 -0
  4. flwr/cli/new/templates/app/README.baseline.md.tpl +127 -0
  5. flwr/cli/new/templates/app/README.flowertune.md.tpl +16 -6
  6. flwr/cli/new/templates/app/code/__init__.baseline.py.tpl +1 -0
  7. flwr/cli/new/templates/app/code/client.baseline.py.tpl +58 -0
  8. flwr/cli/new/templates/app/code/dataset.baseline.py.tpl +36 -0
  9. flwr/cli/new/templates/app/code/flwr_tune/{client.py.tpl → client_app.py.tpl} +50 -40
  10. flwr/cli/new/templates/app/code/flwr_tune/dataset.py.tpl +32 -2
  11. flwr/cli/new/templates/app/code/flwr_tune/models.py.tpl +0 -3
  12. flwr/cli/new/templates/app/code/flwr_tune/server_app.py.tpl +95 -0
  13. flwr/cli/new/templates/app/code/flwr_tune/strategy.py.tpl +83 -0
  14. flwr/cli/new/templates/app/code/model.baseline.py.tpl +80 -0
  15. flwr/cli/new/templates/app/code/server.baseline.py.tpl +46 -0
  16. flwr/cli/new/templates/app/code/strategy.baseline.py.tpl +1 -0
  17. flwr/cli/new/templates/app/code/utils.baseline.py.tpl +1 -0
  18. flwr/cli/new/templates/app/pyproject.baseline.toml.tpl +138 -0
  19. flwr/cli/new/templates/app/pyproject.flowertune.toml.tpl +34 -7
  20. flwr/cli/run/run.py +2 -2
  21. flwr/client/__init__.py +0 -4
  22. flwr/client/grpc_rere_client/client_interceptor.py +13 -4
  23. flwr/client/supernode/app.py +3 -1
  24. flwr/common/config.py +14 -11
  25. flwr/common/telemetry.py +36 -30
  26. flwr/server/__init__.py +0 -4
  27. flwr/server/app.py +13 -13
  28. flwr/server/compat/app.py +0 -5
  29. flwr/server/driver/grpc_driver.py +1 -3
  30. flwr/server/run_serverapp.py +15 -1
  31. flwr/server/superlink/fleet/grpc_rere/fleet_servicer.py +19 -8
  32. flwr/server/superlink/fleet/grpc_rere/server_interceptor.py +11 -11
  33. flwr/server/superlink/state/in_memory_state.py +15 -15
  34. flwr/server/superlink/state/sqlite_state.py +10 -10
  35. flwr/server/superlink/state/state.py +8 -8
  36. flwr/simulation/run_simulation.py +23 -6
  37. flwr/superexec/__init__.py +0 -6
  38. flwr/superexec/app.py +3 -1
  39. {flwr_nightly-1.11.0.dev20240823.dist-info → flwr_nightly-1.12.0.dev20240906.dist-info}/METADATA +3 -3
  40. {flwr_nightly-1.11.0.dev20240823.dist-info → flwr_nightly-1.12.0.dev20240906.dist-info}/RECORD +43 -35
  41. flwr_nightly-1.12.0.dev20240906.dist-info/entry_points.txt +10 -0
  42. flwr/cli/new/templates/app/code/flwr_tune/app.py.tpl +0 -89
  43. flwr/cli/new/templates/app/code/flwr_tune/config.yaml.tpl +0 -34
  44. flwr/cli/new/templates/app/code/flwr_tune/server.py.tpl +0 -48
  45. flwr/cli/new/templates/app/code/flwr_tune/static_config.yaml.tpl +0 -11
  46. flwr_nightly-1.11.0.dev20240823.dist-info/entry_points.txt +0 -10
  47. {flwr_nightly-1.11.0.dev20240823.dist-info → flwr_nightly-1.12.0.dev20240906.dist-info}/LICENSE +0 -0
  48. {flwr_nightly-1.11.0.dev20240823.dist-info → flwr_nightly-1.12.0.dev20240906.dist-info}/WHEEL +0 -0
@@ -1,48 +0,0 @@
1
- """$project_name: A Flower / FlowerTune app."""
2
-
3
- from $import_name.client_app import set_parameters
4
- from $import_name.models import get_model
5
-
6
-
7
- # Get function that will be executed by the strategy's evaluate() method
8
- # Here we use it to save global model checkpoints
9
- def get_evaluate_fn(model_cfg, save_every_round, total_round, save_path):
10
- """Return an evaluation function for saving global model."""
11
-
12
- def evaluate(server_round: int, parameters, config):
13
- # Save model
14
- if server_round != 0 and (
15
- server_round == total_round or server_round % save_every_round == 0
16
- ):
17
- # Init model
18
- model = get_model(model_cfg)
19
- set_parameters(model, parameters)
20
-
21
- model.save_pretrained(f"{save_path}/peft_{server_round}")
22
-
23
- return 0.0, {}
24
-
25
- return evaluate
26
-
27
-
28
- def get_on_fit_config():
29
- """
30
- Return a function that will be used to construct the config
31
- that the client's fit() method will receive.
32
- """
33
-
34
- def fit_config_fn(server_round: int):
35
- fit_config = {"current_round": server_round}
36
- return fit_config
37
-
38
- return fit_config_fn
39
-
40
-
41
- def fit_weighted_average(metrics):
42
- """Aggregate (federated) evaluation metrics."""
43
- # Multiply accuracy of each client by number of examples used
44
- losses = [num_examples * m["train_loss"] for num_examples, m in metrics]
45
- examples = [num_examples for num_examples, _ in metrics]
46
-
47
- # Aggregate and return custom metric (weighted average)
48
- return {"train_loss": sum(losses) / sum(examples)}
@@ -1,11 +0,0 @@
1
- # Federated Instruction Tuning (static)
2
- ---
3
- dataset:
4
- name: $dataset_name
5
-
6
- # FL experimental settings
7
- num_clients: $num_clients # total number of clients
8
- num_rounds: 200
9
- partitioner:
10
- _target_: flwr_datasets.partitioner.IidPartitioner
11
- num_partitions: $num_clients
@@ -1,10 +0,0 @@
1
- [console_scripts]
2
- flower-client-app=flwr.client:run_client_app
3
- flower-server-app=flwr.server:run_server_app
4
- flower-simulation=flwr.simulation.run_simulation:run_simulation_from_cli
5
- flower-superexec=flwr.superexec:run_superexec
6
- flower-superlink=flwr.server:run_superlink
7
- flower-supernode=flwr.client:run_supernode
8
- flwr=flwr.cli.app:app
9
- flwr-clientapp=flwr.client.clientapp:flwr_clientapp
10
-