refactor(examples): standardize all pipelines to use load_or_train#81
Open
asim29 wants to merge 1 commit intopr/4.7-attribute-datafrom
Open
refactor(examples): standardize all pipelines to use load_or_train#81asim29 wants to merge 1 commit intopr/4.7-attribute-datafrom
asim29 wants to merge 1 commit intopr/4.7-attribute-datafrom
Conversation
All six pipelines replace manual if-exists/torch.load/torch.save blocks with load_or_train(), fixing the torch.device() type bug in --device defaults and expanding --dataset help strings to include utkface. run_adversarial_training adds post-hoc adversarial accuracy comparison. run_dp_sgd logs the accuracy trade-off. get_started.py rewritten to cover the full attack lifecycle with AmuletDataset and the new APIs.
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
Eighth in the
refactor/risk-modulesstack. Stacked on #80 (attr-inference + data-recon). Covers all runnable example pipelines that were not already updated in their respective risk-vertical PRs.Changes
Pattern applied uniformly across all six scripts:
if filename.exists(): torch.load(...) else: train(...); torch.save(...)blocks withload_or_train().default=torch.device(f"cuda:{0}" if ...)→default="cuda:0" if ...(was passing atorch.deviceobject as a string argparse default).--datasethelp strings to includeutkface,cifar100,mnist.examples/defense_pipelines/run_adversarial_training.pyEvasionPGDon both the undefended and defended models and logs the delta.examples/defense_pipelines/run_dp_sgd.pybaseline → DP-SGDaccuracy trade-off after training.examples/get_started.pyAmuletDatasetand the new APIs across all risk modules.examples/extending_amulet/custom_metric.md/custom_risk.mdTest plan
uv run python examples/get_started.pyuv run pre-commit run --all-files