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

update output format & PR fixes

This commit is contained in:
Jack Morris
2020-06-18 14:33:16 -04:00
parent 2bbd06b0c2
commit b27abe3fac
20 changed files with 147 additions and 66 deletions

View File

@@ -204,10 +204,10 @@ class Attack:
i = indices.popleft()
try:
text, ground_truth_output = dataset[i]
tokenized_text = AttackedText(text)
attacked_text = AttackedText(text)
self.goal_function.num_queries = 0
goal_function_result, _ = self.goal_function.get_result(
tokenized_text, ground_truth_output
attacked_text, ground_truth_output
)
if goal_function_result.succeeded:
# Store the true output on the goal function so that the
@@ -217,9 +217,7 @@ class Attack:
except IndexError:
raise IndexError(
"Out of bounds access of dataset. Size of data is {} but tried to access index {}".format(
len(dataset), i
)
f"Out of bounds access of dataset. Size of data is {len(dataset)} but tried to access index {i}"
)
def attack_dataset(self, dataset, indices=None):