From 958ff0a9090d8fedb81f744a7cff5014a4627ac8 Mon Sep 17 00:00:00 2001 From: simplymathematics <15224968+simplymathematics@users.noreply.github.com> Date: Sun, 26 Nov 2023 19:40:19 +0000 Subject: [PATCH] linting --- build_instructions.md | 2 +- deckard/__main__.py | 9 +++++++-- deckard/base/experiment/experiment.py | 6 +++--- examples/power/conf/model/art/initialize/default.yaml | 2 +- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/build_instructions.md b/build_instructions.md index ae0fda07..029f0e99 100644 --- a/build_instructions.md +++ b/build_instructions.md @@ -16,4 +16,4 @@ python3 -m pip install deckard/adversarial-robustness-toolbox/ python3 -m pip install -e deckard/ python3 -m pip install pyinstaller python3 -m pip install -u numba pip setuptools -cd deckard && pyinstaller --onefile deckard.py -n deckard \ No newline at end of file +cd deckard && pyinstaller --onefile deckard.py -n deckard diff --git a/deckard/__main__.py b/deckard/__main__.py index 49e1f4ec..03153d92 100644 --- a/deckard/__main__.py +++ b/deckard/__main__.py @@ -44,7 +44,9 @@ def parse_and_repro(args, default_config="default.yaml", config_dir="conf"): if len(args) == 0: assert ( save_params_file( - config_dir=Path(Path(), config_dir) if not Path(config_dir).is_absolute() else Path(config_dir), + config_dir=Path(Path(), config_dir) + if not Path(config_dir).is_absolute() + else Path(config_dir), config_file=default_config, ) is None @@ -99,6 +101,9 @@ def parse_and_repro(args, default_config="default.yaml", config_dir="conf"): else: other_args = [] if submodule is None: - assert parse_and_repro(other_args, args.config_file, config_dir=args.config_dir) == 0 + assert ( + parse_and_repro(other_args, args.config_file, config_dir=args.config_dir) + == 0 + ) else: assert run_submodule(submodule, other_args) == 0 diff --git a/deckard/base/experiment/experiment.py b/deckard/base/experiment/experiment.py index c51542a4..522ae9d3 100644 --- a/deckard/base/experiment/experiment.py +++ b/deckard/base/experiment/experiment.py @@ -29,7 +29,7 @@ class Experiment: name: Union[str, None] = field(default_factory=str) stage: Union[str, None] = field(default_factory=str) optimizers: Union[list, None] = field(default_factory=list) - device_id : str = 'cpu' + device_id: str = "cpu" kwargs: Union[dict, None] = field(default_factory=dict) def __init__( @@ -38,7 +38,7 @@ def __init__( model: Model, scorers: ScorerDict, files: list, - device_id : str = 'cpu', + device_id: str = "cpu", attack: Attack = None, name=None, stage=None, @@ -254,7 +254,7 @@ def __call__(self): old_score_dict = self.data.load(files["score_dict_file"]) old_score_dict.update(**score_dict) score_dict = old_score_dict - score_dict.update({"device_id" : self.device_id}) + score_dict.update({"device_id": self.device_id}) self.data.save(score_dict, files["score_dict_file"]) else: # pragma: no cover raise ValueError("Scorer is None. Please specify a scorer.") diff --git a/examples/power/conf/model/art/initialize/default.yaml b/examples/power/conf/model/art/initialize/default.yaml index f82c1405..becd0f9a 100644 --- a/examples/power/conf/model/art/initialize/default.yaml +++ b/examples/power/conf/model/art/initialize/default.yaml @@ -5,4 +5,4 @@ optimizer: lr : 0.01 momentum : 0.9 clip_values : [0, 255] -device_type : ${oc.env:DECKARD_DEVICE_TYPE,cpu} \ No newline at end of file +device_type : ${oc.env:DECKARD_DEVICE_TYPE,cpu}