From dbd8830c0a0083adb7927bbe265fdae151d378aa Mon Sep 17 00:00:00 2001 From: simplymathematics <15224968+simplymathematics@users.noreply.github.com> Date: Mon, 27 Nov 2023 12:46:51 +0000 Subject: [PATCH 1/3] fix filepath issue --- deckard/base/files/files.py | 2 +- deckard/layers/optimise.py | 6 +- .../optimization_results.yaml | 198 ------------------ examples/power/conf/deploy-cpu/cifar10.yaml | 2 +- examples/power/conf/deploy-cpu/cifar100.yaml | 2 +- examples/power/conf/deploy-cpu/mnist.yaml | 2 +- .../deploy-nvidia-tesla-a100/cifar10.yaml | 2 +- .../deploy-nvidia-tesla-a100/cifar100.yaml | 2 +- .../conf/deploy-nvidia-tesla-a100/mnist.yaml | 2 +- .../deploy-nvidia-tesla-p100/cifar10.yaml | 2 +- .../deploy-nvidia-tesla-p100/cifar100.yaml | 2 +- .../conf/deploy-nvidia-tesla-p100/mnist.yaml | 2 +- .../deploy-nvidia-tesla-v100/cifar10.yaml | 2 +- .../deploy-nvidia-tesla-v100/cifar100.yaml | 2 +- .../conf/deploy-nvidia-tesla-v100/mnist.yaml | 2 +- examples/power/conf/files/cifar.yaml | 2 +- examples/power/conf/files/cifar100.yaml | 2 +- examples/power/conf/files/mnist.yaml | 2 +- .../conf/{cifar10.yaml => torch_cifar10.yaml} | 6 +- .../{cifar100.yaml => torch_cifar100.yaml} | 4 +- .../conf/{mnist.yaml => torch_mnist.yaml} | 4 +- examples/power/dvc.yaml | 58 ++--- 22 files changed, 57 insertions(+), 251 deletions(-) delete mode 100644 examples/power/cifar10/attack/torch_example.ResNet18/optimization_results.yaml rename examples/power/conf/{cifar10.yaml => torch_cifar10.yaml} (89%) rename examples/power/conf/{cifar100.yaml => torch_cifar100.yaml} (91%) rename examples/power/conf/{mnist.yaml => torch_mnist.yaml} (94%) diff --git a/deckard/base/files/files.py b/deckard/base/files/files.py index 5d40e2bc..080c3be5 100644 --- a/deckard/base/files/files.py +++ b/deckard/base/files/files.py @@ -61,7 +61,7 @@ def __init__( self.data_type = data_type self.model_type = model_type self.attack_type = attack_type - self.directory = directory if directory is not None else Path.cwd() + self.directory = Path(directory).as_posix() if Path(directory).is_absolute() else Path(Path(), directory).as_posix() self.name = name self.stage = stage self.files = files diff --git a/deckard/layers/optimise.py b/deckard/layers/optimise.py index 218e8bb1..a1877c59 100644 --- a/deckard/layers/optimise.py +++ b/deckard/layers/optimise.py @@ -216,13 +216,13 @@ def parse_stage(stage: str = None, params: dict = None, path=None) -> dict: for stage in stages: pipe = yaml.load(f, Loader=yaml.FullLoader)["stages"][stage] if "deps" in pipe: - dep_list = [x.split(":")[0] for x in pipe["deps"]] + dep_list = [str(x).split(":")[0] for x in pipe["deps"]] file_list.extend(dep_list) if "outs" in pipe: - out_list = [x.split(":")[0] for x in pipe["outs"]] + out_list = [str(x).split(":")[0] for x in pipe["outs"]] file_list.extend(out_list) if "metrics" in pipe: - metric_list = [x.split(":")[0] for x in pipe["metrics"]] + metric_list = [str(x).split(":")[0] for x in pipe["metrics"]] file_list.extend(metric_list) file_string = str(file_list) files = params["files"] diff --git a/examples/power/cifar10/attack/torch_example.ResNet18/optimization_results.yaml b/examples/power/cifar10/attack/torch_example.ResNet18/optimization_results.yaml deleted file mode 100644 index 923e4ab0..00000000 --- a/examples/power/cifar10/attack/torch_example.ResNet18/optimization_results.yaml +++ /dev/null @@ -1,198 +0,0 @@ -name: optuna -solutions: -- params: - ++data.sample.random_state: 1 - ++model.art.initialize.optimizer.lr: 0.0001 - ++model.trainer.nb_epoch: 72 - ++model.trainer.batch_size: 6032 - ++attack.init.eps: 0.01 - ++attack.init.batch_size: 5453 - values: - - 0.09 - - 16191002500.0 - - 202496300.0 - - 0.07 - - 1.5970579 - - 0.2567236 -- params: - ++data.sample.random_state: 0 - ++model.art.initialize.optimizer.lr: 0.0001 - ++model.trainer.nb_epoch: 65 - ++model.trainer.batch_size: 4381 - ++attack.init.eps: 0.01 - ++attack.init.batch_size: 8919 - values: - - 0.09 - - 15576419100.0 - - 212521900.0 - - 0.07 - - 1.686744 - - 0.1941442 -- params: - ++data.sample.random_state: 1 - ++model.art.initialize.optimizer.lr: 0.0001 - ++model.trainer.nb_epoch: 60 - ++model.trainer.batch_size: 5436 - ++attack.init.eps: 0.01 - ++attack.init.batch_size: 4272 - values: - - 0.09 - - 15355428000.0 - - 199412700.0 - - 0.1 - - 1.9881419 - - 0.1924052 -- params: - ++data.sample.random_state: 0 - ++model.art.initialize.optimizer.lr: 0.0001 - ++model.trainer.nb_epoch: 89 - ++model.trainer.batch_size: 9609 - ++attack.init.eps: 0.01 - ++attack.init.batch_size: 3885 - values: - - 0.13 - - 15566144400.0 - - 186406200.0 - - 0.1 - - 1.5605767 - - 0.2238553 -- params: - ++data.sample.random_state: 1 - ++model.art.initialize.optimizer.lr: 0.0001 - ++model.trainer.nb_epoch: 57 - ++model.trainer.batch_size: 9207 - ++attack.init.eps: 0.01 - ++attack.init.batch_size: 768 - values: - - 0.12 - - 15457630400.0 - - 208470100.0 - - 0.1 - - 1.5746003 - - 0.1935967 -- params: - ++data.sample.random_state: 1 - ++model.art.initialize.optimizer.lr: 0.0001 - ++model.trainer.nb_epoch: 47 - ++model.trainer.batch_size: 7729 - ++attack.init.eps: 0.01 - ++attack.init.batch_size: 1258 - values: - - 0.13 - - 15770705800.0 - - 200726400.0 - - 0.12 - - 1.5869763 - - 0.1937882 -- params: - ++data.sample.random_state: 0 - ++model.art.initialize.optimizer.lr: 0.0001 - ++model.trainer.nb_epoch: 95 - ++model.trainer.batch_size: 5215 - ++attack.init.eps: 0.01 - ++attack.init.batch_size: 4186 - values: - - 0.07 - - 15546558500.0 - - 221618200.0 - - 0.09 - - 1.6315451 - - 0.2556823 -- params: - ++data.sample.random_state: 0 - ++model.art.initialize.optimizer.lr: 0.0001 - ++model.trainer.nb_epoch: 84 - ++model.trainer.batch_size: 3565 - ++attack.init.eps: 0.01 - ++attack.init.batch_size: 5493 - values: - - 0.1 - - 15605900800.0 - - 216817200.0 - - 0.13 - - 1.7074055 - - 0.1922862 -- params: - ++data.sample.random_state: 0 - ++model.art.initialize.optimizer.lr: 0.0001 - ++model.trainer.nb_epoch: 14 - ++model.trainer.batch_size: 3226 - ++attack.init.eps: 0.01 - ++attack.init.batch_size: 3694 - values: - - 0.11 - - 15908505000.0 - - 198622800.0 - - 0.13 - - 1.5845013 - - 0.223282 -- params: - ++data.sample.random_state: 0 - ++model.art.initialize.optimizer.lr: 0.0001 - ++model.trainer.nb_epoch: 86 - ++model.trainer.batch_size: 6061 - ++attack.init.eps: 0.01 - ++attack.init.batch_size: 2150 - values: - - 0.08 - - 15959433400.0 - - 189523100.0 - - 0.1 - - 1.5776716 - - 0.1923722 -- params: - ++data.sample.random_state: 1 - ++model.art.initialize.optimizer.lr: 0.0001 - ++model.trainer.nb_epoch: 51 - ++model.trainer.batch_size: 9428 - ++attack.init.eps: 0.01 - ++attack.init.batch_size: 1296 - values: - - 0.14 - - 15580803900.0 - - 267569400.0 - - 0.11 - - 1.6531644 - - 0.221908 -- params: - ++data.sample.random_state: 1 - ++model.art.initialize.optimizer.lr: 0.0001 - ++model.trainer.nb_epoch: 28 - ++model.trainer.batch_size: 6968 - ++attack.init.eps: 0.01 - ++attack.init.batch_size: 481 - values: - - 0.08 - - 15483985500.0 - - 205661300.0 - - 0.1 - - 1.6540843 - - 0.2547964 -- params: - ++data.sample.random_state: 0 - ++model.art.initialize.optimizer.lr: 0.0001 - ++model.trainer.nb_epoch: 46 - ++model.trainer.batch_size: 8907 - ++attack.init.eps: 0.01 - ++attack.init.batch_size: 4445 - values: - - 0.08 - - 15557539700.0 - - 238184900.0 - - 0.08 - - 1.6043485 - - 0.2529451 -- params: - ++data.sample.random_state: 0 - ++model.art.initialize.optimizer.lr: 0.0001 - ++model.trainer.nb_epoch: 51 - ++model.trainer.batch_size: 8468 - ++attack.init.eps: 0.01 - ++attack.init.batch_size: 7514 - values: - - 0.17 - - 15626399800.0 - - 221487300.0 - - 0.14 - - 1.6802734 - - 0.2241953 diff --git a/examples/power/conf/deploy-cpu/cifar10.yaml b/examples/power/conf/deploy-cpu/cifar10.yaml index db4a8917..1c30eed8 100644 --- a/examples/power/conf/deploy-cpu/cifar10.yaml +++ b/examples/power/conf/deploy-cpu/cifar10.yaml @@ -8,7 +8,7 @@ spec: image: ghcr.io/simplymathematics/deckard:main imagePullPolicy: Always workingDir: /deckard/examples/power/ - args: ["python", "-m", "deckard", "--config_file", "cifar10.yaml"] + args: ["python", "-m", "deckard", "--config_file", "torch_cifar10.yaml"] env: - name: DECKARD_DEVICE value: "cpu" diff --git a/examples/power/conf/deploy-cpu/cifar100.yaml b/examples/power/conf/deploy-cpu/cifar100.yaml index 227e5a5c..3f88a21a 100644 --- a/examples/power/conf/deploy-cpu/cifar100.yaml +++ b/examples/power/conf/deploy-cpu/cifar100.yaml @@ -8,7 +8,7 @@ spec: image: ghcr.io/simplymathematics/deckard:main imagePullPolicy: Always workingDir: /deckard/examples/power/ - args: ["python", "-m", "deckard", "--config_file", "cifar100.yaml"] + args: ["python", "-m", "deckard", "--config_file", "torch_cifar100.yaml"] env: - name: DECKARD_DEVICE value: "cpu" diff --git a/examples/power/conf/deploy-cpu/mnist.yaml b/examples/power/conf/deploy-cpu/mnist.yaml index ac97d91b..b0d10a30 100644 --- a/examples/power/conf/deploy-cpu/mnist.yaml +++ b/examples/power/conf/deploy-cpu/mnist.yaml @@ -8,7 +8,7 @@ spec: image: ghcr.io/simplymathematics/deckard:main imagePullPolicy: Always workingDir: /deckard/examples/power/ - args: ["python", "-m", "deckard", "--config_file", "mnist.yaml"] + args: ["python", "-m", "deckard", "--config_file", "torch_mnist.yaml"] env: - name: DECKARD_DEVICE value: "cpu" diff --git a/examples/power/conf/deploy-nvidia-tesla-a100/cifar10.yaml b/examples/power/conf/deploy-nvidia-tesla-a100/cifar10.yaml index ed56d31d..e52e4810 100644 --- a/examples/power/conf/deploy-nvidia-tesla-a100/cifar10.yaml +++ b/examples/power/conf/deploy-nvidia-tesla-a100/cifar10.yaml @@ -8,7 +8,7 @@ spec: image: ghcr.io/simplymathematics/deckard:main imagePullPolicy: Always workingDir: /deckard/examples/power/ - args: ["python", "-m", "deckard", "--config_file", "cifar10.yaml"] + args: ["python", "-m", "deckard", "--config_file", "torch_cifar10.yaml"] env: - name: DECKARD_DEVICE value: nvidia-tesla-a100 diff --git a/examples/power/conf/deploy-nvidia-tesla-a100/cifar100.yaml b/examples/power/conf/deploy-nvidia-tesla-a100/cifar100.yaml index 708506fc..0534e291 100644 --- a/examples/power/conf/deploy-nvidia-tesla-a100/cifar100.yaml +++ b/examples/power/conf/deploy-nvidia-tesla-a100/cifar100.yaml @@ -8,7 +8,7 @@ spec: image: ghcr.io/simplymathematics/deckard:main imagePullPolicy: Always workingDir: /deckard/examples/power/ - args: ["python", "-m", "deckard", "--config_file", "cifar100.yaml"] + args: ["python", "-m", "deckard", "--config_file", "torch_cifar100.yaml"] env: - name: DECKARD_DEVICE value: nvidia-tesla-a100 diff --git a/examples/power/conf/deploy-nvidia-tesla-a100/mnist.yaml b/examples/power/conf/deploy-nvidia-tesla-a100/mnist.yaml index 22f0ebbc..41a06fe2 100644 --- a/examples/power/conf/deploy-nvidia-tesla-a100/mnist.yaml +++ b/examples/power/conf/deploy-nvidia-tesla-a100/mnist.yaml @@ -8,7 +8,7 @@ spec: image: ghcr.io/simplymathematics/deckard:main imagePullPolicy: Always workingDir: /deckard/examples/power/ - args: ["python", "-m", "deckard", "--config_file", "mnist.yaml"] + args: ["python", "-m", "deckard", "--config_file", "torch_mnist.yaml"] env: - name: DECKARD_DEVICE value: nvidia-tesla-a100 diff --git a/examples/power/conf/deploy-nvidia-tesla-p100/cifar10.yaml b/examples/power/conf/deploy-nvidia-tesla-p100/cifar10.yaml index f208189e..50430a24 100644 --- a/examples/power/conf/deploy-nvidia-tesla-p100/cifar10.yaml +++ b/examples/power/conf/deploy-nvidia-tesla-p100/cifar10.yaml @@ -8,7 +8,7 @@ spec: image: ghcr.io/simplymathematics/deckard:main imagePullPolicy: Always workingDir: /deckard/examples/power/ - args: ["python", "-m", "deckard", "--config_file", "cifar10.yaml"] + args: ["python", "-m", "deckard", "--config_file", "torch_cifar10.yaml"] env: - name: DECKARD_DEVICE value: nvidia-tesla-p100 diff --git a/examples/power/conf/deploy-nvidia-tesla-p100/cifar100.yaml b/examples/power/conf/deploy-nvidia-tesla-p100/cifar100.yaml index 508503c5..82aa84cd 100644 --- a/examples/power/conf/deploy-nvidia-tesla-p100/cifar100.yaml +++ b/examples/power/conf/deploy-nvidia-tesla-p100/cifar100.yaml @@ -8,7 +8,7 @@ spec: image: ghcr.io/simplymathematics/deckard:main imagePullPolicy: Always workingDir: /deckard/examples/power/ - args: ["python", "-m", "deckard", "--config_file", "cifar100.yaml"] + args: ["python", "-m", "deckard", "--config_file", "torch_cifar100.yaml"] env: - name: DECKARD_DEVICE value: nvidia-tesla-p100 diff --git a/examples/power/conf/deploy-nvidia-tesla-p100/mnist.yaml b/examples/power/conf/deploy-nvidia-tesla-p100/mnist.yaml index 0fcd01cd..8aeeffc3 100644 --- a/examples/power/conf/deploy-nvidia-tesla-p100/mnist.yaml +++ b/examples/power/conf/deploy-nvidia-tesla-p100/mnist.yaml @@ -8,7 +8,7 @@ spec: image: ghcr.io/simplymathematics/deckard:main imagePullPolicy: Always workingDir: /deckard/examples/power/ - args: ["python", "-m", "deckard", "--config_file", "mnist.yaml"] + args: ["python", "-m", "deckard", "--config_file", "torch_mnist.yaml"] env: - name: DECKARD_DEVICE value: nvidia-tesla-p100 diff --git a/examples/power/conf/deploy-nvidia-tesla-v100/cifar10.yaml b/examples/power/conf/deploy-nvidia-tesla-v100/cifar10.yaml index 09e2880e..4110fae1 100644 --- a/examples/power/conf/deploy-nvidia-tesla-v100/cifar10.yaml +++ b/examples/power/conf/deploy-nvidia-tesla-v100/cifar10.yaml @@ -8,7 +8,7 @@ spec: image: ghcr.io/simplymathematics/deckard:main imagePullPolicy: Always workingDir: /deckard/examples/power/ - args: ["python", "-m", "deckard", "--config_file", "cifar10.yaml"] + args: ["python", "-m", "deckard", "--config_file", "torch_cifar10.yaml"] env: - name: DECKARD_DEVICE value: nvidia-tesla-v100 diff --git a/examples/power/conf/deploy-nvidia-tesla-v100/cifar100.yaml b/examples/power/conf/deploy-nvidia-tesla-v100/cifar100.yaml index 69fa0f92..05267b9c 100644 --- a/examples/power/conf/deploy-nvidia-tesla-v100/cifar100.yaml +++ b/examples/power/conf/deploy-nvidia-tesla-v100/cifar100.yaml @@ -8,7 +8,7 @@ spec: image: ghcr.io/simplymathematics/deckard:main imagePullPolicy: Always workingDir: /deckard/examples/power/ - args: ["python", "-m", "deckard", "--config_file", "cifar100.yaml"] + args: ["python", "-m", "deckard", "--config_file", "torch_cifar100.yaml"] env: - name: DECKARD_DEVICE value: nvidia-tesla-v100 diff --git a/examples/power/conf/deploy-nvidia-tesla-v100/mnist.yaml b/examples/power/conf/deploy-nvidia-tesla-v100/mnist.yaml index 8d19a40a..d139d485 100644 --- a/examples/power/conf/deploy-nvidia-tesla-v100/mnist.yaml +++ b/examples/power/conf/deploy-nvidia-tesla-v100/mnist.yaml @@ -8,7 +8,7 @@ spec: image: ghcr.io/simplymathematics/deckard:main imagePullPolicy: Always workingDir: /deckard/examples/power/ - args: ["python", "-m", "deckard", "--config_file", "mnist.yaml"] + args: ["python", "-m", "deckard", "--config_file", "torch_mnist.yaml"] env: - name: DECKARD_DEVICE value: nvidia-tesla-v100 diff --git a/examples/power/conf/files/cifar.yaml b/examples/power/conf/files/cifar.yaml index bf528351..2a6598ec 100644 --- a/examples/power/conf/files/cifar.yaml +++ b/examples/power/conf/files/cifar.yaml @@ -3,7 +3,7 @@ reports: reports data_dir: data model_dir: models attack_dir: attacks -directory: cifar10 +directory: /result/cifar/ score_dict_file: score_dict.json data_file : data model_file : model diff --git a/examples/power/conf/files/cifar100.yaml b/examples/power/conf/files/cifar100.yaml index 969635c2..e9a11634 100644 --- a/examples/power/conf/files/cifar100.yaml +++ b/examples/power/conf/files/cifar100.yaml @@ -3,7 +3,7 @@ reports: reports data_dir: data model_dir: models attack_dir: attacks -directory: cifar100 +directory: /result/cifar100/ score_dict_file: score_dict.json data_file : data model_file : model diff --git a/examples/power/conf/files/mnist.yaml b/examples/power/conf/files/mnist.yaml index efdb1c42..92ff8649 100644 --- a/examples/power/conf/files/mnist.yaml +++ b/examples/power/conf/files/mnist.yaml @@ -3,7 +3,7 @@ reports: reports data_dir: data model_dir: models attack_dir: attacks -directory: mnist +directory: "/result/mnist/" score_dict_file: score_dict.json data_file : data model_file : model diff --git a/examples/power/conf/cifar10.yaml b/examples/power/conf/torch_cifar10.yaml similarity index 89% rename from examples/power/conf/cifar10.yaml rename to examples/power/conf/torch_cifar10.yaml index 00839cfe..081452ab 100644 --- a/examples/power/conf/cifar10.yaml +++ b/examples/power/conf/torch_cifar10.yaml @@ -26,9 +26,9 @@ optimizers: _target_ : deckard.base.experiment.Experiment hydra: run: - dir: ${files.directory}/${files.reports}/${stage}/logs + dir: ${files.directory}/${files.reports}/${stage}/logs/${data.generate.name} sweep: - dir: ${files.directory}/${stage}/${model.init.name} + dir: ${files.directory}/${stage}/${data.generate.name} subdir : ${hydra.sweeper.study_name}/${hydra.job.num} sweeper: study_name: ${model.init.name} @@ -40,7 +40,7 @@ hydra: consider_magic_clip: true consider_endpoints: false n_startup_trials: 10 # default: 10 - n_startup_trials: 24 # default: 24 + n_ei_candidates: 24 # default: 24 multivariate: true warn_independent_sampling: true n_trials : 100 diff --git a/examples/power/conf/cifar100.yaml b/examples/power/conf/torch_cifar100.yaml similarity index 91% rename from examples/power/conf/cifar100.yaml rename to examples/power/conf/torch_cifar100.yaml index 38415a4e..b13922e0 100644 --- a/examples/power/conf/cifar100.yaml +++ b/examples/power/conf/torch_cifar100.yaml @@ -27,9 +27,9 @@ optimizers: _target_ : deckard.base.experiment.Experiment hydra: run: - dir: ${files.directory}/${files.reports}/${stage}/logs + dir: ${files.directory}/${files.reports}/${stage}/logs/${data.generate.name} sweep: - dir: ${files.directory}/${stage}/${model.init.name} + dir: ${files.directory}/${stage}//${data.generate.name} subdir : ${hydra.sweeper.study_name}/${hydra.job.num} sweeper: study_name: ${model.init.name} diff --git a/examples/power/conf/mnist.yaml b/examples/power/conf/torch_mnist.yaml similarity index 94% rename from examples/power/conf/mnist.yaml rename to examples/power/conf/torch_mnist.yaml index 26e413a4..583c5bd1 100644 --- a/examples/power/conf/mnist.yaml +++ b/examples/power/conf/torch_mnist.yaml @@ -27,9 +27,9 @@ optimizers: _target_ : deckard.base.experiment.Experiment hydra: run: - dir: ${files.directory}/${files.reports}/${stage}/logs + dir: ${files.directory}/${files.reports}/${stage}/logs/${data.generate.name} sweep: - dir: ${files.directory}/${stage}/${model.init.name} + dir: ${files.directory}/${stage}/${data.generate.name} subdir : ${hydra.sweeper.study_name}/${hydra.job.num} sweeper: study_name: ${model.init.name} diff --git a/examples/power/dvc.yaml b/examples/power/dvc.yaml index eb637fd6..51d1cbff 100644 --- a/examples/power/dvc.yaml +++ b/examples/power/dvc.yaml @@ -14,7 +14,7 @@ stages: # # params: # # - oc. parse_params: - cmd: python -m deckard.layers.parse --config_file ${files.directory}.yaml + cmd: python -m deckard.layers.parse --config_file ${data.generate.name}.yaml deps: - conf/ outs: @@ -22,7 +22,7 @@ stages: cache: True persist: True train: - cmd: python -m deckard.layers.experiment train --config_file ${files.directory}.yaml + cmd: python -m deckard.layers.experiment train --config_file ${data.generate.name}.yaml params: - data - model @@ -38,9 +38,10 @@ stages: # - ${files.directory}/${files.reports}/train/${files.name}/${files.predictions_file} # logit outputs for our model # - ${files.directory}/${files.reports}/train/${files.name}/${files.probabilities_file} # Omit to save space metrics: - - ${files.directory}/${files.reports}/train/${files.name}/${files.score_dict_file} + - ${files.directory}/${files.reports}/train/${files.name}/${files.score_dict_file}: + cache : false attack: - cmd: python -m deckard.layers.experiment attack --config_file ${files.directory}.yaml + cmd: python -m deckard.layers.experiment attack --config_file ${data.generate.name}.yaml params: - data - model @@ -49,40 +50,43 @@ stages: - files - device_id outs: - - ${files.directory}/${files.attack_dir}/${files.attack_file}${files.attack_type} - - ${files.directory}/${files.reports}/attack/${files.name}/${files.adv_predictions_file} - - ${files.directory}/${files.data_dir}/${files.data_file}${files.data_type} - - ${files.directory}/${files.model_dir}/${files.model_file}${files.model_type} - - ${files.directory}/${files.model_dir}/${files.model_file}.optimizer${files.model_type} - - ${files.directory}/${files.reports}/attack/${files.name}/${files.predictions_file} # logit outputs for our model + - ${files.directory}/${files.attack_dir}/${files.attack_file}${files.attack_type}: + cache : false + - ${files.directory}/${files.reports}/attack/${files.name}/${files.adv_predictions_file}: + cache : false + - ${files.directory}/${files.data_dir}/${files.data_file}${files.data_type}: + cache : false + - ${files.directory}/${files.model_dir}/${files.model_file}${files.model_type}: + cache : false + - ${files.directory}/${files.model_dir}/${files.model_file}.optimizer${files.model_type}: + cache : false + - ${files.directory}/${files.reports}/attack/${files.name}/${files.predictions_file}: # logit outputs for our model + cache : false deps: - params.yaml metrics: - - ${files.directory}/${files.reports}/attack/${files.name}/${files.score_dict_file} + - ${files.directory}/${files.reports}/attack/${files.name}/${files.score_dict_file}: + cache: false attacks: - foreach: # This is a loop over the ResNet models - - ${files.directory} - # - cifar - # - cifar100 - do: - cmd: python -m deckard.layers.optimise $@ --multirun ++attack.attack_size=100 stage=attack ++hydra.sweeper.storage=sqlite:///${files.directory}/${files.reports}/attack/${item}.db --config-name ${item}.yaml - deps: - - ${item}/${files.reports}/attack/${files.name}/${files.score_dict_file} # This is here just to ensure it runs after the attack stage - outs: - - ${files.directory}/${files.reports}/attack/${item}.db: # This outputs a database file for each model - cache: True - persist: True + cmd: python -m deckard.layers.optimise --multirun ++attack.attack_size=100 stage=attack ++hydra.sweeper.storage=sqlite:///${files.directory}/${files.reports}/attack/${data.generate.name}.db --config-name ${data.generate.name}.yaml + deps: + - ${files.directory}/${files.reports}/attack/${files.name}/${files.score_dict_file} # This is here just to ensure it runs after the attack stage + outs: + # This outputs a database file for each model + - ${files.directory}/${files.reports}/attack/${data.generate.name}.db: + cache: false + persist: true # compile: # foreach: # iterates through each stage # # - train # - attack # do: - # cmd: python -m deckard.layers.compile --report_folder ${files.directory}/${files.reports}/${item} --results_file ${files.directory}/${files.reports}/${item}.csv + # cmd: python -m deckard.layers.compile --report_folder ${files.directory}/${files.reports}/${data.generate.name} --results_file ${files.directory}/${files.reports}/${data.generate.name}.csv # deps: - # - ${files.directory}/${files.reports}/${item}/ - # - ${files.directory}/${files.reports}/${item}/mnist.db + # - ${files.directory}/${files.reports}/${data.generate.name}/ + # - ${files.directory}/${files.reports}/${data.generate.name}/mnist.db # outs: - # - ${files.directory}/${files.reports}/${item}.csv + # - ${files.directory}/${files.reports}/${data.generate.name}.csv # plot: # cmd : python -m deckard.layers.plots --path ${files.directory}/plots/ --file ${files.directory}/${files.reports}/attack.csv -o data.csv # deps: From 07af2f49807c73473895a3097ca18c9de5be2dfe Mon Sep 17 00:00:00 2001 From: simplymathematics <15224968+simplymathematics@users.noreply.github.com> Date: Mon, 27 Nov 2023 12:55:59 +0000 Subject: [PATCH 2/3] linting --- deckard/base/files/files.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/deckard/base/files/files.py b/deckard/base/files/files.py index 080c3be5..9946cf34 100644 --- a/deckard/base/files/files.py +++ b/deckard/base/files/files.py @@ -61,7 +61,11 @@ def __init__( self.data_type = data_type self.model_type = model_type self.attack_type = attack_type - self.directory = Path(directory).as_posix() if Path(directory).is_absolute() else Path(Path(), directory).as_posix() + self.directory = ( + Path(directory).as_posix() + if Path(directory).is_absolute() + else Path(Path(), directory).as_posix() + ) self.name = name self.stage = stage self.files = files From b534d9deeb14426bc397c804c1b035de914dfc04 Mon Sep 17 00:00:00 2001 From: simplymathematics <15224968+simplymathematics@users.noreply.github.com> Date: Tue, 28 Nov 2023 18:02:52 +0000 Subject: [PATCH 3/3] added path for downloading the cifar100 data --- examples/power/conf/data/torch_cifar100.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/power/conf/data/torch_cifar100.yaml b/examples/power/conf/data/torch_cifar100.yaml index 84f8546e..a0e83862 100644 --- a/examples/power/conf/data/torch_cifar100.yaml +++ b/examples/power/conf/data/torch_cifar100.yaml @@ -2,6 +2,7 @@ _target_: deckard.base.data.Data generate: _target_: deckard.base.data.generator.DataGenerator name: torch_cifar100 + path: original_data/ sample: _target_: deckard.base.data.sampler.SklearnDataSampler random_state : 0