Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
black format fix
  • Loading branch information
qiyanjun committed Sep 11, 2023
commit 5f841928963a15be533df37122806208dd803d68
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