Closed mzweilin closed 1 year ago
Also, can you add why you made this change? Seems like a lot of changes for some unknown use case.
Can you make this PR more minimal? Lots going on here and I don't have the patience to review large PRs.
Okay. I have merged main into #185 to hide many changes that are already in main.
This PR is split into https://github.com/IntelLabs/MART/pull/210 and https://github.com/IntelLabs/MART/pull/215
What does this PR do?
This PR makes
Adversary
work with any model thatoutput_dict = model(batch)
.LitModular
andSequentialDict
are not required any more.attack_step()
inLitModular
.Adversary
works with models that are notLitModular
.batch_converter
inAdversary
to standardize input for adversary. (Anomalib gives ImageNet normalized input.)This PR depends on #185
This PR is split into #210 and #215
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 🙃