Skip to content

Commit

Permalink
black format fix
Browse files Browse the repository at this point in the history
  • Loading branch information
qiyanjun committed Sep 11, 2023
1 parent c212d92 commit 5f84192
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
8 changes: 6 additions & 2 deletions textattack/attack_recipes/a2t_yoo_2021.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,12 @@ def build(model_wrapper, mlm=False):
#

max_len = getattr(model_wrapper, "max_length", None) or min(
1024, model_wrapper.tokenizer.model_max_length, model_wrapper.model.config.max_position_embeddings - 2
1024,
model_wrapper.tokenizer.model_max_length,
model_wrapper.model.config.max_position_embeddings - 2,
)
search_method = GreedyWordSwapWIR(
wir_method="gradient", truncate_words_to=max_len
)
search_method = GreedyWordSwapWIR(wir_method="gradient", truncate_words_to=max_len)

return Attack(goal_function, constraints, transformation, search_method)
5 changes: 1 addition & 4 deletions textattack/shared/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,7 @@
r"^textattack.models.helpers.word_cnn_for_classification.*",
r"^transformers.modeling_\w*\.\w*ForSequenceClassification$",
],
(
NonOverlappingOutput,
MinimizeBleu,
): [
(NonOverlappingOutput, MinimizeBleu,): [
r"^textattack.models.helpers.t5_for_text_to_text.*",
],
}
Expand Down

0 comments on commit 5f84192

Please sign in to comment.