QData / TextAttack

TextAttack 🐙 is a Python framework for adversarial attacks, data augmentation, and model training in NLP https://textattack.readthedocs.io/en/master/
https://textattack.readthedocs.io/en/master/
MIT License
3k stars 398 forks source link

Bug for T5 summarization using seq2sick #682

Closed tangxiangru closed 2 years ago

tangxiangru commented 2 years ago

!textattack attack --model t5-summarization --recipe seq2sick --num-examples 100

2022-08-02 21:42:48.974422: I tensorflow/core/util/util.cc:169] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable TF_ENABLE_ONEDNN_OPTS=0. Using custom data configuration default Reusing dataset gigaword (/home/xt86/.cache/huggingface/datasets/gigaword/default/1.2.0/ea83a8b819190acac5f2dae011fad51dccf269a0604ec5dd24795b64efb424b6) 100%|█████████████████████████████████████████████| 3/3 [00:00<00:00, 86.19it/s] textattack: Loading datasets dataset gigaword, split test. textattack: Goal function <class 'textattack.goal_functions.text.non_overlapping_output.NonOverlappingOutput'> compatible with model T5ForTextToText. Attack( (search_method): GreedyWordSwapWIR( (wir_method): unk ) (goal_function): NonOverlappingOutput (transformation): WordSwapEmbedding( (max_candidates): 50 (embedding): WordEmbedding ) (constraints): (0): LevenshteinEditDistance( (max_edit_distance): 30 (compare_against_original): True ) (1): RepeatModification (2): StopwordModification (is_black_box): True )

0%| | 0/100 [00:00<?, ?it/s]Traceback (most recent call last): File "/gpfs/ysm/project/gerstein/xt86/conda_envs/legacy_application/bin/textattack", line 8, in sys.exit(main()) File "/gpfs/ysm/project/gerstein/xt86/conda_envs/legacy_application/lib/python3.7/site-packages/textattack/commands/textattack_cli.py", line 50, in main func.run(args) File "/gpfs/ysm/project/gerstein/xt86/conda_envs/legacy_application/lib/python3.7/site-packages/textattack/commands/attack_command.py", line 36, in run attacker.attack_dataset() File "/gpfs/ysm/project/gerstein/xt86/conda_envs/legacy_application/lib/python3.7/site-packages/textattack/attacker.py", line 441, in attack_dataset self._attack() File "/gpfs/ysm/project/gerstein/xt86/conda_envs/legacy_application/lib/python3.7/site-packages/textattack/attacker.py", line 170, in _attack raise e File "/gpfs/ysm/project/gerstein/xt86/conda_envs/legacy_application/lib/python3.7/site-packages/textattack/attacker.py", line 168, in _attack result = self.attack.attack(example, ground_truth_output) File "/gpfs/ysm/project/gerstein/xt86/conda_envs/legacy_application/lib/python3.7/site-packages/textattack/attack.py", line 418, in attack example, ground_truth_output File "/gpfs/ysm/project/gerstein/xt86/conda_envs/legacy_application/lib/python3.7/site-packages/textattack/goal_functions/goal_function.py", line 68, in init_attackexample result, = self.get_result(attacked_text, check_skip=True) File "/gpfs/ysm/project/gerstein/xt86/conda_envs/legacy_application/lib/python3.7/site-packages/textattack/goal_functions/goal_function.py", line 79, in get_result results, search_over = self.get_results([attacked_text], **kwargs) File "/gpfs/ysm/project/gerstein/xt86/conda_envs/legacy_application/lib/python3.7/site-packages/textattack/goal_functions/goal_function.py", line 96, in get_results model_outputs = self._call_model(attacked_text_list) File "/gpfs/ysm/project/gerstein/xt86/conda_envs/legacy_application/lib/python3.7/site-packages/textattack/goal_functions/goal_function.py", line 216, in _call_model outputs = self._call_model_uncached(uncached_list) File "/gpfs/ysm/project/gerstein/xt86/conda_envs/legacy_application/lib/python3.7/site-packages/textattack/goal_functions/goal_function.py", line 165, in _call_model_uncached batch_preds = self.model(batch) File "/gpfs/ysm/project/gerstein/xt86/conda_envs/legacy_application/lib/python3.7/site-packages/textattack/models/wrappers/huggingface_model_wrapper.py", line 42, in call if self.tokenizer.model_max_length == int(1e30) AttributeError: 'T5Tokenizer' object has no attribute 'model_max_length' 0%| | 0/100 [00:00<?, ?it/s]

jxmorris12 commented 2 years ago

Please reclone and try again. I think this works now.