This is a set of instructions for getting started with the project.
First you need to clone the project into whatever directory you prefer.
git clone https://github.com/RicoBorra/FederatedLearningProjectThen, for the following operations, move into the project folder.
cd FederatedLearningProjectThis creates the virtual enviroment within a directory env.
python -m venv envThen you can activate the environment.
source env/bin/activateAlternatively, in case of fish shell.
source env/bin/activate.fishAutomatically install all required packages.
pip install -r requirements.txtThere are two ways for importing the dataset.
Create dataset directory
cd data/femnistRun the following commands to generate the datasets (and download the necessary files if missing)
To generate the non-iid distribution
./preprocess_parquet.sh -s niid --sf 1.0 -k 0 -t sampleTo generate the iid distribution
./preprocess_parquet.sh -s iid --sf 1.0 -k 0 -t sampleGo back to parent directory of the project
cd -Download zipped file.
wget --load-cookies /tmp/cookies.txt "https://docs.google.com/uc?export=download&confirm=$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate 'https://docs.google.com/uc?export=download&id=1AXJ5uuswGkv9dzVGMAJGRbGViWZFgImE' -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p')&id=1AXJ5uuswGkv9dzVGMAJGRbGViWZFgImE" -O compressed.zip && rm -rf /tmp/cookies.txtUnzip file and remove zipped dataset.
unzip compressed.zip -d data/femnist/
rm -rf compressed.zipExecute the following command to login with API key b578cc4325e4b0652255efe8f2878be1d5fad2f2.
wandb login b578cc4325e4b0652255efe8f2878be1d5fad2f2This will provide automatic access and log to the Weights & Biases platform for model and experiments tracking.
Run the application and test the model.
python main.py --niid --seed 0 --dataset femnist --model cnn \
--num_rounds 1000 \
--num_epochs 1 \
--clients_per_round 10 \
--print_train_interval 1000 --print_test_interval 1000 \
--eval_interval 10 --test_interval 10By tweaking the parameters, we can have multiple experiments and outcomes.