mirror of
https://github.com/QData/TextAttack.git
synced 2021-10-13 00:05:06 +03:00
fix search behavior and update test
This commit is contained in:
@@ -101,9 +101,6 @@ class GeneticAlgorithm(PopulationBasedSearch, ABC):
|
||||
|
||||
new_results, self._search_over = self.get_goal_results(transformed_texts)
|
||||
|
||||
if self._search_over:
|
||||
break
|
||||
|
||||
diff_scores = (
|
||||
torch.Tensor([r.score for r in new_results]) - pop_member.result.score
|
||||
)
|
||||
@@ -119,6 +116,10 @@ class GeneticAlgorithm(PopulationBasedSearch, ABC):
|
||||
|
||||
word_select_prob_weights[idx] = 0
|
||||
iterations += 1
|
||||
|
||||
if self._search_over:
|
||||
break
|
||||
|
||||
return pop_member
|
||||
|
||||
@abstractmethod
|
||||
|
||||
Reference in New Issue
Block a user