- python >= 3.6
- pytorch >= 1.2.0
For example: python: 3.7, pytorch: 1.5.0+cu101
You can train and save a clean model; attack a loaded model in both training time (poisoning attack) and test time (evasion attack). The following commands are run under the root folder.
python -m nat_train --dataset cora --gcn_epochs 200 --lr 0.01 --model_dir ./nat_model_saved/
-
evasion attack:
python -m attack --dataset cora --ptb_rate 0.05 --reg_weight 0.0 --model PGD --target_node test --model_path ./nat_model_saved/cora_gcn.pt
-
poisoning attack:
python -m attack --dataset cora --ptb_rate 0.05 --reg_weight 0.0 --model min-max --target_node train --model_path ./nat_model_saved/cora_gcn.pt
python -m adv_train --dataset cora --adv_epochs 200 --lr 0.0005 --ptb_rate 0.05 --reg_weight 0.0 --model_dir ./rob_model_saved/