-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Merge branch 'tiny_imagenet_benchmarks' of github.com:dilyabar…
…eeva/quanda into tiny_imagenet_benchmarks
- Loading branch information
Showing
6 changed files
with
98 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
Bootstrap: localimage | ||
From: ./quanda_pre_build.sif | ||
|
||
%files | ||
# Copies over the source code | ||
./quanda /opt/quanda | ||
|
||
%post | ||
export PYTHONPATH="/opt/quanda/" | ||
export LD_LIBRARY_PATH=/opt/conda/lib | ||
|
||
cd /opt/quanda | ||
pip install .[tutorials] | ||
|
||
# Install wget | ||
apt-get update && apt-get install -y wget unzip | ||
|
||
%runscript | ||
cd /opt/quanda | ||
python -u scripts/compute_explanations.py "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
Bootstrap: docker | ||
From: nvidia/cuda:11.7.1-cudnn8-devel-ubuntu20.04 | ||
|
||
%environment | ||
export "PATH=/opt/conda/bin:$PATH" | ||
|
||
%post | ||
apt-get -y update | ||
apt install -y git | ||
apt-get -y install curl | ||
|
||
curl -o ~/miniconda.sh -O https://repo.anaconda.com/miniconda/Miniconda3-py39_4.12.0-Linux-x86_64.sh | ||
|
||
chmod +x ~/miniconda.sh | ||
~/miniconda.sh -b -u -p /opt/conda | ||
rm ~/miniconda.sh | ||
export "PATH=/opt/conda/bin:$PATH" | ||
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CONDA_PREFIX/lib/ | ||
|
||
pip install \ | ||
numpy>=1.19.5 \ | ||
torch==2.0.0+cu117 --extra-index-url https://download.pytorch.org/whl/cu117 | ||
torchvision==0.15.0+cu117 --extra-index-url https://download.pytorch.org/whl/cu117 | ||
captum@git+https://github.com/pytorch/captum \ | ||
lightning>=1.4.0 \ | ||
torchmetrics>=1.4.0 \ | ||
tqdm>=4.0.0 \ | ||
traker>=0.3.2 \ | ||
annoy>=1.17.0 \ | ||
datasets>=2.0.0 \ | ||
torcheval>=0.0.6 \ | ||
matplotlib>=3.4.0 \ | ||
pillow>=8.3.0 \ | ||
python-dotenv>=1.0.0 \ | ||
nltk>=3.6.0 \ | ||
wandb>=0.12.10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/bin/bash | ||
#SBATCH --output=%j_%x.out | ||
#SBATCH --nodes=1 | ||
#SBATCH --ntasks=1 | ||
#SBATCH --cpus-per-task=4 | ||
#SBATCH --gres=gpu:1 | ||
#SBATCH --mem=16G | ||
#SBATCH --array=0-0 | ||
#SBATCH --job-name=quanda_explanations | ||
|
||
source "/etc/slurm/local_job_dir.sh" | ||
|
||
# The next line is optional and for job statistics only. You may omit it if you do not need statistics. | ||
echo "$PWD/${SLURM_JOB_ID}_stats.out" > $LOCAL_JOB_DIR/stats_file_loc_cfg | ||
|
||
echo "Extract tiny-imagegetnet-200.tar to ${LOCAL_JOB_DIR}" | ||
time unzip -qq $DATAPOOL3/datasets/tiny-imagenet-200.zip -d $LOCAL_JOB_DIR | ||
|
||
# Make a folder locally on the node for job_results. This folder ensures that data is copied back even when the job fails | ||
mkdir -p "${LOCAL_JOB_DIR}/job_results" | ||
mkdir -p "${LOCAL_JOB_DIR}/tmp" | ||
|
||
# List of methods | ||
methods=("similarity" "representer_points" "tracincpfast" "arnoldi" "trak" "random") | ||
|
||
# Select the method based on the SLURM_ARRAY_TASK_ID | ||
method=${methods[$SLURM_ARRAY_TASK_ID]} | ||
|
||
echo "Compute Explanations" | ||
|
||
apptainer run --nv --env "PYTHONPATH=." --bind $LOCAL_JOB_DIR:/mnt/dataset --bind ${LOCAL_JOB_DIR}/job_results:/mnt/output --bind ${LOCAL_JOB_DIR}/tmp:/mnt/tmp ./quanda_build.sif --method "$method" --tiny_in_path "/mnt/dataset/" --panda_sketch_path "/mnt/tmp/sketch/" --output_dir "/mnt/output" --checkpoints_dir "/mnt/tmp/" --metadata_dir "/mnt/tmp/" --download | ||
|
||
# This command copies all results generated in $LOCAL_JOB_DIR back to the submit folder regarding the job id. | ||
cd "$LOCAL_JOB_DIR" | ||
tar -cf quanda_xpl_${SLURM_JOB_ID}.tar job_results | ||
cp quanda_xpl_${SLURM_JOB_ID}.tar $SLURM_SUBMIT_DIR/quanda_output/ | ||
rm -rf ${LOCAL_JOB_DIR}/job_results | ||
rm -rf ${LOCAL_JOB_DIR}/tmp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/bash | ||
apptainer build --fakeroot --force ./quanda_pre_build.sif ./quanda/slurm/apptainer/quanda_pre_build.def | ||
apptainer build --fakeroot --force ./quanda_build.sif ./quanda/slurm/apptainer/quanda_build.def | ||
sbatch ./quanda/slurm/compute_explanations.sbatch |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.