1
0
mirror of https://github.com/QData/TextAttack.git synced 2021-10-13 00:05:06 +03:00

add a test that includes --attack_n, --enable_csv, targeted goal function

This commit is contained in:
Jack Morris
2020-04-28 20:12:34 -04:00
parent dc01e5dc98
commit 96e204ce6c
2 changed files with 20 additions and 3 deletions

View File

@@ -33,6 +33,7 @@ register_test('python scripts/run_attack.py --model bert-snli --recipe textfoole
name='run_attack_textfooler_bert_snli_10',
output_file='local_tests/outputs/run_attack_textfooler_bert_snli_10.txt',
desc='Runs attack using TextFooler recipe on BERT using 10 examples from the SNLI dataset')
#
# test: run_attack deepwordbug attack on 10 samples from LSTM MR
# (takes about 41s)
@@ -40,4 +41,20 @@ register_test('python scripts/run_attack.py --model bert-snli --recipe textfoole
register_test('python scripts/run_attack.py --model lstm-mr --recipe deepwordbug --num_examples 10',
name='run_attack_deepwordbug_lstm_mr_10',
output_file='local_tests/outputs/run_attack_deepwordbug_lstm_mr_10.txt',
desc='Runs attack using DeepWordBUG recipe on LSTM using 10 examples from the MR dataset')
desc='Runs attack using DeepWordBUG recipe on LSTM using 10 examples from the MR dataset')
#
# test: run_attack targeted classification of class 2 on BERT MNLI with enable_csv
# and attack_n set, using the WordNet transformation and beam search with
# beam width 2, using language tool constraint, on 10 samples
# (takes about 171s)
#
register_test(('python scripts/run_attack.py --attack_n --goal_function targeted-classification:target_class=2 '
'--enable_csv --model bert-mnli --num_examples 10 --transformation word-swap-wordnet '
'--constraints lang-tool --attack beam-search:beam_width=2'),
name='run_attack_targeted2_bertmnli_wordnet_beamwidth_2_enablecsv_attackn',
output_file='local_tests/outputs/run_attack_targetedclassification2_wordnet_langtool_enable_csv_beamsearch2_attack_n_10.txt',
desc=('Runs attack using targeted classification on class 2 on BERT MNLI with'
'enable_csv and attack_n set, using the WordNet transformation and beam '
'search with beam width 2, using language tool constraint, on 10 samples')
)