Merged
Conversation
dxoigmn
commented
May 25, 2023
|
|
||
| on_run_end() | ||
| """ | ||
| class Adversary(pl.LightningModule): |
Member
Author
There was a problem hiding this comment.
Ideally this would inherit from LitModular. Then we can create pre-defined sequences for training.
Contributor
|
I tried to run adversarial training on 2 GPUs but failed. Then hiding perturber parameters accidentally resolved the issue. python -m mart \
experiment=CIFAR10_CNN_Adv \
trainer=ddp \
trainer.devices=2 \
model.optimizer.lr=0.2 \
trainer.max_steps=2925 \
datamodule.ims_per_batch=256 File "/home/weilinxu/coder/MART/.venv/lib/python3.9/site-packages/torch/nn/parallel/distributed.py", line 807, in <listcomp>
for param_name, param in module.named_parameters(recurse=False)
File "/home/weilinxu/coder/MART/mart/attack/perturber.py", line 83, in named_parameters
raise MisconfigurationException("You need to call configure_perturbation before fit.")
pytorch_lightning.utilities.exceptions.MisconfigurationException: You need to call configure_perturbation before fit. |
mzweilin
reviewed
Jun 1, 2023
mzweilin
reviewed
Jun 1, 2023
mzweilin
reviewed
Jun 2, 2023
| @@ -0,0 +1,2 @@ | |||
| attack_in_eval_mode: | |||
Contributor
There was a problem hiding this comment.
Shall we make an accurate name for this?
* Fix progress bar display. * Enable progress bar for adversary. * Switch on/off progress bar for adversary in the callback config. * Make a default progress bar for adversary that can be turned off in FGSM. * Display progress bars of adversary in multi-rank. * Display gain instead of loss. * Make process_position configurable and avoid touching the internal variable. * Make renaming metrics configurable.
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.
What does this PR do?
Right now we treat adversaries as special things with their own loops and callbacks, when really we should just treat them like LightningModules. Doing so means that we can just use a Trainer to fit its parameters. This PR attempts to make that so.
As of dcf7599, there is a bug in adversarial training.Depends upon #146 and #147.
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.
pytestpython -m mart experiment=CIFAR10_CNN_Adv trainer=gpuachieves 71% accuracy.python -m mart experiment=CIFAR10_CNN_Adv trainer=ddp datamodule.world_size=2 trainer.devices=2achieves 71% accuracy.Before submitting
pre-commit run -acommand without errorsDid you have fun?
Make sure you had fun coding 🙃