FLIP - Federated Learning and Interoperability Platform library built on NVIDIA FLARE
Project description
FLIP-FL-base-FLARE
This repository contains the FLIP (Federated Learning and Interoperability Platform) federated learning base application utilities. It is a monorepo that includes:
flip— pip-installable Python package with platform logic, NVFLARE components, and utilitiestutorials/— example applications you can run on the FLIP platformfl_services/— Docker services for running FL networks (server, clients, admin API)
Table of Contents
flip Python Package
The flip package is the core pip-installable library for the FLIP federated learning platform. It provides
all platform logic core to training and evaluating FL applications.
Installation
uv sync
# or
pip install .
To build a distributable package:
uv build
Package Structure
flip/
├── core/ # FLIPBase, FLIPStandardProd/Dev implementations, FLIP() factory
├── constants/ # FlipConstants (pydantic-settings), enums, PTConstants
├── utils/ # General utilities: Utils, model weight helpers
└── nvflare/ # NVFLARE-specific logic and components
├── executors/ # RUN_TRAINER, RUN_VALIDATOR, RUN_EVALUATOR wrappers
├── controllers/ # Workflow controllers (ScatterAndGather, CrossSiteModelEval, …)
└── components/ # Event handlers, persistors, privacy filters, locators, …
The FLIP() factory selects FLIPStandardDev (local CSV/filesystem) or FLIPStandardProd (FLIP platform APIs) based
on the LOCAL_DEV environment variable.
User Application Requirements
User-provided files go in the job's custom/ directory and are dynamically imported by the executor wrappers:
| File | Description |
|---|---|
trainer.py |
Training logic — must export FLIP_TRAINER class |
validator.py |
Validation logic — must export FLIP_VALIDATOR class |
models.py |
Model definitions — must export get_model() function |
config.json |
Hyperparameters — must include LOCAL_ROUNDS and LEARNING_RATE |
transforms.py |
Data transforms (optional) |
Job Types
Set via the JOB_TYPE environment variable:
| Type | Description |
|---|---|
standard |
Federated training with FedAvg aggregation (default) |
evaluation |
Distributed model evaluation without training |
diffusion_model |
Two-stage training (VAE encoder + diffusion) |
fed_opt |
Custom federated optimization |
The corresponding configs live in src/<job_type>/app/config/.
Development Mode
DEV mode lets you test FL applications locally before deploying to production.
-
Edit
.env.development:LOCAL_DEV=true DEV_IMAGES_DIR=../data/accession-resources DEV_DATAFRAME=../data/sample_get_dataframe.csv JOB_TYPE=standard
-
Place your application files in
src/<JOB_TYPE>/app/custom/. -
Run the simulator in Docker:
make run-container
Unit Tests
make unit-test
# or
uv run pytest -s -vv
Tutorials
The tutorials/ directory contains ready-to-use example applications that can be uploaded to the FLIP platform UI. Each tutorial is designed to work with a specific app type from src/.
App / Tutorial Compatibility
| App | Tutorial |
|---|---|
standard |
image_segmentation/3d_spleen_segmentation |
standard |
image_classification/xray_classification |
diffusion_model |
image_synthesis/latent_diffusion_model |
fed_opt |
image_segmentation/3d_spleen_segmentation |
evaluation |
image_evaluation/3d_spleen_segmentation |
FL Services API
The fl_services/ directory contains Docker-based NVFLARE services. See the FL services README and the FL API README for full details on provisioning and the API endpoints.
Prerequisites
- Docker and Docker Compose
- uv (Python package manager)
- AWS CLI configured (for downloading test data)
Provisioning a Network
Generate the certificates, keys, and configuration for a new FL network:
make nvflare-provision NET_NUMBER=1
This creates a network-specific compose file (deploy/compose-net-1.yml) and service secrets in workspace/net-1/services/ (gitignored). Multiple networks can be provisioned with different ports:
make nvflare-provision NET_NUMBER=2 FL_PORT=8004 ADMIN_PORT=8005
Warning: Provisioned files contain cryptographic signatures. Any modification will cause errors. Always re-run provisioning if changes are needed.
Running the Network
make build NET_NUMBER=1 # Build Docker images
make up NET_NUMBER=1 # Start the network (server, 2 clients, API)
make down NET_NUMBER=1 # Stop the network
make clean NET_NUMBER=1 # Remove containers and images
Integration Testing
Download test data (requires AWS S3 access) then run the relevant target:
make download-xrays-data && make test-xrays-standard
make download-spleen-data && make test-spleen-standard
make download-checkpoints && make test-spleen-evaluation
make test-spleen-diffusion
make test # Run all integration tests
CI/CD
GitHub Actions workflows use OIDC to authenticate to AWS (no long-lived keys).
| Trigger | Target |
|---|---|
| PR to any branch | s3://flipdev/base-application-dev/pull-requests/<PR_NUMBER>/src/ |
Merge to develop |
s3://flipdev/base-application-dev/src/ and s3://flipstag/base-application/src/ |
Merge to main |
s3://flipprod/base-application/src/ |
Warning: Never manually sync to the production bucket.
To test a PR on the FLIP platform, update FL_APP_BASE_BUCKET in the flip repo environment variables to point to your PR's S3 path.
Makefile Reference
Network Management
| Command | Description |
|---|---|
make nvflare-provision NET_NUMBER=X |
Provision FL network X |
make build NET_NUMBER=X |
Build Docker images for network X |
make up NET_NUMBER=X |
Start FL network X |
make down NET_NUMBER=X |
Stop FL network X |
make clean NET_NUMBER=X |
Remove containers and images |
Development
| Command | Description |
|---|---|
make run-container |
Run NVFLARE simulator in Docker |
Testing
| Command | Description |
|---|---|
make unit-test |
Run pytest unit tests |
make test-xrays-standard |
Test standard job with x-ray data |
make test-spleen-standard |
Test standard job with spleen data |
make test-spleen-evaluation |
Test evaluation job with spleen data |
make test-spleen-diffusion |
Test diffusion model with spleen data |
make test |
Run all integration tests |
Data Management
| Command | Description |
|---|---|
make download-xrays-data |
Download x-ray test images from S3 |
make download-spleen-data |
Download spleen test images from S3 |
make download-checkpoints |
Download model checkpoints from S3 |
make copy-spleen-app |
Copy test app to dev folder |
make save-spleen-app |
Save dev changes to test folder |
make pull-spleen-app |
Pull latest app from tutorials repo |
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file flip_utils-0.1.1.tar.gz.
File metadata
- Download URL: flip_utils-0.1.1.tar.gz
- Upload date:
- Size: 44.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.10.5 {"installer":{"name":"uv","version":"0.10.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c5737107a0a8a75e2f8da8335ea10410a8a81aa262551413a28e92c76ce87f91
|
|
| MD5 |
2a59fe63c7c6c09c9c5800f86ed2a740
|
|
| BLAKE2b-256 |
2bbfe573c69f2df5e1f235f11ddcf41ae2eeb0ea2eecdf2e2f209f87b1671215
|
File details
Details for the file flip_utils-0.1.1-py3-none-any.whl.
File metadata
- Download URL: flip_utils-0.1.1-py3-none-any.whl
- Upload date:
- Size: 83.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.10.5 {"installer":{"name":"uv","version":"0.10.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c12f24e958142101539e2ba2a2d91b9154a0dc280ae89eda5e9ef427afae920f
|
|
| MD5 |
e6c2aa621c59a4ba7a0f5ce3cb267ba4
|
|
| BLAKE2b-256 |
861694078cbbf14ca28411918b4c41fbf257b2858bb84014d7471de8207b2b32
|