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

color output and show label nd confidence score

This commit is contained in:
Jack Morris
2020-06-21 16:38:15 -04:00
parent 4bcc2deb3a
commit ff96d5f3dc
20 changed files with 143 additions and 38 deletions

View File

@@ -204,7 +204,14 @@ class Attack:
i = indices.popleft()
try:
text, ground_truth_output = dataset[i]
attacked_text = AttackedText(text)
try:
# get label names from dataset, if possible
label_names = dataset.label_names
except AttributeError:
label_names = None
attacked_text = AttackedText(
text, attack_attrs={"label_names": label_names}
)
self.goal_function.num_queries = 0
goal_function_result, _ = self.goal_function.get_result(
attacked_text, ground_truth_output