Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reproduce #142

Merged
merged 162 commits into from
Nov 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
162 commits
Select commit Hold shift + click to select a range
ee203d3
fixed art bug
simplymathematics May 23, 2023
9e891f0
fixed param bug
simplymathematics May 23, 2023
e4483f6
art bug
simplymathematics May 23, 2023
e132634
+tested attacks on torch
simplymathematics May 23, 2023
7a8f481
generate_grid draft
simplymathematics May 31, 2023
10c9a54
Initial terraform instructions
salehsedghpour Jun 24, 2023
e292038
add networks and firewall rules for K8s
salehsedghpour Jun 24, 2023
99f76b2
create VMs
salehsedghpour Jun 24, 2023
4c17e32
rename functions to main
salehsedghpour Jun 24, 2023
a69bd93
add README
salehsedghpour Jun 24, 2023
a756254
setup and cleanup infrastructure
salehsedghpour Aug 21, 2023
bd2f3d5
not working version
salehsedghpour Aug 23, 2023
b9a5005
add GCP support
salehsedghpour Aug 30, 2023
4ab0f3d
linting
simplymathematics Sep 1, 2023
d85eace
Merge branch 'main' of github.com:simplymathematics/deckard into add-…
simplymathematics Sep 1, 2023
2da52dd
moved iaac folder
simplymathematics Sep 1, 2023
1fb7d5e
draft dataclass and deploy script for gcp
simplymathematics Sep 1, 2023
f604dbc
added package stuff
simplymathematics Sep 1, 2023
3792bda
linting
simplymathematics Sep 1, 2023
503de61
improved compile.py, plots.py
simplymathematics Sep 3, 2023
4b46e5a
linting
simplymathematics Sep 3, 2023
73c611d
linting
simplymathematics Sep 3, 2023
338c307
linting
simplymathematics Sep 3, 2023
4459d49
linting
simplymathematics Sep 3, 2023
4cdba38
linting
simplymathematics Sep 4, 2023
5d08c04
more changes
simplymathematics Sep 4, 2023
e445870
fix compile, plot scripts
simplymathematics Sep 4, 2023
7f1981c
Merge branch 'add-iaac' of github.com:simplymathematics/deckard into …
simplymathematics Sep 4, 2023
f75bc1a
linting
simplymathematics Sep 4, 2023
9daf2d0
linting
simplymathematics Sep 4, 2023
022310c
fixed Dockerfile
simplymathematics Sep 4, 2023
2235ea2
+fixed install, dockerfile
simplymathematics Sep 4, 2023
7a8f572
dockerfile
simplymathematics Sep 6, 2023
c723035
linting
simplymathematics Sep 6, 2023
eba5459
deploy script updates, new docker.yml action
simplymathematics Sep 6, 2023
fb0bc27
Merge branch 'add-iaac' of https://github.com/simplymathematics/decka…
simplymathematics Sep 6, 2023
9c87d06
update precommit file and linting
simplymathematics Sep 6, 2023
ed385ad
+change docker workflow to push to gh
simplymathematics Sep 6, 2023
a73a78b
+change docker workflow to push to gh
simplymathematics Sep 6, 2023
d324cf3
Dockerfile changes
simplymathematics Sep 6, 2023
9b0e896
Dockerfile changes
simplymathematics Sep 6, 2023
13748f1
Dockerfile changes
simplymathematics Sep 6, 2023
dce524f
Dockerfile changes
simplymathematics Sep 6, 2023
a458242
moved gcp conf
simplymathematics Sep 6, 2023
26ca22c
+deploy.py script fixes (still broken)
simplymathematics Sep 6, 2023
e5c805b
Dockerfile
simplymathematics Sep 6, 2023
1dac445
add csi driver
salehsedghpour Sep 6, 2023
5b55e13
fixed python alias in dockerfile
simplymathematics Sep 6, 2023
eb42845
split docker workflow into test/push
simplymathematics Sep 6, 2023
28fc833
add the imagePullPolicy for the pod
salehsedghpour Sep 6, 2023
e2215a1
Merge branch 'add-iaac' of https://github.com/simplymathematics/decka…
simplymathematics Sep 6, 2023
a720beb
update sklearn
simplymathematics Sep 6, 2023
cca5dd7
update sklearn example
simplymathematics Sep 6, 2023
9b269c5
update sklearn example
simplymathematics Sep 7, 2023
e538f12
moved configs
simplymathematics Sep 7, 2023
cd98387
updated iaac code
simplymathematics Sep 7, 2023
7ef52ce
updated deploy script to handle non-GPU configs
simplymathematics Sep 7, 2023
a636896
fixed bug in conf
simplymathematics Sep 7, 2023
e16f0b2
update README, fixed find_best bug
simplymathematics Sep 7, 2023
de6543c
update sklearn dvc lock file
simplymathematics Sep 7, 2023
580f122
update sklearn to grid search
simplymathematics Sep 7, 2023
2859f98
+sklearn/conf/hydra
simplymathematics Sep 7, 2023
b646398
+RQ draft in sklearn examples
simplymathematics Sep 7, 2023
a77f438
+attacks.sh full
simplymathematics Sep 7, 2023
daf589e
linting
simplymathematics Sep 7, 2023
184de1c
Merge branch 'main' of github.com:simplymathematics/deckard into add-…
simplymathematics Sep 7, 2023
8b8e9d5
Merge branch 'add-iaac' of github.com:simplymathematics/deckard into …
simplymathematics Sep 7, 2023
375e7f8
linting
simplymathematics Sep 7, 2023
0f0a9f7
make dockerfile smaller
simplymathematics Sep 7, 2023
1bdd519
add redis deployment
salehsedghpour Sep 7, 2023
87995a7
add redis sc
salehsedghpour Sep 7, 2023
eb91405
add redis pvc
salehsedghpour Sep 7, 2023
58076c5
add redis svc
salehsedghpour Sep 7, 2023
7a6e897
+ deploy script changes
simplymathematics Sep 7, 2023
e25c7ec
fixed merge conflict
simplymathematics Sep 7, 2023
d5acb37
add redis env variables
salehsedghpour Sep 7, 2023
fde0908
Merge branch 'main' of github.com:simplymathematics/deckard into add-…
simplymathematics Sep 7, 2023
a8d73bf
removed deploy script
simplymathematics Sep 7, 2023
e64ad43
update pytorch
simplymathematics Sep 7, 2023
7e7434d
Merge branch 'main' into add-iaac
simplymathematics Sep 7, 2023
4adffcf
merge redis
simplymathematics Sep 7, 2023
e57dadf
linting
simplymathematics Sep 7, 2023
2c99358
linting
simplymathematics Sep 7, 2023
4b6ca64
update docker test name
simplymathematics Sep 7, 2023
c0e8fed
+cifar example
simplymathematics Sep 12, 2023
50e1931
config changes for torch, plots/optimise bug fix
simplymathematics Sep 18, 2023
f5bd008
shorten param file
simplymathematics Sep 18, 2023
5f26154
fixed optimise bug, reduce cifar runtime
simplymathematics Sep 18, 2023
d1b158f
update plots
simplymathematics Sep 19, 2023
0339005
fixed attack time bug
simplymathematics Sep 21, 2023
07a1e0e
fixed attack time bug
simplymathematics Sep 21, 2023
66ce02b
added diabetes support
simplymathematics Sep 21, 2023
5d8be50
fixed hashing bug
simplymathematics Sep 21, 2023
3731b82
+pytorch mnist experiments
simplymathematics Sep 21, 2023
9832c68
update weibull
simplymathematics Sep 21, 2023
d36365a
+weibull score of .8
simplymathematics Sep 22, 2023
dc4d5c4
update weibull
simplymathematics Sep 25, 2023
bb51864
update plots
simplymathematics Sep 29, 2023
3b3c5dd
add conf for scratch folder
simplymathematics Sep 29, 2023
4c8bce6
add compute_success as default metric
simplymathematics Sep 29, 2023
ae5045d
update pytorch
simplymathematics Sep 29, 2023
38ab1c9
linting
simplymathematics Sep 29, 2023
423f503
update to NEURIPS experiments
simplymathematics Oct 9, 2023
b6ea3a1
+ EAI AISEC draft
simplymathematics Oct 9, 2023
e399ec9
scratch folder (WIP)
simplymathematics Oct 9, 2023
fbf9265
update models.sh to remove stage name
simplymathematics Oct 9, 2023
4ebf324
linting
simplymathematics Oct 9, 2023
68d3829
linting
simplymathematics Oct 9, 2023
00e51c5
linting
simplymathematics Oct 9, 2023
03d3be6
classification conf
simplymathematics Oct 14, 2023
62377a1
+ kdd nsl
simplymathematics Oct 14, 2023
cffa8e4
update git ignore
simplymathematics Oct 14, 2023
7243aae
add truthseeker data
simplymathematics Oct 14, 2023
4d73ad4
add kdd-nsl data
simplymathematics Oct 14, 2023
85cf4c6
moved security stuff to one folder
simplymathematics Oct 14, 2023
02ac7ae
linting
simplymathematics Oct 14, 2023
8d0bba6
linting
simplymathematics Oct 14, 2023
78a716d
linting
simplymathematics Oct 14, 2023
06238c1
fixed dockerfile
simplymathematics Oct 14, 2023
59c9e74
fixed dockerfile, tests
simplymathematics Oct 14, 2023
6e5b0ba
fixed bug in data
simplymathematics Oct 14, 2023
d956ab1
stop tracking params.yaml
simplymathematics Oct 31, 2023
10c9bfa
stop tracking params.yaml
simplymathematics Oct 31, 2023
cfd755c
cleanup reports file for security example
simplymathematics Oct 31, 2023
69a3b8c
clean up repo
simplymathematics Oct 31, 2023
b75ab1b
stop tracking params.yaml
simplymathematics Nov 1, 2023
068e110
stop tracking params.yaml
simplymathematics Nov 1, 2023
b7758c2
bug fixes and config cleanup
simplymathematics Nov 14, 2023
de10113
add pytorch cifar100
simplymathematics Nov 14, 2023
53168e3
bug fixes
simplymathematics Nov 14, 2023
0d1410f
update .gitignores
simplymathematics Nov 14, 2023
336cb3c
cleanup old example
simplymathematics Nov 14, 2023
7f2df34
update configs for security example
simplymathematics Nov 14, 2023
255221d
update scripts for security example
simplymathematics Nov 14, 2023
f5fbaad
update test configs
simplymathematics Nov 14, 2023
7824f08
cleaned deckard base code, updated conf
simplymathematics Nov 28, 2023
2f57489
moved pytorch mnist folder
simplymathematics Nov 28, 2023
ed6f757
moved pytorch cifar10 folder
simplymathematics Nov 28, 2023
129a6e0
moved pytorch cifar100 folder
simplymathematics Nov 28, 2023
2c8fa86
deleted old pytorch examples
simplymathematics Nov 28, 2023
3a0edd6
linting
simplymathematics Nov 28, 2023
34e2c57
linting
simplymathematics Nov 28, 2023
97aafe7
Merge branch 'main' of github.com:simplymathematics/deckard into repr…
simplymathematics Nov 28, 2023
a8ab32a
linting
simplymathematics Nov 28, 2023
d73d8fc
removed old pytorch example
simplymathematics Nov 28, 2023
5c3a4c3
linting
simplymathematics Nov 28, 2023
500db31
linting
simplymathematics Nov 28, 2023
66aaa73
delete binary
simplymathematics Nov 28, 2023
9aa7960
linting
simplymathematics Nov 28, 2023
9273980
fix bad merge
simplymathematics Nov 28, 2023
c248fb4
removed scorer logic from exp
simplymathematics Nov 28, 2023
626b333
merge main into reproduce
simplymathematics Nov 28, 2023
9395090
linting
simplymathematics Nov 28, 2023
1383c5f
linting
simplymathematics Nov 28, 2023
6c3de3c
afr (broken)
simplymathematics Nov 29, 2023
7b4b128
update files config to accept "None" folders
simplymathematics Nov 29, 2023
e1c9ac2
update torch initializer to accept device
simplymathematics Nov 29, 2023
e48c772
update confs
simplymathematics Nov 29, 2023
41e9946
linting
simplymathematics Nov 29, 2023
5f9b14c
linting
simplymathematics Nov 29, 2023
317de35
linting
simplymathematics Nov 29, 2023
daa73a5
++torch dependency
simplymathematics Nov 29, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -142,4 +142,3 @@ deckard/deckard.egg-info/*
examples/**/params.yaml
examples/**/multirun/*
*log.txt
examples/power/mnist/plots/adv_accuracy_vs_attack_type.pdf
6 changes: 1 addition & 5 deletions deckard/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,7 @@ def parse_and_repro(args, default_config="default.yaml", config_dir="conf"):
else:
cmd = f"python -m deckard.layers.parse {args} --config_file {default_config}"
# error = f"error parsing command: {cmd} {args}"
with subprocess.Popen(
cmd,
stdout=subprocess.PIPE,
shell=True,
) as proc:
with subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=True) as proc:
for line in proc.stdout:
print(line.rstrip().decode("utf-8"))
if Path(Path(), "dvc.yaml").exists():
Expand Down
27 changes: 3 additions & 24 deletions deckard/base/experiment/experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import numpy as np
from hydra.utils import instantiate
from omegaconf import DictConfig, OmegaConf, ListConfig
from omegaconf import DictConfig, OmegaConf

from ..attack import Attack
from ..data import Data
Expand Down Expand Up @@ -258,28 +258,7 @@ def __call__(self):
self.data.save(score_dict, files["score_dict_file"])
else: # pragma: no cover
raise ValueError("Scorer is None. Please specify a scorer.")
#########################################################################
# Returns score if scorer is not None, otherwise returns status
#########################################################################
if self.optimizers is not None and self.optimizers != []:
self.optimizers = (
[self.optimizers]
if not isinstance(self.optimizers, (list, ListConfig))
else self.optimizers
)
scores = {}
for scorer in self.optimizers:
try:
score = score_dict[scorer]
except KeyError: # pragma: no cover
raise KeyError(
f"Scorer {scorer} not found in score_dict. Available self.optimizers: {score_dict.keys()}",
)
scores[scorer] = score
logger.info(f"Score for id : {self.get_name()} : {scorer}: {score}")
else:
scores = score_dict
logger.info(f"Score for id : {self.get_name()}: {score_dict}")
logger.info(f"Score for id : {self.get_name()}: {score_dict}")
logger.info("Finished running experiment with id: {}".format(self.get_name()))
new_name = self.get_name()
assert (
Expand All @@ -288,7 +267,7 @@ def __call__(self):
logger.debug(
f"Experiment deckard hash changed from {old_hash} to {my_hash(self)}.",
)
return scores
return score_dict

def _set_name(self):
if self.files.name is not None:
Expand Down
44 changes: 24 additions & 20 deletions deckard/base/files/files.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,21 +54,25 @@ def __init__(
for need in needs:
assert need is not None, f"Need to specify {need}"
files.update(kwargs)
self.reports = str(Path(reports).as_posix())
self.data_dir = str(Path(data_dir).as_posix())
self.model_dir = str(Path(model_dir).as_posix())
self.attack_dir = str(Path(attack_dir).as_posix())
self.data_type = data_type
self.model_type = model_type
self.attack_type = attack_type
self.reports = str(Path(reports).as_posix()) if reports else None
self.data_dir = str(Path(data_dir).as_posix()) if data_dir else None
self.model_dir = str(Path(model_dir).as_posix()) if model_dir else None
self.attack_dir = str(Path(attack_dir).as_posix()) if attack_dir else None
self.data_type = data_type if data_type else None
self.model_type = model_type if model_type else None
self.attack_type = attack_type if attack_type else None
self.directory = (
Path(directory).as_posix()
if Path(directory).is_absolute()
else Path(Path(), directory).as_posix()
(
Path(directory).as_posix()
if Path(directory).is_absolute()
else Path(Path(), directory).as_posix()
)
if directory
else None
)
self.name = name
self.stage = stage
self.files = files
self.name = name if name else None
self.stage = stage if stage else None
self.files = files if files else {}
logger.debug(f"FileConfig init: {self.files}")

def __call__(self):
Expand All @@ -95,10 +99,10 @@ def _set_filenames(self, **kwargs):
data_type = self.data_type
model_type = self.model_type
attack_type = self.attack_type
reports = str(Path(directory, reports).as_posix())
data_dir = str(Path(directory, data_dir).as_posix())
model_dir = str(Path(directory, model_dir).as_posix())
attack_dir = str(Path(directory, attack_dir).as_posix())
reports = str(Path(directory, reports).as_posix()) if reports else None
data_dir = str(Path(directory, data_dir).as_posix()) if data_dir else None
model_dir = str(Path(directory, model_dir).as_posix()) if model_dir else None
attack_dir = str(Path(directory, attack_dir).as_posix()) if attack_dir else None
if name is None and stage is None:
path = Path(reports)
elif name is not None and stage is None:
Expand All @@ -109,17 +113,17 @@ def _set_filenames(self, **kwargs):
path = Path(reports, stage, name)
for kwarg in files:
name = files.get(kwarg)
if "data_file" == kwarg:
if "data_file" == kwarg and data_dir is not None:
new_path = Path(data_dir, name)
if new_path.suffix != data_type:
new_path = Path(data_dir, Path(name).stem + data_type)
new_files[kwarg] = str(new_path.as_posix())
elif "model_file" == kwarg:
elif "model_file" == kwarg and model_dir is not None:
new_path = Path(model_dir, name)
if new_path.suffix != model_type:
new_path = Path(model_dir, Path(name).stem + model_type)
new_files[kwarg] = str(new_path.as_posix())
elif "attack_file" == kwarg:
elif "attack_file" == kwarg and attack_dir is not None:
new_path = Path(attack_dir, name)
if new_path.suffix != attack_type:
new_path = Path(attack_dir, Path(name).stem + attack_type)
Expand Down
9 changes: 8 additions & 1 deletion deckard/base/model/art_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,15 @@ def __call__(self):
model,
tuple(torch_dict.values()),
):
import torch

device_type = "gpu" if torch.cuda.is_available() else "cpu"
model = TorchInitializer(
data=data, model=model, library=library, **kwargs
data=data,
model=model,
library=library,
device_type=device_type,
**kwargs,
)()
elif "keras" in str(library) and not isinstance(
model,
Expand Down
Loading
Loading