Closed mzweilin closed 12 months ago
I think the examples of composing FGSM and PGD help people understand how MART works. In addition, the reusable components of FGM and PGD make it easier to do a sanity check on other components (e.g. composer, gain function) when composing novel attacks against new models.
What does this PR do?
Currently, it requires full understanding of the config structure to compose an attack algorithm. This PR makes it easier to compose attack algorithms by introducing
lr
,max_iters
,eps
, so we only define once at fixed paths.negate
to get-eps
in config.Existing attack configurations are updated to demonstrate the simplicity.
Depends on #212
Type of change
Please check all relevant options.
Testing
Please describe the tests that you ran to verify your changes. Consider listing any relevant details of your test configuration.
pytest
CUDA_VISIBLE_DEVICES=0 python -m mart experiment=CIFAR10_CNN_Adv trainer=gpu trainer.precision=16
reports 70% (21 sec/epoch).CUDA_VISIBLE_DEVICES=0,1 python -m mart experiment=CIFAR10_CNN_Adv trainer=ddp trainer.precision=16 trainer.devices=2 model.optimizer.lr=0.2 trainer.max_steps=2925 datamodule.ims_per_batch=256 datamodule.world_size=2
reports 70% (14 sec/epoch).Before submitting
pre-commit run -a
command without errorsDid you have fun?
Make sure you had fun coding 🙃