mirror of
https://github.com/QData/TextAttack.git
synced 2021-10-13 00:05:06 +03:00
remove pyyaml as a dependency
This commit is contained in:
@@ -6,7 +6,6 @@ nlp
|
||||
nltk
|
||||
numpy
|
||||
pandas
|
||||
pyyaml>=5.1
|
||||
scikit-learn
|
||||
scipy==1.4.1
|
||||
sentence_transformers
|
||||
|
||||
@@ -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],
|
||||
|
||||
@@ -10,7 +10,6 @@ import filelock
|
||||
import requests
|
||||
import torch
|
||||
import tqdm
|
||||
import yaml
|
||||
|
||||
|
||||
def path_in_cache(file_path):
|
||||
|
||||
Reference in New Issue
Block a user