Skip to content
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

Update update_test_outputs.py #781

Merged
merged 2 commits into from
Mar 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,3 @@ more-itertools
pinyin>=0.4.0
jieba
OpenHowNet
click==8.0.2
5 changes: 0 additions & 5 deletions tests/test_command_line/update_test_outputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand All @@ -43,7 +40,5 @@ def main():
update_test(command, outfile)




if __name__ == "__main__":
main()
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
-------------------------------------
"""

from transformers import pipeline
import torch

from . import WordSwap

Expand All @@ -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)
Expand Down
Loading