Skip to content

Commit

Permalink
Merge pull request #1 from sacs-epfl/pets-review
Browse files Browse the repository at this point in the history
Pets review
  • Loading branch information
rishi-s8 authored Nov 8, 2024
2 parents a4871f4 + eb48f3d commit 3434d0c
Show file tree
Hide file tree
Showing 50 changed files with 568 additions and 799 deletions.
198 changes: 161 additions & 37 deletions ARTIFACT-EVALUATION.md

Large diffs are not rendered by default.

55 changes: 21 additions & 34 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
# Use the NVIDIA CUDA image for the specified platform
FROM nvidia/cuda:12.3.2-devel-ubuntu22.04

# Pytorch requires the CUDA SDK architecture version to be specified
# for Docker-based Pytorch builds to work
# Set this argument as:
# docker build --build-arg TORCH_CUDA_ARCH_LIST=Turing .
ARG TORCH_CUDA_ARCH_LIST
ENV TORCH_CUDA_ARCH_LIST=${TORCH_CUDA_ARCH_LIST:-}

# Update and install required packages
RUN apt-get update && apt-get install -y \
openssl \
Expand All @@ -21,47 +28,27 @@ RUN apt-get update && apt-get install -y \
libgl1-mesa-glx \
git-lfs

# Set the home directory
ENV HOME=/root
# ENV TORCH_CUDA_ARCH_LIST=Turing
# Create a directory called 'shatter' in the home directory
RUN mkdir -p $HOME/shatter

# Copy the contents of the current folder into the 'shatter' directory
COPY . $HOME/shatter

# Unzip ImangeNet Validation Data
WORKDIR $HOME/shatter/artifact_scripts/gradientInversion/rog/
RUN unzip data.zip
RUN rm data.zip
RUN mkdir -p /root/shatter

WORKDIR $HOME
# Install Miniconda
ENV CONDA_PREFIX=${HOME}/.conda
ENV CONDA=${CONDA_PREFIX}/condabin/conda

RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh
RUN bash miniconda.sh -b -p ${CONDA_PREFIX}

RUN ${CONDA} config --set auto_activate_base false
RUN ${CONDA} init bash
RUN rm miniconda.sh
# Set the home directory
ENV SHATTER_HOME=/root/shatter

# Set the working directory to the 'shatter' directory
WORKDIR $HOME/shatter
# Copy the contents of the current folder into the 'shatter' directory
COPY . $SHATTER_HOME

# Install the required packages
RUN ${CONDA} create -n venv python=3.10
WORKDIR $SHATTER_HOME
# This is required to install Conda
ENV CONDA_PREFIX=${SHATTER_HOME}/.conda

ENV VENV_PATH=${CONDA_PREFIX}/envs/venv/bin
RUN bash prerequisites.sh

RUN ${CONDA} run -n venv pip install --upgrade pip
RUN ${CONDA} run -n venv pip install --upgrade setuptools
RUN ${CONDA} run -n venv pip install -r requirements.txt
# WORKDIR $HOME/shatter/artifact_scripts/gradientInversion/rog/
# RUN ${CONDA} run -n venv pip install -r requirements.txt
RUN bash testing-script.sh

WORKDIR $HOME/shatter
# Run experiment 1
#RUN cd $SHATTER_HOME/artifact_scripts/gradientInversion/rog && ./run.sh
## Run experiment 2
#RUN cd $SHATTER_HOME/artifact_scripts/small_scale && ./run_all

# Default command to open a bash shell
CMD ["/bin/bash"]
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Decentralized Learning (DL) enables collaborative learning without a server and
Installation
============

Before cloning, ensure that ypou have Git LFS installed. If not, you can install it using the following command:
Before cloning, ensure that you have Git LFS installed. If not, you can install it using the following command:

.. code-block:: bash
Expand All @@ -19,7 +19,7 @@ To install the necessary dependencies, use the following command:

.. code-block:: bash
pip install -r requirements.txt && pip install --editable . && pip install -r artifact_scripts/gradientInversion/rog/requirements.txt
pip install -r requirements_base.txt && pip install -r requirements_all.txt
Usage
=====
Expand Down
13 changes: 0 additions & 13 deletions artifact_scripts/gradientInversion/rog/requirements.txt

This file was deleted.

17 changes: 6 additions & 11 deletions artifact_scripts/gradientInversion/rog/run.sh
Original file line number Diff line number Diff line change
@@ -1,31 +1,26 @@
#!/bin/bash

# Check if the number of arguments is exactly 1
if [ "$#" -ne 1 ]; then
echo "Usage: $0 <environment python executable folder, e.g. ~/.conda/envs/venv/bin/>"
exit 1
fi

env_python=$1/python
num_clients=1

# Compute the results

cd $SHATTER_HOME/artifact_scripts/gradientInversion/rog

config_file=config_fedavg_lenet.yaml
$env_python attack_fedavg.py $config_file $num_clients
python attack_fedavg.py $config_file $num_clients

echo "Finished EL Reconstructions!"
sleep 2

config_file=config_topk_lenet.yaml
$env_python attack_fedavg.py $config_file $num_clients
python attack_fedavg.py $config_file $num_clients
echo "Finished TopK Reconstructions!"
sleep 2

for num_chunks in 2 4 8 16
do
config_file=config_vnodes"${num_chunks}"_lenet.yaml
$env_python attack_vnodes.py $config_file $num_clients $num_chunks
python attack_vnodes.py $config_file $num_clients $num_chunks
echo "Finished Shatter with k=$num_chunks Reconstructions!"
sleep 2
done
Expand All @@ -35,6 +30,6 @@ echo "Reconstructed images can be found in experiments/"

echo "Aggregating Metrics"

$env_python aggregateLPIPS.py
python aggregateLPIPS.py

echo "LPIPS plot and CSV generated!"
64 changes: 0 additions & 64 deletions artifact_scripts/small_scale/CIFAR10/EL/run.sh

This file was deleted.

64 changes: 0 additions & 64 deletions artifact_scripts/small_scale/CIFAR10/Muffliato05/run.sh

This file was deleted.

64 changes: 0 additions & 64 deletions artifact_scripts/small_scale/CIFAR10/VNodes2/run.sh

This file was deleted.

3 changes: 0 additions & 3 deletions artifact_scripts/small_scale/Movielens/EL/ip.json

This file was deleted.

Loading

0 comments on commit 3434d0c

Please sign in to comment.