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

add kuleshov recipe; rename attack_methods --> search_methods

This commit is contained in:
Jack Morris
2020-05-06 23:19:13 -04:00
parent dd848c7ac1
commit f140541560
16 changed files with 44 additions and 20 deletions

View File

@@ -34,7 +34,7 @@ class LanguageModelConstraint(Constraint):
x_adv_prob = self.get_log_prob_at_index(x_adv, i)
if self.max_log_prob_diff is None:
x_prob, x_adv_prob = math.log(p1), math.log(p2)
return (x_prob - x_adv_prob).abs() <= self.max_log_prob_diff
return abs(x_prob - x_adv_prob) <= self.max_log_prob_diff
def extra_repr_keys(self):
return ['max_log_prob_diff']