Skip to content

Commit

Permalink
clean
Browse files Browse the repository at this point in the history
  • Loading branch information
wangjksjtu committed Nov 2, 2021
1 parent 158e65a commit 22ba402
Show file tree
Hide file tree
Showing 4 changed files with 389 additions and 324 deletions.
5 changes: 5 additions & 0 deletions neurips21/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
__pycache__
.vscode/
models/
logs*/
save*/
3 changes: 2 additions & 1 deletion neurips21/attacks/minmax.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import numpy as np
import tensorflow as tf
from utils import proj_box, proj_box_appro, proj_prob_simplex
from .utils import proj_box, proj_box_appro, proj_prob_simplex

__all__ = [
"minmax_ens", # ensemble attack over multiple models: grad_delta
Expand Down Expand Up @@ -89,6 +89,7 @@ def _update_F(delta, W):
ybar, logits = model(x + delta, logits=True)
# print("clipping loss")
# f.append(tf.maximum(loss_fn(labels=targets[i], logits=logits), tf.constant(50.0)))
f.append(loss_fn(labels=targets[i], logits=logits))
# print(f)

return tf.stack(f, axis=1)
Expand Down
6 changes: 3 additions & 3 deletions neurips21/scripts/ens_attack.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ epochs=50
(export CUDA_VISIBLE_DEVICES=0 && python ens_attack.py --dataset cifar --eps 0.05 --epochs $epochs --alpha 6 --beta 50 --gamma 4 --models ABCD)&
(export CUDA_VISIBLE_DEVICES=1 && python ens_attack.py --dataset cifar --eps 0.05 --epochs $epochs --alpha 6 --beta 50 --gamma 4 --models ABCD --avg_case True)&

CIFAR (L_2)
# CIFAR (L_2)
(export CUDA_VISIBLE_DEVICES=0 && python ens_attack.py --dataset cifar --eps 3.0 --epochs $epochs --alpha 10 --beta 100 --gamma 4 --models ABCD --norm 2)&
(export CUDA_VISIBLE_DEVICES=1 && python ens_attack.py --dataset cifar --eps 3.0 --epochs $epochs --alpha 10 --beta 100 --gamma 4 --models ABCD --avg_case True --norm 2)&

CIFAR (L_1)
# CIFAR (L_1)
(export CUDA_VISIBLE_DEVICES=0 && python ens_attack.py --dataset cifar --eps 30.0 --epochs $epochs --alpha 4 --beta 100 --gamma 4 --models ABCD --norm 1)&
(export CUDA_VISIBLE_DEVICES=1 && python ens_attack.py --dataset cifar --eps 30.0 --epochs $epochs --alpha 4 --beta 100 --gamma 4 --models ABCD --avg_case True --norm 1)&

CIFAR (L_0)
# CIFAR (L_0)
(export CUDA_VISIBLE_DEVICES=0 && python ens_attack.py --dataset cifar --eps 50.0 --epochs $epochs --alpha 1 --beta 100 --gamma 7 --models ABCD --norm 0)&
(export CUDA_VISIBLE_DEVICES=1 && python ens_attack.py --dataset cifar --eps 50.0 --epochs $epochs --alpha 1 --beta 100 --gamma 7 --models ABCD --avg_case True --norm 0)&
Loading

0 comments on commit 22ba402

Please sign in to comment.