Skip to main content

A lightweight federated learning library

Project description

🚀 NanoFed

GitHub Actions Workflow Status PyPI - Python Version Read the Docs GitHub License PyPI - Status

NanoFed: Simplifying the development of privacy-preserving distributed ML models.


🌍 What is Federated Learning?

Federated Learning (FL) is a distributed machine learning paradigm that trains a global model across multiple clients (devices or organizations) without sharing their data. Instead, clients send model updates to a central server for aggregation.

Key Benefits

🌟 Feature Description
🔒 Privacy Preservation Data stays securely on devices.
🚀 Resource Efficiency Decentralized training reduces transfer overhead.
🌐 Scalable AI Enables collaborative training environments.

📦 Installation

Requirements

  • Python 3.10+
  • Dependencies installed automatically

Install with Pip

pip install nanofed

Development Installation

git clone https://github.com/camille-004/nanofed.git
cd nanofed
make install

📖 Documentation

📚 Learn how to use NanoFed in our guides and API references. 👉 Read the Docs


✨ Key Features

  • 🔒 Privacy-First: Keep data on devices while training.
  • 🚀 Easy-to-Use: Simple APIs with seamless PyTorch integration.
  • 🔧 Flexible: Customizable aggregation strategies and extensible architecture.
  • 💻 Production Ready: Robust error handling and logging.

Feature Overview

Feature Description
🔒 Privacy-First Data never leaves devices.
🚀 Intuitive API Built for developers with PyTorch support.
🔧 Flexible Aggregation Supports custom strategies.
💻 Production Ready Async communication, robust error handling.

🔧 Quick Start

Train a model using federated learning in just a few lines of code:

import asyncio
from nanofed import HTTPClient, TorchTrainer, TrainingConfig

async def run_client(client_id: str, server_url: str):
    training_config = TrainingConfig(epochs=1, batch_size=256, learning_rate=0.1)
    async with HTTPClient(server_url, client_id) as client:
        model_state, _ = await client.fetch_global_model()
        await client.submit_update(model_state)

if __name__ == "__main__":
    asyncio.run(run_client("client1", "http://localhost:8080"))

🛠️ Getting Help

Need assistance? Here are some helpful resources:

Resource Description
📚 Documentation Learn how to use NanoFed effectively.
🐛 Issue Tracker Report bugs or request features.
🛠️ Source Code Browse the NanoFed repository on GitHub.

⚖️ License

NanoFed is licensed under the GNU General Public License (GPL-3.0). See the LICENSE file for details.


👩‍💻 Contributing

Contributions are welcome! We follow the Conventional Commits specification. See our contribution guidelines for detailed instructions.

Example commit message:

feat(client): add retry mechanism

🛠️ Development Roadmap

✅ Completed

Core Features for V1

  • Basic client-server architecture with HTTP communication
  • Simple global model management
  • Basic FedAvg implementation
  • Local training support
  • Support for PyTorch models
  • Synchronous training (all clients must complete before aggregation)
  • Basic error handling and logging

🚀 Future Enhancements

Planned Features

  • Advanced privacy features: Differential Privacy (DP), Secure Multiparty Computation (MPC), Homomorphic Encryption (HE)
  • Asynchronous updates for faster and more flexible training
  • Non-IID data handling for diverse client datasets
  • Custom aggregation strategies for specific use cases
  • gRPC implementation for high-performance communication
  • Model compression techniques to reduce bandwidth usage
  • Fault tolerance mechanisms for unreliable clients or servers

Made with ❤️ and 🧠 by Camille Dunning.

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

nanofed-0.1.3.tar.gz (33.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nanofed-0.1.3-py3-none-any.whl (41.0 kB view details)

Uploaded Python 3

File details

Details for the file nanofed-0.1.3.tar.gz.

File metadata

  • Download URL: nanofed-0.1.3.tar.gz
  • Upload date:
  • Size: 33.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.12.7 Linux/6.5.0-1025-azure

File hashes

Hashes for nanofed-0.1.3.tar.gz
Algorithm Hash digest
SHA256 d4e3aa89f2e5a1b94d79b8b743b6ea7a4568d3f3bc6ea1389258cdc6fde52a91
MD5 0bd1a1c83934e4edbe2d4f1693a0ce36
BLAKE2b-256 d98cb7b2825884e6d8a226de5ff9d5c715ce2552a747936e8f190e5ed616d9b8

See more details on using hashes here.

File details

Details for the file nanofed-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: nanofed-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 41.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.12.7 Linux/6.5.0-1025-azure

File hashes

Hashes for nanofed-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 cb2c082ae09924046097e4cad901cbaed4694e8847c030b44f243611ca4cf019
MD5 c3613936fd6f16138ad9bbb0d4c55052
BLAKE2b-256 0eb9c58e57505d7557ee758c9229264f1ab4412639f8e8e57b4fade38e85d395

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page