Skip to content

Commit

Permalink
added scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
GorkaAbad committed Sep 25, 2023
1 parent ef2be5f commit 2365299
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 1 deletion.
9 changes: 8 additions & 1 deletion how_to.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,15 @@ Install the requirements:
pip install -r requirements.txt
```

## Hardware requirements

In order to run the code a GPU is strongly recommended.
The code is tested on a machine with 1 NVIDIA A100 GPUs with 40GB.

## Examples

Script examples for different datasets are provided in the `scripts` folder.

Get help:
```bash
python main.py --help
Expand Down Expand Up @@ -109,7 +116,7 @@ optional arguments:
The index of the trigger label
--momentum MOMENTUM Momentum
--alpha ALPHA Alpha
--beta BETA Beta
--beta BETA Beta. Gamma in the paper
--data_dir DATA_DIR Data directory
--save_path SAVE_PATH
Path to save the experiments
Expand Down
11 changes: 11 additions & 0 deletions scripts/dynamic.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# N-MNIST
python dynamic.py --dataset mnist --cupy --epochs 10 --train_epochs 1 --alpha 0.5 --beta 0.01

# CIFAR-10
python dynamic.py --dataset cifar10 --cupy --epochs 28 --train_epochs 1 --alpha 0.5 --beta 0.01

# Gesture
python dynamic.py --dataset gesture --cupy --epochs 64 --train_epochs 1 --alpha 0.5 --beta 0.01

# Caltech-101
python dynamic.py --dataset caltech --cupy --epochs 30 --train_epochs 1 --alpha 0.5 --beta 0.01
11 changes: 11 additions & 0 deletions scripts/moving.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# N-MNIST
python main.py --dataset mnist --polarity 1 --pos top-left --trigger_size 0.1 --epsilon 0.1 --type moving --cupy --epochs 10

# CIFAR-10
python main.py --dataset cifar10 --polarity 1 --pos top-left --trigger_size 0.1 --epsilon 0.1 --type moving --cupy --epochs 28

# Gesture
python main.py --dataset gesture --polarity 1 --pos top-left --trigger_size 0.1 --epsilon 0.1 --type moving --cupy --epochs 64

# Caltech-101
python main.py --dataset caltech --polarity 1 --pos top-left --trigger_size 0.1 --epsilon 0.1 --type moving --cupy --epochs 30
11 changes: 11 additions & 0 deletions scripts/smart.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# N-MNIST
python main.py --dataset mnist --n_masks 2 --trigger_size 0.1 --epsilon 0.1 --type smart --cupy --epochs 10

# CIFAR-10
python main.py --dataset cifar10 --n_masks 2 --trigger_size 0.1 --epsilon 0.1 --type smart --cupy --epochs 28

# Gesture
python main.py --dataset gesture --n_masks 2 --trigger_size 0.1 --epsilon 0.1 --type smart --cupy --epochs 64

# Caltech-101
python main.py --dataset caltech --n_masks 2 --trigger_size 0.1 --epsilon 0.1 --type smart --cupy --epochs 30
11 changes: 11 additions & 0 deletions scripts/static.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# N-MNIST
python main.py --dataset mnist --polarity 1 --pos top-left --trigger_size 0.1 --epsilon 0.1 --type static --cupy --epochs 10

# CIFAR-10
python main.py --dataset cifar10 --polarity 1 --pos top-left --trigger_size 0.1 --epsilon 0.1 --type static --cupy --epochs 28

# Gesture
python main.py --dataset gesture --polarity 1 --pos top-left --trigger_size 0.1 --epsilon 0.1 --type static --cupy --epochs 64

# Caltech-101
python main.py --dataset caltech --polarity 1 --pos top-left --trigger_size 0.1 --epsilon 0.1 --type static --cupy --epochs 30

0 comments on commit 2365299

Please sign in to comment.