Coder Social home page Coder Social logo

vit_fl's Introduction

FedVit is a transformer based pipeline for federated learning research!

Quick Start 🚀

We provide an end-to-end example for users to start running a medical vit!.

Step 1. Installation📚

First of all, users need to clone the source code and install the required packages (we suggest python version >= 3.9).

git clone https://github.com/erfandarzi/Vit_FL.git
cd Vit_FL

Use Conda

We recommend using a new virtual environment to install Medscale:

conda create -n Vit_FL python=3.9
conda activate Vit_FL

If your backend is torch, please install torch in advance (torch-get-started). For example, if your cuda version is 11.3 please execute the following command:

conda install -y pytorch=1.10.1 torchvision=0.11.2 torchaudio=0.10.1 torchtext=0.11.1 cudatoolkit=11.3 -c pytorch -c conda-forge

For users with Apple M1 chips💻:

conda install pytorch torchvision torchaudio -c pytorch

Finally, after the backend is installed, you can install our repository from source:

From source
pip install .

Now, you have successfully installed the minimal version of our repository. (Optinal)

Example Usage: Federated lung cancer classification

medscale-logo

Downloading Lung cancer dataset📋

You can download lung cancer dataset from kaggle and put it in data/lung directory.

Running training script

To run a federated learning example with FedOPT algorithm, for unbalanced dataset run:

python medscale/main.py --cfg scripts/my_configs/FedOPT_Lung_cancer.yaml

All adjustable parameters can be found in the second cell. Careful with the BATCH_SIZE, as we are using it to parallelize head and time chunk calculations.

License

Our work is under MIT license. Credits to Federated Scope for their amazing pipeline.

vit_fl's People

Contributors

erfandarzi avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.