diff --git a/requirements.txt b/requirements.txt index 59db81e3..246421e3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -20,4 +20,3 @@ more-itertools pinyin>=0.4.0 jieba OpenHowNet -click==8.0.2 diff --git a/tests/test_command_line/update_test_outputs.py b/tests/test_command_line/update_test_outputs.py index a96d3785..91e6d4f7 100644 --- a/tests/test_command_line/update_test_outputs.py +++ b/tests/test_command_line/update_test_outputs.py @@ -4,7 +4,6 @@ need to be manually edited to account for variance between runs. """ - from helpers import run_command_and_get_result from test_attack import attack_test_params from test_augment import augment_test_params @@ -29,8 +28,6 @@ def update_test(command, outfile, add_magic_str=False): open(outfile, "w").write(stdout + "\n") - - def main(): #### `textattack attack` tests #### for _, command, outfile in attack_test_params: @@ -43,7 +40,5 @@ def main(): update_test(command, outfile) - - if __name__ == "__main__": main() diff --git a/textattack/transformations/word_swaps/chn_transformations/chinese_word_swap_masked.py b/textattack/transformations/word_swaps/chn_transformations/chinese_word_swap_masked.py index ce217d50..4e12b41f 100644 --- a/textattack/transformations/word_swaps/chn_transformations/chinese_word_swap_masked.py +++ b/textattack/transformations/word_swaps/chn_transformations/chinese_word_swap_masked.py @@ -3,7 +3,7 @@ ------------------------------------- """ -from transformers import pipeline +import torch from . import WordSwap @@ -13,8 +13,7 @@ class ChineseWordSwapMaskedLM(WordSwap): model.""" def __init__(self, task="fill-mask", model="xlm-roberta-base", **kwargs): - from transformers import BertTokenizer, BertForMaskedLM - import torch + from transformers import BertForMaskedLM, BertTokenizer self.tt = BertTokenizer.from_pretrained(model) self.mm = BertForMaskedLM.from_pretrained(model)