mirror of
https://github.com/QData/TextAttack.git
synced 2021-10-13 00:05:06 +03:00
allow maximization goal functions
This commit is contained in:
@@ -5,6 +5,7 @@ import pickle
|
||||
import time
|
||||
|
||||
from textattack.attack_results import (
|
||||
MaximizedAttackResult,
|
||||
FailedAttackResult,
|
||||
SkippedAttackResult,
|
||||
SuccessfulAttackResult,
|
||||
@@ -101,6 +102,11 @@ class Checkpoint:
|
||||
f"(Number of failed attacks): {self.num_failed_attacks}", 2
|
||||
)
|
||||
)
|
||||
breakdown_lines.append(
|
||||
utils.add_indent(
|
||||
f"(Number of maximized attacks): {self.num_maximized_attacks}", 2
|
||||
)
|
||||
)
|
||||
breakdown_lines.append(
|
||||
utils.add_indent(
|
||||
f"(Number of skipped attacks): {self.num_skipped_attacks}", 2
|
||||
@@ -140,6 +146,12 @@ class Checkpoint:
|
||||
isinstance(r, SuccessfulAttackResult) for r in self.log_manager.results
|
||||
)
|
||||
|
||||
@property
|
||||
def num_maximized_attacks(self):
|
||||
return sum(
|
||||
isinstance(r, MaximizedAttackResult) for r in self.log_manager.results
|
||||
)
|
||||
|
||||
@property
|
||||
def num_remaining_attacks(self):
|
||||
if self.args.attack_n:
|
||||
|
||||
Reference in New Issue
Block a user