Repository: qdata/textattack
Issue: Error when using recipe `pwws` to attack `bert-base-uncased-sst2` with command `--query-budget 100`

**Describe the bug**
When using recipe `pwws` to attack `bert-base-uncased-sst2` with command `--query-budget 100`, there is an error `IndexError: list index out of range`.

**To Reproduce**
Steps to reproduce the behavior:
1. Run following command `textattack ...`
`textattack attack --recipe pwws --model bert-base-uncased-sst2 --query-budget 100`

**Screenshots or Traceback**
```
Reusing dataset glue (/root/.cache/huggingface/datasets/glue/sst2/1.0.0/7c99657241149a24692c402a5c3f34d4c9f1df5ac2e4c3759fadea38f6cb29c4)
textattack: Loading datasets dataset glue, subset sst2, split validation.
textattack: Loading pre-trained model from HuggingFace model repository: textattack/bert-base-uncased-SST-2
textattack: Unknown if model of class <class 'transformers.models.bert.modeling_bert.BertForSequenceClassification'> compatible with goal function <class 'textattack.goal_functions.classification.untargeted_classification.UntargetedClassification'>.
Attack(
  (search_method): GreedyWordSwapWIR(
    (wir_method):  weighted-saliency
  )
  (goal_function):  UntargetedClassification
  (transformation):  WordSwapWordNet
  (constraints): 
    (0): RepeatModification
    (1): StopwordModification
  (is_black_box):  True
) 

textattack: Load time: 9.420858383178711s
  0% 0/5 [00:00<?, ?it/s]Traceback (most recent call last):
  File "/usr/local/bin/textattack", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.7/dist-packages/textattack/commands/textattack_cli.py", line 56, in main
    args.func.run(args)
  File "/usr/local/lib/python3.7/dist-packages/textattack/commands/attack/attack_command.py", line 49, in run
    run_single_threaded(args)
  File "/usr/local/lib/python3.7/dist-packages/textattack/commands/attack/run_attack_single_threaded.py", line 119, in run
    for result in attack.attack_dataset(dataset, indices=worklist):
  File "/usr/local/lib/python3.7/dist-packages/textattack/shared/attack.py", line 347, in attack_dataset
    result = self.attack_one(goal_function_result)
  File "/usr/local/lib/python3.7/dist-packages/textattack/shared/attack.py", line 269, in attack_one
    final_result = self.search_method(initial_result)
  File "/usr/local/lib/python3.7/dist-packages/textattack/search_methods/search_method.py", line 40, in __call__
    result = self._perform_search(initial_result)
  File "/usr/local/lib/python3.7/dist-packages/textattack/search_methods/greedy_word_swap_wir.py", line 136, in _perform_search
    if results[0].score > cur_result.score:
IndexError: list index out of range
  0% 0/5 [00:01<?, ?it/s]
```

**System Information (please complete the following information):**
 - OS: ubuntu
 - Library versions: torch==1.8.0+cu101, tensorflow==2.4.1, transformers==4.4.2
 - Textattack version: 0.2.15


Changed files:
textattack/search_methods/greedy_word_swap_wir.py

diff --git a/textattack/search_methods/greedy_word_swap_wir.py b/textattack/search_methods/greedy_word_swap_wir.py
index b33d33eb..ea5fd653 100644
--- a/textattack/search_methods/greedy_word_swap_wir.py
+++ b/textattack/search_methods/greedy_word_swap_wir.py
@@ -73,7 +73,9 @@ class GreedyWordSwapWIR(SearchMethod):
                     # no valid synonym substitutions for this word
                     delta_ps.append(0.0)
                     continue
-                swap_results, _ = self.get_goal_results(transformed_text_candidates)
+                swap_results, search_over = self.get_goal_results(
+                    transformed_text_candidates
+                )
                 score_change = [result.score for result in swap_results]
                 if not score_change:
                     delta_ps.append(0.0)
@@ -81,6 +83,12 @@ class GreedyWordSwapWIR(SearchMethod):
                 max_score_change = np.max(score_change)
                 delta_ps.append(max_score_change)
 
+                # Exit Loop when search_over is True - but we need to make sure delta_ps
+                # is the same size as softmax_saliency_scores
+                if search_over:
+                    delta_ps = delta_ps + [0.0] * (len_text - len(delta_ps))
+                    break
+
             index_scores = softmax_saliency_scores * np.array(delta_ps)
 
         elif self.wir_method == "delete":