fedmind


Namefedmind JSON
Version 0.2.1 PyPI version JSON
download
home_pageNone
SummaryFederated Learning research framework in your mind
upload_time2024-12-08 20:51:03
maintainerNone
docs_urlNone
authorNone
requires_python>=3.12
licenseMIT License Copyright (c) 2024 Chenguang Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords federated-learning framework research
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # FedMind

[![image](https://img.shields.io/pypi/v/fedmind.svg)](https://pypi.python.org/pypi/fedmind)
[![image](https://img.shields.io/pypi/l/fedmind.svg)](https://github.com/Xiao-Chenguang/FedMind//blob/main/LICENSE)
[![image](https://img.shields.io/pypi/pyversions/fedmind.svg)](https://pypi.python.org/pypi/fedmind)
[![PyPI Downloads](https://static.pepy.tech/badge/fedmind)](https://pepy.tech/projects/fedmind)
[![Actions status](https://github.com/Xiao-Chenguang/FedMind/workflows/Ruff/badge.svg)](https://github.com/Xiao-Chenguang/FedMind/actions)

A simple and easy Federated Learning framework fit researchers' mind based on [PyTorch](https://pytorch.org/).

Unlike other popular FL frameworks focusing on production, `FedMind` is designed for researchers to easily implement their own FL algorithms and experiments. It provides a simple and flexible interface to implement FL algorithms and experiments.

## Installation
The package is published on PyPI under the name `fedmind`. You can install it with pip:
```bash
pip install fedmind
```

## Usage

A configuration file in `yaml` is required to run the experiments.
You can refer to the [config.yaml](./config.yaml) as an example.

There are examples in the [examples](./examples) directory.


Make a copy of both the [config.yaml](./config.yaml) and [fedavg_demo.py](./examples/fedavg_demo.py) to your own directory.
 You can run them with the following command:
```bash
python fedavg_demo.py
```

Here we recommend you to use the [UV](https://docs.astral.sh/uv/) as a python environment manager to create a clean environment for the experiments.

After install `uv`, you can create a new environment and run a `FedMind` example with the following command:
```bash
uv init FL-demo
cd FL-demo

source .uv/bin/activate
uv add fedmind torchvision

wget https://raw.githubusercontent.com/Xiao-Chenguang/FedMind/refs/heads/main/examples/fedavg_demo.py
wget https://raw.githubusercontent.com/Xiao-Chenguang/FedMind/refs/heads/main/config.yaml

uv run python fedavg_demo.py
```


## Features
- **Simple**: Easy to implement your own FL algorithms and experiments.
- **PyTorch**: Based on [PyTorch](https://pytorch.org/), a popular deep learning framework.
- **Multi-Platform**: Support both *Linux*, *macOS* and *Windows*.
- **CPU/GPU**: Support both **CPU** and **GPU** training.
- **Serial/Parallel**: Support both serial and parallel training modes.
- **Model Operation**: Support model level operations like `+`, `-`, `*`, `/`.
- **Reproducible**: Reproduce your experiments with the `configuration file` and `seed`.


### Serial/Parallel Training
This FL framework provides two client simulation modes depending on your resources:
- Parallel training speed up for powerful resources.
- Serialization for limited resources.

This is controlled by the parameter `NUM_PROCESS` which can be set in the [config.yaml](./config.yaml).
Setting `NUM_PROCESS` to 0 will use the serialization mode where each client trains sequentially in same global round.
Setting `NUM_PROCESS > 0` will use the parallel mode where `NUM_PROCESS` workers consume the clients tasks in parallel.
The recommended value for `NUM_PROCESS` is the number of **CPU cores** available.

#### Notice on Windows
Multiprocessing with CUDA is ***not supported on Windows***. If you are using Windows, you should set `NUM_PROCESS` to 0 to use the serialization mode with CUDA. Or you are free to use the parallel mode with CPU only.

## Acknowledgement
- This project includes code from [easydict](https://github.com/makinacorpus/easydict), licensed under the GNU Lesser General Public License (LGPL) version 3.0.
See the [easydict's LICENSE](https://github.com/makinacorpus/easydict?tab=LGPL-3.0-1-ov-file) for details.
            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "fedmind",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.12",
    "maintainer_email": null,
    "keywords": "federated-learning, framework, research",
    "author": null,
    "author_email": "Xiao Chenguang <xiaochenguang0719@qq.com>",
    "download_url": "https://files.pythonhosted.org/packages/d5/ff/e4807a4ed0c45e3c367e547bab34ac6f36b93fadebe3a5cd0fefc9220015/fedmind-0.2.1.tar.gz",
    "platform": null,
    "description": "# FedMind\n\n[![image](https://img.shields.io/pypi/v/fedmind.svg)](https://pypi.python.org/pypi/fedmind)\n[![image](https://img.shields.io/pypi/l/fedmind.svg)](https://github.com/Xiao-Chenguang/FedMind//blob/main/LICENSE)\n[![image](https://img.shields.io/pypi/pyversions/fedmind.svg)](https://pypi.python.org/pypi/fedmind)\n[![PyPI Downloads](https://static.pepy.tech/badge/fedmind)](https://pepy.tech/projects/fedmind)\n[![Actions status](https://github.com/Xiao-Chenguang/FedMind/workflows/Ruff/badge.svg)](https://github.com/Xiao-Chenguang/FedMind/actions)\n\nA simple and easy Federated Learning framework fit researchers' mind based on [PyTorch](https://pytorch.org/).\n\nUnlike other popular FL frameworks focusing on production, `FedMind` is designed for researchers to easily implement their own FL algorithms and experiments. It provides a simple and flexible interface to implement FL algorithms and experiments.\n\n## Installation\nThe package is published on PyPI under the name `fedmind`. You can install it with pip:\n```bash\npip install fedmind\n```\n\n## Usage\n\nA configuration file in `yaml` is required to run the experiments.\nYou can refer to the [config.yaml](./config.yaml) as an example.\n\nThere are examples in the [examples](./examples) directory.\n\n\nMake a copy of both the [config.yaml](./config.yaml) and [fedavg_demo.py](./examples/fedavg_demo.py) to your own directory.\n You can run them with the following command:\n```bash\npython fedavg_demo.py\n```\n\nHere we recommend you to use the [UV](https://docs.astral.sh/uv/) as a python environment manager to create a clean environment for the experiments.\n\nAfter install `uv`, you can create a new environment and run a `FedMind` example with the following command:\n```bash\nuv init FL-demo\ncd FL-demo\n\nsource .uv/bin/activate\nuv add fedmind torchvision\n\nwget https://raw.githubusercontent.com/Xiao-Chenguang/FedMind/refs/heads/main/examples/fedavg_demo.py\nwget https://raw.githubusercontent.com/Xiao-Chenguang/FedMind/refs/heads/main/config.yaml\n\nuv run python fedavg_demo.py\n```\n\n\n## Features\n- **Simple**: Easy to implement your own FL algorithms and experiments.\n- **PyTorch**: Based on [PyTorch](https://pytorch.org/), a popular deep learning framework.\n- **Multi-Platform**: Support both *Linux*, *macOS* and *Windows*.\n- **CPU/GPU**: Support both **CPU** and **GPU** training.\n- **Serial/Parallel**: Support both serial and parallel training modes.\n- **Model Operation**: Support model level operations like `+`, `-`, `*`, `/`.\n- **Reproducible**: Reproduce your experiments with the `configuration file` and `seed`.\n\n\n### Serial/Parallel Training\nThis FL framework provides two client simulation modes depending on your resources:\n- Parallel training speed up for powerful resources.\n- Serialization for limited resources.\n\nThis is controlled by the parameter `NUM_PROCESS` which can be set in the [config.yaml](./config.yaml).\nSetting `NUM_PROCESS` to 0 will use the serialization mode where each client trains sequentially in same global round.\nSetting `NUM_PROCESS > 0` will use the parallel mode where `NUM_PROCESS` workers consume the clients tasks in parallel.\nThe recommended value for `NUM_PROCESS` is the number of **CPU cores** available.\n\n#### Notice on Windows\nMultiprocessing with CUDA is ***not supported on Windows***. If you are using Windows, you should set `NUM_PROCESS` to 0 to use the serialization mode with CUDA. Or you are free to use the parallel mode with CPU only.\n\n## Acknowledgement\n- This project includes code from [easydict](https://github.com/makinacorpus/easydict), licensed under the GNU Lesser General Public License (LGPL) version 3.0.\nSee the [easydict's LICENSE](https://github.com/makinacorpus/easydict?tab=LGPL-3.0-1-ov-file) for details.",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2024 Chenguang  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
    "summary": "Federated Learning research framework in your mind",
    "version": "0.2.1",
    "project_urls": {
        "Homepage": "https://github.com/Xiao-Chenguang/FedMind",
        "Issues": "https://github.com/Xiao-Chenguang/FedMind/issues",
        "Releases": "https://github.com/Xiao-Chenguang/FedMind/releases"
    },
    "split_keywords": [
        "federated-learning",
        " framework",
        " research"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7ab8fcd853348b6c05325f6bc5323d1d07b2567f328785f000531accb0e20938",
                "md5": "a9f3621f2ebcc38df4437ee96182955f",
                "sha256": "3b715399982207cc98564f1a2cb4cd4f0bba15c29605b2778e3d06671e1ba376"
            },
            "downloads": -1,
            "filename": "fedmind-0.2.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "a9f3621f2ebcc38df4437ee96182955f",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.12",
            "size": 15501,
            "upload_time": "2024-12-08T20:51:01",
            "upload_time_iso_8601": "2024-12-08T20:51:01.229860Z",
            "url": "https://files.pythonhosted.org/packages/7a/b8/fcd853348b6c05325f6bc5323d1d07b2567f328785f000531accb0e20938/fedmind-0.2.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d5ffe4807a4ed0c45e3c367e547bab34ac6f36b93fadebe3a5cd0fefc9220015",
                "md5": "62d28c4af0b70d42deeb52b328cabb91",
                "sha256": "cc521702db2c6a3c444c9208e16d8194ab40683e89370675950ab843373e0129"
            },
            "downloads": -1,
            "filename": "fedmind-0.2.1.tar.gz",
            "has_sig": false,
            "md5_digest": "62d28c4af0b70d42deeb52b328cabb91",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.12",
            "size": 77877,
            "upload_time": "2024-12-08T20:51:03",
            "upload_time_iso_8601": "2024-12-08T20:51:03.027637Z",
            "url": "https://files.pythonhosted.org/packages/d5/ff/e4807a4ed0c45e3c367e547bab34ac6f36b93fadebe3a5cd0fefc9220015/fedmind-0.2.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-08 20:51:03",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Xiao-Chenguang",
    "github_project": "FedMind",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "fedmind"
}
        
Elapsed time: 0.43449s