Skip to content

Attack Recipe Implementation - Leap #794

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
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
reformat files
  • Loading branch information
jstzwj committed Jul 7, 2024
commit e59bd3b11843cae6cc4ba872bb5f6045591ab8d1
6 changes: 3 additions & 3 deletions textattack/metrics/attack_metrics/words_perturbed.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ def calculate(self, results):
self.all_metrics["avg_word_perturbed"] = self.avg_number_word_perturbed_num()
self.all_metrics["avg_word_perturbed_perc"] = self.avg_perturbation_perc()
self.all_metrics["max_words_changed"] = self.max_words_changed
self.all_metrics["num_words_changed_until_success"] = (
self.num_words_changed_until_success
)
self.all_metrics[
"num_words_changed_until_success"
] = self.num_words_changed_until_success

return self.all_metrics

Expand Down
6 changes: 3 additions & 3 deletions textattack/search_methods/particle_swarm_optimization.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,9 @@ def _turn(self, source_text, target_text, prob, original_text):
& indices_to_replace
)
if "last_transformation" in source_text.attacked_text.attack_attrs:
new_text.attack_attrs["last_transformation"] = (
source_text.attacked_text.attack_attrs["last_transformation"]
)
new_text.attack_attrs[
"last_transformation"
] = source_text.attacked_text.attack_attrs["last_transformation"]

if not self.post_turn_check or (new_text.words == source_text.words):
break
Expand Down
5 changes: 1 addition & 4 deletions textattack/shared/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,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
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@


class BackTranscription(SentenceTransformation):
"""A type of sentence level transformation that takes in a text input, converts it into
synthesized speech using ASR, and transcribes it back to text using TTS.
"""A type of sentence level transformation that takes in a text input,
converts it into synthesized speech using ASR, and transcribes it back to
text using TTS.

tts_model: text-to-speech model from huggingface
asr_model: automatic speech recognition model from huggingface
Expand Down
Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy