### Clone a Flower quickstart example Source: https://github.com/flwrlabs/flower/blob/main/framework/docs/source/docker/run-quickstart-examples-docker-compose.rst Downloads the specified quickstart example repository and prepares the directory for deployment. ```bash $ git clone --depth=1 https://github.com/flwrlabs/flower.git \ && mv flower/examples/quickstart-pytorch . \ && rm -rf flower && cd quickstart-pytorch ``` -------------------------------- ### Install Flower and Quickstart Project Source: https://github.com/flwrlabs/flower/blob/main/framework/docs/source/tutorial-series-customize-the-client-pytorch.rst Installs the Flower package and sets up a new PyTorch quickstart project. This is a prerequisite for running the tutorial examples. ```shell pip install -U "flwr[simulation]" ``` ```shell flwr new @flwrlabs/quickstart-pytorch ``` ```shell cd quickstart-pytorch pip install -e . ``` -------------------------------- ### Install and Run Locally Source: https://github.com/flwrlabs/flower/blob/main/intelligence/ts/examples/nextjs-web-chats/README.md Commands to install dependencies and start the development server. ```bash npm install npm run dev ``` -------------------------------- ### Install Flower and Initialize Project Source: https://github.com/flwrlabs/flower/blob/main/framework/docs/source/tutorial-quickstart-pytorch.rst Install the necessary Flower simulation dependencies and generate a new project structure using the quickstart template. ```shell # In a new Python environment $ pip install flwr[simulation] ``` ```shell $ flwr new @flwrlabs/quickstart-pytorch ``` -------------------------------- ### Run Quickstart Example Source: https://github.com/flwrlabs/flower/blob/main/framework/docs/source/docker/tutorial-quickstart-docker-compose.rst Executes the quickstart Flower application, connecting to the configured local SuperLink. The --stream flag is used to monitor the progress and output. ```bash $ flwr run quickstart-pytorch local-deployment --stream ``` -------------------------------- ### Install Project and Dependencies Source: https://github.com/flwrlabs/flower/blob/main/framework/docs/source/tutorial-quickstart-pytorch-lightning.rst Navigate to the cloned example directory and install the project along with its dependencies using pip. Ensure your virtual environment is activated before running this command. ```shell # Navigate to the example directory $ cd path/to/quickstart-pytorch-lightning # Install project and dependencies $ pip install -e . ``` -------------------------------- ### Clone and Run Hello World Example Source: https://github.com/flwrlabs/flower/blob/main/intelligence/ts/README.md Steps to clone the Flower repository, set up the hello-world-ts example project, install dependencies, build, and run it. ```sh git clone --depth=1 https://github.com/flwrlabs/flower.git _tmp && \ mv _tmp/intelligence/ts/examples/hello-world-ts . && \ rm -rf _tmp && \ cd hello-world-ts npm i npm run build npm run start ``` -------------------------------- ### Deploy Services with State and TLS Source: https://github.com/flwrlabs/flower/blob/main/framework/docs/source/docker/tutorial-quickstart-docker-compose.rst Commands to start the full deployment stack and run the quickstart project. ```bash $ docker compose -f compose.yml -f with-tls.yml -f with-state.yml up --build -d ``` ```bash $ flwr run quickstart-pytorch local-deployment-tls --stream ``` -------------------------------- ### Setup Python Environment Source: https://github.com/flwrlabs/flower/blob/main/baselines/floco/README.md Commands to create and activate a virtual environment and install project dependencies. ```bash # Create a python env pyenv virtualenv 3.10.14 floco # Activate it pyenv activate floco # Install project including packages pip install . ``` -------------------------------- ### Install System Prerequisites (macOS, RHEL, Debian) Source: https://github.com/flwrlabs/flower/blob/main/examples/fedrag/README.md Installs necessary packages like wget and git-lfs for downloading files and large repositories. Ensure these are installed before proceeding with the example. ```shell # wget is used to download .tar files from the Web # git-lfs is used to download large files from the Hugging Face respository # macOS brew install wget brew install git-lfs # RHEL yum install wget yum install git-lfs # Ubuntu/Debian apt install wget apt install git-lfs # Windows # If you are on Windows, it is highly recommended to make use of WSL with Ubuntu to run your Flower apps. # Then, you can install the packages using the above Ubuntu commands. # Extra tip: with WSL you can also make use of the NVIDIA GPU in your Windows host. # enable Git LFS in your Git environment # (holds for all systems) git lfs install ``` -------------------------------- ### Run Development Server Source: https://github.com/flwrlabs/flower/blob/main/intelligence/ts/examples/web-chat/README.md Start the development server for the web chat example. This command will typically output a URL to access the application in your browser. ```bash npm run dev ``` -------------------------------- ### Install FjORD via pip Source: https://github.com/flwrlabs/flower/blob/main/baselines/fjord/README.md Standard installation method using pip and the provided setup script. ```bash pip install -r requirements.txt python setup.py install ``` -------------------------------- ### Clone Example Project Source: https://github.com/flwrlabs/flower/blob/main/intelligence/ts/examples/streaming/README.md Download the example project from GitHub. This command clones the repository, extracts the streaming example, and navigates into the example directory. ```bash git clone --depth=1 https://github.com/flwrlabs/flower.git _tmp && mv _tmp/intelligence/ts/examples/streaming . && rm -rf _tmp && cd streaming ``` -------------------------------- ### Flower Docker Setup Guide Source: https://github.com/flwrlabs/flower/blob/main/framework/docs/source/ref-changelog.md This section outlines the steps to set up and run Flower components using Docker. It covers Docker images for Flower SuperLink, SuperNode, and ServerApp. ```bash # Example Docker command (conceptual, actual commands may vary) docker run -p 8080:8080 flwr/serverapp ``` -------------------------------- ### Install Flower and Initialize Project Source: https://github.com/flwrlabs/flower/blob/main/examples/quickstart-numpy/README.md Commands to install the Flower framework and scaffold a new project. ```shell pip install flwr ``` ```shell flwr new @flwrlabs/quickstart-numpy ``` -------------------------------- ### Install Google Cloud SDK (Windows) Source: https://github.com/flwrlabs/flower/blob/main/framework/docs/source/how-to-run-flower-on-gcp.rst Provides instructions for installing the Google Cloud SDK on Windows by downloading and running the installer. Refer to the official page for the latest installer link. ```bash # Windows # Download the Windows installer from the Google Cloud SDK page # https://dl.google.com/dl/cloudsdk/channels/rapid/GoogleCloudSDKInstaller.exe # Run the .exe installer and follow the on-screen instructions ``` -------------------------------- ### Generate a new PyTorch quickstart app Source: https://github.com/flwrlabs/flower/blob/main/framework/docs/source/how-to-run-simulations.rst Use the `flwr new` command to generate a new Flower application. This example specifically generates the PyTorch quickstart app. You can also run `flwr new` without arguments to see a list of recommended apps. ```shell flwr new @flwrlabs/quickstart-pytorch ``` -------------------------------- ### Create a new Flower App with PyTorch Quickstart Source: https://github.com/flwrlabs/flower/blob/main/framework/docs/source/how-to-run-flower-with-deployment-engine.rst Use the 'flwr new' command to create a new Flower app based on the PyTorch quickstart template. This command downloads and unpacks the template, and provides instructions for installing dependencies and running the app. ```bash $ flwr new @flwrlabs/quickstart-pytorch ❇ Requesting download link for @flwrlabs/quickstart-pytorch... ❖ Downloading ZIP into memory... ✶ Unpacking into /Users/alice/quickstart-pytorch... ✦ Flower App creation successful. To run your Flower App, first install its dependencies: cd quickstart-pytorch && pip install -e . then, run the app: flwr run . ℹ] Check the README in your app directory to learn how to customize it and how to run it using the Deployment Runtime. ``` -------------------------------- ### Clone the fastai example repository Source: https://github.com/flwrlabs/flower/blob/main/framework/docs/source/tutorial-quickstart-fastai.rst Downloads the quickstart-fastai example project from the Flower GitHub repository. ```shell git clone --depth=1 https://github.com/flwrlabs/flower.git _tmp \ && mv _tmp/examples/quickstart-fastai . \ && rm -rf _tmp && cd quickstart-fastai ``` -------------------------------- ### Fetch Flower App Template Source: https://github.com/flwrlabs/flower/blob/main/examples/quickstart-xgboost/README.md Fetch a new Flower application template for the quickstart XGBoost example. This command creates a new directory with the project structure. ```shell flwr new @flwrlabs/quickstart-xgboost ``` -------------------------------- ### Start Server (Flower 1.7) Source: https://github.com/flwrlabs/flower/blob/main/framework/docs/source/how-to-upgrade-to-flower-1.13.rst Legacy method for starting a server using start_server. ```python if __name__ == "__main__": start_server( server_address="0.0.0.0:8080", config=config, strategy=strategy, ) ``` -------------------------------- ### Example Updates with requirements.txt Source: https://github.com/flwrlabs/flower/blob/main/framework/docs/source/ref-changelog.md Various examples have been updated, including simplified advanced examples and improved macOS compatibility. All examples now include a `requirements.txt` file alongside `pyproject.toml`. ```python # Example requirements.txt content (typical structure) # package_name==version ``` -------------------------------- ### Clone Web Chat Example Source: https://github.com/flwrlabs/flower/blob/main/intelligence/ts/examples/web-chat/README.md Use this command to download the web chat example project. It clones the repository, moves the example to the current directory, cleans up temporary files, and navigates into the example's directory. ```bash git clone --depth=1 https://github.com/flwrlabs/flower.git _tmp && mv _tmp/intelligence/ts/examples/web-chat . && rm -rf _tmp && cd web-chat ``` -------------------------------- ### Install Flower pre-release Source: https://github.com/flwrlabs/flower/blob/main/framework/docs/source/how-to-install-flower.rst Installation of alpha, beta, or release candidate versions of Flower. ```bash python -m pip install -U --pre flwr ``` ```bash python -m pip install -U --pre 'flwr[simulation]' ``` -------------------------------- ### Install project dependencies Source: https://github.com/flwrlabs/flower/blob/main/framework/docs/source/tutorial-quickstart-fastai.rst Navigates to the project directory and installs the package in editable mode. ```shell # Navigate to the example directory $ cd path/to/quickstart-fastai # Install project and dependencies $ pip install -e . ``` -------------------------------- ### Install Flower Datasets with extras Source: https://github.com/flwrlabs/flower/blob/main/baselines/docs/source/how-to-install-flwr-datasets.md Install with specific extras for vision or audio dataset support. ```bash python -m pip install "flwr-datasets[vision]" ``` ```bash python -m pip install "flwr-datasets[audio]" ``` -------------------------------- ### Flower Authentication Example Source: https://github.com/flwrlabs/flower/blob/main/framework/docs/source/ref-changelog.md This example demonstrates how to get started with the new built-in client node authentication system in Flower 1.9. It requires no external authentication systems. ```python import flwr as fl # Load the Flower authentication example app = flwr.FlowerAuthenticationApp() # Run the application app.run() ``` -------------------------------- ### Add Print Statement to Get Weights Function Source: https://github.com/flwrlabs/flower/blob/main/framework/docs/source/docker/tutorial-quickstart-docker-compose.rst Modifies the get_weights function in the PyTorch quickstart example to include a print statement. This demonstrates how to update application code. ```python # ... def get_weights(net): print("Get weights") return [val.cpu().numpy() for _, val in net.state_dict().items()] # ... ``` -------------------------------- ### Wrap Client with ClientApp Source: https://github.com/flwrlabs/flower/blob/main/framework/docs/source/how-to-upgrade-to-flower-1.13.rst Example showing the transition from start_client to the ClientApp architecture. ```python from flwr.app import Context from flwr.client import start_client from flwr.clientapp import ClientApp # Flower 1.10 and later (recommended) def client_fn(context: Context): return FlowerClient().to_client() app = ClientApp(client_fn=client_fn) # # Flower 1.8 - 1.9 (deprecated, no longer supported) # def client_fn(cid: str): # return FlowerClient().to_client() # # # app = ClientApp(client_fn=client_fn) # Flower 1.7 (deprecated, only for backwards-compatibility) if __name__ == "__main__": start_client( server_address="127.0.0.1:8080", client=FlowerClient().to_client(), ) ``` -------------------------------- ### Setup development environment Source: https://github.com/flwrlabs/flower/blob/main/baselines/docs/source/contributor-how-to-develop-flwr-datasets.md Initializes the project environment using uv. ```bash cd datasets uv sync --all-extras ``` -------------------------------- ### Example Output of Version Check Source: https://github.com/flwrlabs/flower/blob/main/datasets/docs/source/how-to-install-flwr-datasets.md This is the expected output when the Flower Datasets installation is verified successfully, showing the installed version number. ```text 0.6.0 ``` -------------------------------- ### Wrap Strategy with ServerApp Source: https://github.com/flwrlabs/flower/blob/main/framework/docs/source/how-to-upgrade-to-flower-1.13.rst Example showing the transition from start_server to the ServerApp architecture. ```python from flwr.app import Context from flwr.server import ServerAppComponents, ServerConfig, start_server from flwr.server.strategy import FedAvg from flwr.serverapp import ServerApp # Flower 1.10 and later (recommended) def server_fn(context: Context): strategy = FedAvg() config = ServerConfig() return ServerAppComponents(config=config, strategy=strategy) ``` -------------------------------- ### Audit Log Examples Source: https://github.com/flwrlabs/flower/blob/main/framework/docs/source/how-to-configure-audit-logging.rst Example log outputs for various system interactions including starting runs, listing runs, and SuperNode communication. ```shell INFO : [AUDIT] {"timestamp": "2025-07-12T10:24:21Z", "actor": {"actor_id": "...", "description": "...", "ip_address": "..."}, "event": {"action": "ControlServicer.StartRun", "run_id": "...", "fab_hash": "..."}, "status": "started"} INFO : ControlServicer.StartRun INFO : [AUDIT] {"timestamp": "2025-07-12T10:24:21Z", "actor": {"actor_id": "...", "description": "...", "ip_address": "..."}, "event": {"action": "ControlServicer.StartRun", "run_id": "...", "fab_hash": "..."}, "status": "completed"} ``` ```shell INFO : [AUDIT] {"timestamp": "2025-07-12T10:26:35Z", "actor": {"actor_id": "...", "description": "...", "ip_address": "..."}, "event": {"action": "ControlServicer.ListRuns", "run_id": null, "fab_hash": null}, "status": "started"} INFO : ControlServicer.ListRuns INFO : [AUDIT] {"timestamp": "2025-07-12T10:26:35Z", "actor": {"actor_id": "...", "description": "...", "ip_address": "..."}, "event": {"action": "ControlServicer.ListRuns", "run_id": null, "fab_hash": null}, "status": "completed"} ``` ```shell INFO : [AUDIT] {"timestamp": "2025-07-14T10:27:02Z", "actor": {"actor_id": "...", "description": "SuperNode", "ip_address": "..."}, "event": {"action": "FleetServicer.PullMessages", "run_id": null, "fab_hash": null}, "status": "started"} INFO : [Fleet.PullMessages] node_id=... ``` -------------------------------- ### Clone Example Project Source: https://github.com/flwrlabs/flower/blob/main/intelligence/ts/examples/browser-extension/README.md Use this command to download the example project. Ensure you are in the correct directory after cloning. ```bash git clone --depth=1 https://github.com/flwrlabs/flower.git _tmp && mv _tmp/intelligence/ts/examples/encrypted . && rm -rf _tmp && cd encrypted ``` -------------------------------- ### Clone Example Project Source: https://github.com/flwrlabs/flower/blob/main/intelligence/ts/examples/hello-world-ts/README.md Download the example project using git clone. This command fetches the project and sets up the necessary files. ```bash git clone --depth=1 https://github.com/flwrlabs/flower.git _tmp && mv _tmp/intelligence/ts/examples/hello-world-ts . && rm -rf _tmp && cd hello-world-ts ``` -------------------------------- ### Install PyTorch SuperNode Helm Chart Source: https://github.com/flwrlabs/flower/blob/main/framework/docs/source/helm/how-to-deploy-supernode-using-helm.md Command to install the Flower SuperNode Helm chart for a PyTorch setup using a specified values.yaml file. ```sh helm install pytorch . --values values.yaml ``` -------------------------------- ### Clone the Hello World project Source: https://github.com/flwrlabs/flower/blob/main/intelligence/ts/examples/hello-world-js/README.md Downloads the specific example directory from the Flower repository. ```bash git clone --depth=1 https://github.com/flwrlabs/flower.git _tmp && mv _tmp/intelligence/ts/examples/hello-world-js . && rm -rf _tmp && cd hello-world-js ``` -------------------------------- ### Install Flower and Initialize Project Source: https://github.com/flwrlabs/flower/blob/main/examples/fl-dp-sa/README.md Commands to install the Flower framework and scaffold a new project directory. ```shell pip install flwr ``` ```shell flwr new @flwrlabs/fl-dp-sa ``` -------------------------------- ### View ServerApp Logs Source: https://github.com/flwrlabs/flower/blob/main/framework/docs/source/docker/tutorial-quickstart-docker-compose.rst Example output from the ServerApp logs showing the initialization process. ```text INFO : Starting logstream for run_id `10386255862566726253` INFO : Starting Flower ServerApp WARNING : Option `--insecure` was set. Starting insecure HTTP channel to superlink:9091. 🎊 Successfully installed quickstart-pytorch to /app/.flwr/apps/flower.quickstart-pytorch.1.0.0.35361a47. Get weights INFO : Starting Flower ServerApp, config: num_rounds=3, no round_timeout ``` -------------------------------- ### Environment Setup for FedRep Baseline Source: https://github.com/flwrlabs/flower/blob/main/baselines/fedrep/README.md Commands to create and activate a Python virtual environment and install the project dependencies. ```bash # Create the environment pyenv virtualenv 3.10.12 fedrep-env # Activate it pyenv activate fedrep-env # Then install the project pip install -e . ``` -------------------------------- ### Install Flower and Fetch Project Source: https://github.com/flwrlabs/flower/blob/main/examples/quickstart-monai/README.md Commands to install the Flower framework and initialize a new project template. ```shell pip install flwr ``` ```shell flwr new @flwrlabs/quickstart-monai ``` -------------------------------- ### Setup Python Environment with Poetry Source: https://github.com/flwrlabs/flower/blob/main/baselines/dasha/README.md Commands to configure a Python 3.10 environment and install dependencies using Poetry. ```bash # Set Python 3.10 pyenv local 3.10.6 # Tell poetry to use python 3.10 poetry env use 3.10.6 # Install the base Poetry environment # By default, Poetry installs the PyTorch package with Python 3.10 and CUDA 11.8. # If you have a different setup, then change the "torch" and "torchvision" lines in [tool.poetry.dependencies]. poetry install # Activate the environment poetry shell ``` -------------------------------- ### Install Flower and Fetch Project Source: https://github.com/flwrlabs/flower/blob/main/examples/quickstart-fastai/README.md Commands to install the Flower framework and initialize a new project template. ```shell pip install flwr ``` ```shell flwr new @flwrlabs/quickstart-fastai ``` -------------------------------- ### Run Flower Quickstart Project Source: https://github.com/flwrlabs/flower/blob/main/framework/docs/source/docker/tutorial-quickstart-docker-compose.rst Executes the quickstart-pytorch project in a local deployment environment. ```bash $ flwr run quickstart-pytorch local-deployment --stream ``` ```bash $ flwr run quickstart-pytorch local-deployment-tls --stream ``` -------------------------------- ### Clone the project repository Source: https://github.com/flwrlabs/flower/blob/main/examples/quickstart-lerobot/README.md Downloads the example project and navigates into the directory. ```shell git clone --depth=1 https://github.com/flwrlabs/flower.git _tmp \ && mv _tmp/examples/quickstart-lerobot . \ && rm -rf _tmp && cd quickstart-lerobot ``` -------------------------------- ### Compare OpenFL and Flower project structures Source: https://github.com/flwrlabs/flower/blob/main/framework/docs/source/how-to-migrate-from-openfl.rst Visual representation of the directory structure differences between a typical OpenFL example and a Flower PyTorch quickstart project. ```text openfl-example ├── requirements.txt ├── .workspace ├── plan │ ├── plan.yaml │ ├── cols.yaml │ ├── defaults │ └── data.yaml ├── logs ├── cert ├── save ├── data └── src ├── __init__.py ├── taskrunner.py ├── utils.py └── dataloader.py ``` ```text quickstart-pytorch ├── pytorchexample │ ├── __init__.py │ ├── client_app.py │ ├── server_app.py │ └── task.py ├── pyproject.toml └── README.md ``` -------------------------------- ### Environment Setup for FedNova Baseline Source: https://github.com/flwrlabs/flower/blob/main/baselines/fednova/README.md These commands guide you through setting up the Python environment for the FedNova baseline using pyenv and Poetry. Ensure you are in the correct directory before executing. ```bash # Navigate to baselines/fednova cd baselines/fednova # Set python version pyenv install 3.10.11 pyenv local 3.10.11 # Tell poetry to use python 3.10 poetry env use 3.10.11 # install the base Poetry environment, make sure there is no existing poetry.lock file and pyproject.toml file is located in the current directory poetry install # activate the environment poetry shell ``` -------------------------------- ### Initialize start_simulation with Client IDs Source: https://github.com/flwrlabs/flower/blob/main/framework/docs/source/ref-changelog.md Demonstrates initializing `start_simulation` with a list of client IDs. This allows passing custom IDs to `client_fn` for easier data partition loading. ```python start_simulation(client_fn=client_fn, num_clients=num_clients, client_ids=client_ids) ``` -------------------------------- ### Configure SuperLink Connection in Flower Config Source: https://github.com/flwrlabs/flower/blob/main/examples/whisper-federated-finetuning/README.md Define the SuperLink connection in your Flower Configuration file (e.g., `flwr config list`). This example assumes a local SuperLink and disables SSL for simplicity; consult documentation for secure setups. ```toml [superlink.remote] address = '127.0.0.1:9093' # IP:9093 of your superlink (assumed localhost superlink) insecure = true # Check the documentation to setup with SSL ``` -------------------------------- ### Example Flower configuration output Source: https://github.com/flwrlabs/flower/blob/main/examples/embedded-devices/README.md Sample output showing the location of the configuration file and existing connections. ```console # Example output: Flower Config file: /path/to/your/.flwr/config.toml SuperLink connections: supergrid local (default) ``` -------------------------------- ### Initialize Flower Server and Clients Source: https://github.com/flwrlabs/flower/blob/main/framework/docs/source/how-to-run-flower-on-azure.rst Run these commands to start the Flower long-running processes. The server (SuperLink) and clients (SuperNode) require specific configurations, including the SuperLink's public IP and port. Use the --insecure flag for initial setup. ```bash # Server VM (SuperLink) flower-superlink --insecure ``` ```bash # Client-1 VM (SuperNode-1) flower-supernode \ --insecure \ --superlink="SUPERLINK_PUBLIC_IP:9092" # SuperLink public ip and port ``` ```bash # Client-2 VM (SuperNode-2) flower-supernode \ --insecure \ --superlink="SUPERLINK_PUBLIC_IP:9092" # SuperLink public ip and port ``` -------------------------------- ### Install Flower and Initialize Project Source: https://github.com/flwrlabs/flower/blob/main/examples/fl-tabular/README.md Commands to install the Flower framework and scaffold a new tabular federated learning project. ```shell pip install flwr ``` ```shell flwr new @flwrlabs/fl-tabular ``` -------------------------------- ### Install Flower 1.0 with pip Source: https://github.com/flwrlabs/flower/blob/main/framework/docs/source/how-to-upgrade-to-flower-1.0.rst Use the -U flag with pip to upgrade an existing Flower installation to version 1.0. This applies to both core installation and installation with simulation extras. ```bash python -m pip install -U flwr ``` ```bash python -m pip install -U 'flwr[simulation]' ``` -------------------------------- ### Fetch Flower App Source: https://github.com/flwrlabs/flower/blob/main/examples/quickstart-mlx/README.md Initialize a new Flower project using the quickstart template. ```shell flwr new @flwrlabs/quickstart-mlx ``` -------------------------------- ### Initialize and execute a FedAvg strategy Source: https://github.com/flwrlabs/flower/blob/main/framework/docs/source/how-to-use-strategies.rst Demonstrates the basic instantiation of a ServerApp and the execution of the FedAvg strategy using the start method. ```python # Create ServerApp app = ServerApp() @app.main() def main(grid: Grid, context: Context) -> None: """Main entry point for the ServerApp.""" # Load global model global_model = Net() arrays = ArrayRecord(global_model.state_dict()) # Initialize FedAvg strategy with default settings strategy = FedAvg() # Start strategy, run FedAvg for `num_rounds` result = strategy.start( grid=grid, initial_arrays=arrays, ) ``` -------------------------------- ### Install pnpm Globally Source: https://github.com/flwrlabs/flower/blob/main/baselines/docs/source/contributor-how-to-build-from-source.md Use this command to install pnpm globally via npm. Ensure npm is installed and configured. ```bash npm install -g pnpm ``` -------------------------------- ### Initialize Environment Paths Source: https://github.com/flwrlabs/flower/blob/main/baselines/fedbn/docs/multirun_plot.ipynb Sets up project directory and paths for saving figures and reading results. ```python import pickle, yaml from pathlib import Path import matplotlib.pyplot as plt import numpy as np import os PROJECT_DIRECTORY = Path(os.path.abspath("")).parent SAVE_FIG_PATH = PROJECT_DIRECTORY / "_static" RESULTS_PATH = PROJECT_DIRECTORY / "results" ``` -------------------------------- ### Install Baseline Project Source: https://github.com/flwrlabs/flower/blob/main/baselines/dev/baseline/README.md Install the baseline project in the activated virtual environment using pip. This command installs the project and its dependencies. ```bash pip install -e . ``` -------------------------------- ### Initialize Poetry Environment Source: https://github.com/flwrlabs/flower/blob/main/baselines/fedmlb/README.md Install dependencies and activate the project environment. ```bash # cd to your FedMLB directory (i.e. where the `pyproject.toml` is) # install the base Poetry environment poetry install # activate the environment poetry shell ``` -------------------------------- ### Example ServerApp Console Output Source: https://github.com/flwrlabs/flower/blob/main/framework/docs/source/tutorial-series-customize-the-client-pytorch.rst Sample output showing logged training metadata from clients. ```console INFO : [ROUND 1/3] INFO : configure_train: Sampled 25 nodes (out of 1000) {'training_time': 123.45, 'converged': True, 'training_losses': {'epoch1': 0.56, 'epoch2': 0.34}} {'training_time': 130.67, 'converged': False, 'training_losses': {'epoch1': 0.60, 'epoch2': 0.40}} ... ``` -------------------------------- ### Verify installation Source: https://github.com/flwrlabs/flower/blob/main/baselines/docs/source/how-to-install-flwr-datasets.md Check the installed version of the library. ```bash python -c "import flwr_datasets;print(flwr_datasets.__version__)" ``` -------------------------------- ### Initialize a new Flower project Source: https://github.com/flwrlabs/flower/blob/main/framework/docs/source/how-to-migrate-from-openfl.rst Create a new Flower project using the PyTorch quickstart template. ```shell $ flwr new @flwrlabs/quickstart-pytorch ``` -------------------------------- ### Install Dependencies with pnpm Source: https://github.com/flwrlabs/flower/blob/main/intelligence/docs/source/contributor-how-to-build-from-source.md Navigate to the TypeScript SDK directory and install project dependencies using pnpm. Ensure you have pnpm installed and the repository cloned. ```bash cd intelligence/ts pnpm install ``` -------------------------------- ### Install Flower with REST Extra Source: https://github.com/flwrlabs/flower/blob/main/framework/docs/source/ref-exit-codes/601.rst Install the 'flwr' package with the 'rest' extra to enable the REST-based Fleet API. Ensure the installation completes successfully before retrying. ```bash pip install "flwr[rest]" ``` -------------------------------- ### Install Flower Pre-release with pip Source: https://github.com/flwrlabs/flower/blob/main/framework/docs/source/contributor-how-to-install-development-versions.rst Use this to install a pre-release version of Flower from PyPI using pip. The -U flag ensures the latest pre-release is installed. ```bash pip install -U --pre flwr ``` ```bash pip install -U --pre 'flwr[simulation]' ``` -------------------------------- ### Execute Strategy Start Method Source: https://github.com/flwrlabs/flower/blob/main/framework/docs/source/how-to-use-strategies.rst Demonstrates the minimal and customized execution of the federated learning process using the start method. ```python # Start strategy result = strategy.start( grid=grid, initial_arrays=ArrayRecord(...), ) ``` ```python # Define configs to send to ClientApp train_cfg = ConfigRecord({"lr": 0.1, "optim": "adam"}) eval_cfg = ConfigRecord({"max-steps": 500, "local-checkpoint": True}) ``` -------------------------------- ### Execute the Flower example Source: https://github.com/flwrlabs/flower/blob/main/framework/docs/source/docker/run-quickstart-examples-docker-compose.rst Runs the example using the specified SuperLink connection with streaming logs enabled. ```bash $ flwr run . local-deployment --stream ``` -------------------------------- ### Install and Verify Flower 1.28 Source: https://github.com/flwrlabs/flower/blob/main/framework/docs/source/how-to-upgrade-to-flower-1.28.rst Install the latest Flower version and verify the installation by checking the version number. Ensure you include the 'simulation' extra for full functionality. ```shell $ pip install -U "flwr[simulation]" $ flwr --version # should show 1.28.x ``` -------------------------------- ### Verify kubectl installation Source: https://github.com/flwrlabs/flower/blob/main/framework/docs/source/how-to-run-flower-on-gcp.rst Check the installed version of the kubectl client. ```bash kubectl version --client # this will show the installed versions of the Client and Kustomize ``` -------------------------------- ### Install App Dependencies Source: https://github.com/flwrlabs/flower/blob/main/hub/docs/source/how-to-use-app-from-hub.md Navigate to the downloaded app's directory and install its dependencies using pip. This prepares the app for local execution. ```bash cd pip install -e . ``` -------------------------------- ### Install Flower Datasets via pip Source: https://github.com/flwrlabs/flower/blob/main/baselines/docs/source/how-to-install-flwr-datasets.md Standard installation from PyPI. ```bash python -m pip install flwr-datasets ``` -------------------------------- ### Fetch Flower Project Source: https://github.com/flwrlabs/flower/blob/main/examples/quickstart-pennylane/README.md Initialize a new Flower project using the quickstart-pennylane template. ```shell flwr new @flwrlabs/quickstart-pennylane ``` -------------------------------- ### Clone Flower PyTorch Lightning Example Source: https://github.com/flwrlabs/flower/blob/main/framework/docs/source/tutorial-quickstart-pytorch-lightning.rst Clone the Flower PyTorch Lightning example from GitHub to your local machine. This command downloads the example code and sets up the necessary directory structure. ```shell git clone --depth=1 https://github.com/flwrlabs/flower.git _tmp \ && mv _tmp/examples/quickstart-pytorch-lightning . \ && rm -rf _tmp && cd quickstart-pytorch-lightning ``` -------------------------------- ### Fetch Flower App Source: https://github.com/flwrlabs/flower/blob/main/examples/quickstart-catboost/README.md Create a new Flower project using the quickstart template. ```shell flwr new @flwrlabs/quickstart-catboost ``` -------------------------------- ### Install Dependencies with uv Source: https://github.com/flwrlabs/flower/blob/main/framework/uv.md Installs dependencies for a Poetry environment with Python 3.10.19, including all extras and dependency groups. Use `--locked` to install from `uv.lock` and fail if the lockfile is out-of-date. ```bash uv sync --python=3.10.19 --locked --all-extras --all-groups ```