Skip to content

Commit

Permalink
make format
Browse files Browse the repository at this point in the history
  • Loading branch information
qiyanjun committed Sep 11, 2023
1 parent 4854eb7 commit 87c4671
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion textattack/attack_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -728,4 +728,4 @@ def _add_parser_args(cls, parser):
parser = DatasetArgs._add_parser_args(parser)
parser = _CommandLineAttackArgs._add_parser_args(parser)
parser = AttackArgs._add_parser_args(parser)
return parser
return parser
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@

class HardLabelClassification(ClassificationGoalFunction):
"""An hard label attack on classification models which attempts to maximize
the semantic similarity of the label such that the target is outside of the decision boundary.
the semantic similarity of the label such that the target is outside of the
decision boundary.
Args:
target_max_score (float): If set, goal is to reduce model output to
below this score. Otherwise, goal is to change the overall predicted
Expand All @@ -36,4 +38,4 @@ def _get_score(self, model_output, _):
if (model_output.numel() == 1) and isinstance(self.ground_truth_output, float):
return max(model_output.item(), self.ground_truth_output)
else:
return 1 - model_output[self.ground_truth_output]
return 1 - model_output[self.ground_truth_output]

0 comments on commit 87c4671

Please sign in to comment.