From 4db4999186dd1ab51cbb4f7604758f51bf80159e Mon Sep 17 00:00:00 2001 From: Jack Morris Date: Tue, 23 Jun 2020 23:13:02 -0400 Subject: [PATCH] remove pyyaml as a dependency --- requirements.txt | 1 - textattack/loggers/attack_log_manager.py | 8 ++++---- textattack/shared/utils/install.py | 1 - 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/requirements.txt b/requirements.txt index 22e7666c..4e6565f6 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,7 +6,6 @@ nlp nltk numpy pandas -pyyaml>=5.1 scikit-learn scipy==1.4.1 sentence_transformers diff --git a/textattack/loggers/attack_log_manager.py b/textattack/loggers/attack_log_manager.py index 9fe3f1bb..95fcf136 100644 --- a/textattack/loggers/attack_log_manager.py +++ b/textattack/loggers/attack_log_manager.py @@ -12,8 +12,6 @@ class AttackLogManager: def __init__(self): self.loggers = [] self.results = [] - self.max_words_changed = 0 - self.max_seq_len = 2 ** 16 def enable_stdout(self): self.loggers.append(FileLogger(stdout=True)) @@ -71,7 +69,9 @@ class AttackLogManager: # Count things about attacks. all_num_words = np.zeros(len(self.results)) perturbed_word_percentages = np.zeros(len(self.results)) - num_words_changed_until_success = np.zeros(2**16) # @ TODO: be smarter about this + num_words_changed_until_success = np.zeros( + 2 ** 16 + ) # @ TODO: be smarter about this failed_attacks = 0 skipped_attacks = 0 successful_attacks = 0 @@ -156,7 +156,7 @@ class AttackLogManager: summary_table_rows, "Attack Results", "attack_results_summary" ) # Show histogram of words changed. - numbins = max(self.max_words_changed, 10) + numbins = max(max_words_changed, 10) for logger in self.loggers: logger.log_hist( num_words_changed_until_success[:numbins], diff --git a/textattack/shared/utils/install.py b/textattack/shared/utils/install.py index 6300d4d0..ff6f29d9 100644 --- a/textattack/shared/utils/install.py +++ b/textattack/shared/utils/install.py @@ -10,7 +10,6 @@ import filelock import requests import torch import tqdm -import yaml def path_in_cache(file_path):